aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/traps_32.c
Commit message (Collapse)AuthorAge
* sh: wire up perf alignment and emulation faults.Paul Mundt2010-10-12
| | | | | | | This plugs in the alignment and emulation fault reporting for perf sw events. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: boot kernel with SR.BL setMagnus Damm2010-09-29
| | | | | | | | | | | | | | | | | | | | | | Update the SH kernel to keep SR.BL set until the VBR register has been initialized. Useful to allow boot of the kernel even though exceptions are pending. Without this patch there is a window of time when exceptions such as NMI are enabled but no exception handlers are installed. This patch modifies both the zImage loader and the actual kernel to boot with BL=1, but the zImage loader is modfied in such a way that the init_sr value is unchanged to not break the zImage loader provided by kexec. Tested on sh7724 Ecovec and on the SH4AL-DSP core included in sh7372. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: Setup boot CPU VBR early to enable early page faults.Paul Mundt2010-02-16
| | | | | | | | | vmemmap and the vmsplit code amongst others need to be able to take page faults much earlier than trap_init() time, so move this in to the early CPU initialization. VBR setup for secondary CPUs is already handled through start_secondary(), so we only need to do this for the boot CPU. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
*-. Merge branches 'sh/xstate', 'sh/hw-breakpoints' and 'sh/stable-updates'Paul Mundt2010-01-12
|\ \
| * | sh: Fix up breakpoint trap handler patching on SH-2A.Paul Mundt2010-01-04
| |/ | | | | | | | | | | SH-2A was referencing the old handler that no longer exists, fix it up. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* | sh: Split out the unaligned counters and user bits.Paul Mundt2010-01-12
| | | | | | | | | | | | | | | | This splits out the unaligned access counters and userspace bits in to their own generic interface, which will allow them to be wired up on sh64 too. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* | sh: Tidy up the sh bios VBR handling.Paul Mundt2010-01-12
|/ | | | | | | | | This moves the VBR handling out of the main trap handling code and in to the sh-bios helper code. A couple of accessors are added in order to permit other kernel code to get at the VBR value for state save/restore paths. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: Make the unaligned trap handler always obey notification levels.Paul Mundt2009-12-13
| | | | | | | | | | Presently there are a couple of paths in to the alignment handler, where only the address error path presently quiets the notificiation messages based on the configuration settings. We carry over the notification level tests to the default alignment handler itself incase so that they behave uniformly. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: convert /proc/cpu/aligmnent, /proc/cpu/kernel_alignment to seq_fileAlexey Dobriyan2009-11-29
| | | | | Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: Disable SCIF2 on the SH-X3 proto CPU.Paul Mundt2009-10-18
| | | | | | | | | | | SCIF2 and the FPU exceptions happen to share vector numbers, one in EXPEVT and the other in INTEVT. This is a violation of the interface and should have never made it in to silicon. On top of that, the demux hack that was added for special dispatch is rather error prone, and introduces more problems than it solves. Kill all of it off, and just refuse to deal with SCIF2 outright. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: update die() output.Paul Mundt2009-10-12
| | | | | | | | | | | This follows the ARM change, as SH had all of the same issues: Make die() better match x86: - add printing of the last accessed sysfs file - ensure console_verbose() is called under the lock - ensure we panic outside of oops_exit() Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: Disable unaligned kernel access printks by default.Paul Mundt2009-09-30
| | | | | | | | | Certain networking and USB workloads generate floods of these accesses, so just disable it by default (thereby restoring the old behaviour). The option remains configurable from userspace, and can still be used as a debugging aid. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: Fix up uninitialized variable use caught by gcc 4.4.Paul Mundt2009-09-24
| | | | | | | | In the unaligned kernel exception fixup case the printk() was ordered before the copy_from_user(), resulting in a nonsensical instruction value. This fixes up the ordering properly. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: Handle unaligned 16-bit instructions on SH-2A.Paul Mundt2009-09-24
| | | | | | | | This adds some sanity checking in the unaligned instruction handler to verify the instruction size, which enables basic support for 16-bit fixups on SH-2A parts. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: Kill off unused se_skipped in alignment trap notification code.Paul Mundt2009-09-16
| | | | | | | Nothing is using this, resulting in a build error with certain configurations. Just kill it off. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: Only shout about fixing up unexpected unaligned accessesMatt Fleming2009-08-29
| | | | | | | | | Some unaligned accesses are completely expected. For example, the trapped_io code uses the unaligned access fixup code path so there's no need to warn about having to fixup the unaligned access. Signed-off-by: Matt Fleming <matt@console-pimps.org> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: cleanup of do_address_error()Andre Draszik2009-08-24
| | | | | | | | | | | | | | | This patch fixes a few problems with the existing code in do_address_error(). a) the variable used to printk()d the offending instruction wasn't initialized correctly. This is a fix to bug 5727 b) behaviour for CONFIG_CPU_SH2A wasn't correct c) the 'ignore address error' behaviour didn't update the PC, causing an infinite loop. Signed-off-by: Andre Draszik <andre.draszik@st.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: Allow user control over misaligned fixup handlingAndre Draszik2009-08-24
| | | | | | | | | | | | | | | This patch brings the SH4 misaligned trap handler in line with what happens on ARM: Add a /proc/cpu/alignment which can be read from to get alignment trap statistics and written to to influence the behaviour of the alignment trap handling. The value to write is a bitfield, which has the following meaning: 1 warn, 2 fixup, 4 signal In addition, we add a /proc/cpu/kernel_alignment, to enable or disable warnings in case of kernel code causing alignment errors. Signed-off by: Andre Draszik <andre.draszik@st.com> Signed-off-by: Stuart Menefy <stuart.menefy@st.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: ratelimit unaligned fixupsAndre Draszik2009-08-24
| | | | | | | | | | This patch makes sure we see messages about unaligned access fixups every now and then. Else especially userspace apps suffering from bad programming won't ever be noticed... Signed-off by: Andre Draszik <andre.draszik@st.com> Signed-off-by: Stuart Menefy <stuart.menefy@st.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: unwinder: Introduce UNWINDER_BUG() and UNWINDER_BUG_ON()Matt Fleming2009-08-21
| | | | | | | | | | | | | | We can't assume that if we execute the unwinder code and the unwinder was already running that it has faulted. Clearly two kernel threads can invoke the unwinder at the same time and may be running simultaneously. The previous approach used BUG() and BUG_ON() in the unwinder code to detect whether the unwinder was incapable of unwinding the stack, and that the next available unwinder should be used instead. A better approach is to explicitly invoke a trap handler to switch unwinders when the current unwinder cannot continue. Signed-off-by: Matt Fleming <matt@console-pimps.org>
* sh: Use the generalized stacktrace opsMatt Fleming2009-08-12
| | | | | | | | Copy the stacktrace ops code from x86 and provide a central function for use by functions that need to dump a callstack. Signed-off-by: Matt Fleming <matt@console-pimps.org> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: Rename opcode_t to insn_size_t.Paul Mundt2009-05-09
| | | | | | This is now clashing with a driver, so just rename it. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: Add UBC trap vector for SH2APeter Griffin2009-05-08
| | | | | Signed-off-by: Peter Griffin <pgriffin@mpc-data.co.uk> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: Fix up DSP context save/restore.Michael Trimarchi2009-04-04
| | | | | | | | | | | | | | | | There were a number of issues with the DSP context save/restore code, mostly left-over relics from when it was introduced on SH3-DSP with little follow-up testing, resulting in things like task_pt_dspregs() referencing incorrect state on the stack. This follows the MIPS convention of tracking the DSP state in the thread_struct and handling the state save/restore in switch_to() and finish_arch_switch() respectively. The regset interface is also updated, which allows us to finally be rid of task_pt_dspregs() and the special cased task_pt_regs(). Signed-off-by: Michael Trimarchi <michael@evidence.eu.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: fix unaligned and nonexistent address handlingSUGIOKA Toshinobu2009-01-21
| | | | | | | | | | | | | | | | | | unaligned and nonexistent address causes wrong exception handling in traps_32.c(handle_unaligned_access). 'handle_unalinged_ins' should return -EFAULT if address error is fixed up with kernel exception table, otherwise 'handle_unaligned_access' increases already fixed program counter and then crash. for example ioctl(fd, TCGETA, (struct termio *)-1) never return and stay in TASK_UNINTERRUPTIBLE state forever in my kernel. Signed-off-by: SUGIOKA Toshinobu <sugioka@itonet.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* remove linux/hardirq.h from asm-generic/local.hRussell King2009-01-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While looking at reducing the amount of architecture namespace pollution in the generic kernel, I found that asm/irq.h is included in the vast majority of compilations on ARM (around 650 files.) Since asm/irq.h includes a sub-architecture include file on ARM, this causes a negative impact on the ccache's ability to re-use the build results from other sub-architectures, so we have a desire to reduce the dependencies on asm/irq.h. It turns out that a major cause of this is the needless include of linux/hardirq.h into asm-generic/local.h. The patch below removes this include, resulting in some 250 to 300 files (around half) of the kernel then omitting asm/irq.h. My test builds still succeed, provided two ARM files are fixed (arch/arm/kernel/traps.c and arch/arm/mm/fault.c) - so there may be negative impacts for this on other architectures. Note that x86 does not include asm/irq.h nor linux/hardirq.h in its asm/local.h, so this patch can be viewed as bringing the generic version into line with the x86 version. [kosaki.motohiro@jp.fujitsu.com: add #include <linux/irqflags.h> to acpi/processor_idle.c] [adobriyan@gmail.com: fix sparc64] Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* sh: Generic kgdb stub support.Paul Mundt2008-12-22
| | | | | | | | This migrates from the old bitrotted kgdb stub implementation and moves to the generic stub. In the process support for SH-2/SH-2A is also added, which the old stub never provided. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: Tidy up backtrace formatting with kallsyms disabled.Paul Mundt2008-12-22
| | | | Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: Add a few more branch types to the branch emulator.Paul Mundt2008-12-22
| | | | | | | This plugs in some extra encodings for matching more bsr/bsrf/jsr branches. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: Wire up oops reporting in the die notifier chain.Paul Mundt2008-10-21
| | | | | | | | | | | Commit 3f5a54e371ca20b119b73704f6c01b71295c1714 ("ftrace: dump out ftrace buffers to console on panic") added an ftrace buffer dumper that hooks in to the die notifier chain and dumps out data in the oops path. Unfortunately SH supported ftrace but didn't support DIE_OOPS, so add that in and get it building again. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: Move lookup_exception_vector() out to asm/system_32.h.Paul Mundt2008-09-20
| | | | | | | | There are other places where we want to have access to the trap/exception number, so move out the lookup_exception_vector() helper. While we're at it, refactor it slightly to return the vector instead. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: Fix up fpu emu build.Paul Mundt2008-09-17
| | | | | | | The addition of the kprobes code pushed down a variable declaration, clean it up. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: Add kprobes support.Chris Smith2008-09-07
| | | | | | | | | Initial support for kprobes/kretprobes for 32-bit SH platforms. [ General cleanup and some rework for the kretprobe hash lock. -- PFM ] Signed-off-by: Chris Smith <chris.smith@st.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: fixup many sparse errors.Paul Mundt2008-09-07
| | | | Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh2(A) exception handler updateYoshinori Sato2008-07-28
| | | | | | | | | | | | | | | | This patch is By sh2 - Remove duplicate code - Reduce stack usage - Cleanup and little optimize By sh2a - Add missing handler(256 to 511) - Use sh2a instructions handler Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: arch/sh/kernel/traps_32.c needs asm/fpu.hAndrew Morton2008-04-15
| | | | | | | | arch/sh/kernel/traps_32.c: In function `do_reserved_inst': arch/sh/kernel/traps_32.c:667: error: implicit declaration of function `do_fpu_inst' Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: trapped io support V2Magnus Damm2008-02-14
| | | | | | | | | | | | | | | | | | | The idea is that we want to get rid of the in/out/readb/writeb callbacks from the machvec and replace that with simple inline read and write operations to memory. Fast and simple for most hardware devices (think pci). Some devices require special treatment though - like 16-bit only CF devices - so we need to have some method to hook in callbacks. This patch makes it possible to add a per-device trap generating filter. This way we can get maximum performance of sane hardware - which doesn't need this filter - and crappy hardware works but gets punished by a performance hit. V2 changes things around a bit and replaces io access callbacks with a simple minimum_bus_width value. In the future we can add stride as well. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: use opcode_t and enable unaligned code for sh2aMagnus Damm2008-02-14
| | | | | | | | This patch converts the unaligned access handling code to use opcode_t instead of u16. While at it, enable unaligned access handling for sh2a. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: add byte support to the sign extension codeMagnus Damm2008-02-14
| | | | | | | | | This patch adds byte support to the sign extension code. Unaligned access traps should never be generated on 8-bit io operations, but we will use this code for trapped io and we do need byte support there. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: break out unaligned sign extension codeMagnus Damm2008-02-14
| | | | | | | Break out the sign extension code since it's used in multiple places. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: SH-2A FPU support.Paul Mundt2008-01-27
| | | | | Signed-off-by: Kieran Bingham <kbingham@mpc-data.co.uk> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: Share bug/debug traps across _32 and _64.Paul Mundt2008-01-27
| | | | Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* sh: Move in the SH-5 traps.c impl.Paul Mundt2008-01-27
Signed-off-by: Paul Mundt <lethal@linux-sh.org>