aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/traps_32.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2010-01-13Merge branches 'sh/xstate', 'sh/hw-breakpoints' and 'sh/stable-updates'Paul Mundt1-1/+1
2010-01-12sh: Split out the unaligned counters and user bits.Paul Mundt1-134/+17
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>
2010-01-12sh: Tidy up the sh bios VBR handling.Paul Mundt1-25/+4
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>
2010-01-05sh: Fix up breakpoint trap handler patching on SH-2A.Paul Mundt1-1/+1
SH-2A was referencing the old handler that no longer exists, fix it up. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-12-14sh: Make the unaligned trap handler always obey notification levels.Paul Mundt1-6/+12
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>
2009-11-30sh: convert /proc/cpu/aligmnent, /proc/cpu/kernel_alignment to seq_fileAlexey Dobriyan1-46/+31
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-18sh: Disable SCIF2 on the SH-X3 proto CPU.Paul Mundt1-5/+0
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>
2009-10-13sh: update die() output.Paul Mundt1-3/+4
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>
2009-09-30sh: Disable unaligned kernel access printks by default.Paul Mundt1-2/+2
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>
2009-09-24sh: Fix up uninitialized variable use caught by gcc 4.4.Paul Mundt1-6/+6
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>
2009-09-24sh: Handle unaligned 16-bit instructions on SH-2A.Paul Mundt1-3/+8
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>
2009-09-16sh: Kill off unused se_skipped in alignment trap notification code.Paul Mundt1-2/+0
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>
2009-08-29sh: Only shout about fixing up unexpected unaligned accessesMatt Fleming1-4/+5
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>
2009-08-24sh: cleanup of do_address_error()Andre Draszik1-10/+10
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>
2009-08-24sh: Allow user control over misaligned fixup handlingAndre Draszik1-0/+153
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>
2009-08-24sh: ratelimit unaligned fixupsAndre Draszik1-13/+4
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>
2009-08-21sh: unwinder: Introduce UNWINDER_BUG() and UNWINDER_BUG_ON()Matt Fleming1-0/+1
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>
2009-08-13sh: Use the generalized stacktrace opsMatt Fleming1-24/+0
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>
2009-05-09sh: Rename opcode_t to insn_size_t.Paul Mundt1-5/+5
This is now clashing with a driver, so just rename it. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-09sh: Add UBC trap vector for SH2APeter Griffin1-0/+5
Signed-off-by: Peter Griffin <pgriffin@mpc-data.co.uk> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-04sh: Fix up DSP context save/restore.Michael Trimarchi1-0/+2
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>
2009-01-21sh: fix unaligned and nonexistent address handlingSUGIOKA Toshinobu1-5/+4
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>
2009-01-06remove linux/hardirq.h from asm-generic/local.hRussell King1-0/+1
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>
2008-12-22sh: Generic kgdb stub support.Paul Mundt1-14/+0
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>
2008-12-22sh: Tidy up backtrace formatting with kallsyms disabled.Paul Mundt1-4/+1
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22sh: Add a few more branch types to the branch emulator.Paul Mundt1-6/+11
This plugs in some extra encodings for matching more bsr/bsrf/jsr branches. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-21sh: Wire up oops reporting in the die notifier chain.Paul Mundt1-0/+2
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>
2008-09-21sh: Move lookup_exception_vector() out to asm/system_32.h.Paul Mundt1-12/+4
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>
2008-09-17sh: Fix up fpu emu build.Paul Mundt1-5/+3
The addition of the kprobes code pushed down a variable declaration, clean it up. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-09-08sh: Add kprobes support.Chris Smith1-0/+5
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>
2008-09-08sh: fixup many sparse errors.Paul Mundt1-33/+35
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-07-28sh2(A) exception handler updateYoshinori Sato1-0/+4
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>
2008-04-16sh: arch/sh/kernel/traps_32.c needs asm/fpu.hAndrew Morton1-0/+1
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>
2008-02-14sh: trapped io support V2Magnus Damm1-25/+34
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>
2008-02-14sh: use opcode_t and enable unaligned code for sh2aMagnus Damm1-34/+25
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>
2008-02-14sh: add byte support to the sign extension codeMagnus Damm1-1/+11
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>
2008-02-14sh: break out unaligned sign extension codeMagnus Damm1-45/+23
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>
2008-01-28sh: SH-2A FPU support.Paul Mundt1-9/+4
Signed-off-by: Kieran Bingham <kbingham@mpc-data.co.uk> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-01-28sh: Share bug/debug traps across _32 and _64.Paul Mundt1-24/+1
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-01-28sh: Move in the SH-5 traps.c impl.Paul Mundt1-0/+947
Signed-off-by: Paul Mundt <lethal@linux-sh.org>