aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/traps_32.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-01-05signal/sh: Ensure si_signo is initialized in do_divide_errorEric W. Biederman1-1/+2
Set si_signo. Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Cc: Rich Felker <dalias@libc.org> Cc: Paul Mundt <lethal@linux-sh.org> Cc: linux-sh@vger.kernel.org Cc: stable@vger.kernel.org Fixes: 0983b31849bb ("sh: Wire up division and address error exceptions on SH-2A.") Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2017-03-02sched/headers: Prepare for new header dependencies before moving code to <linux/sched/task_stack.h>Ingo Molnar1-0/+2
We are going to split <linux/sched/task_stack.h> out of <linux/sched.h>, which will have to be picked up from other headers and a couple of .c files. Create a trivial placeholder <linux/sched/task_stack.h> file that just maps to <linux/sched.h> to make this patch obviously correct and bisectable. Include the new header in the files that are going to need it. Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
2014-04-03sh: don't pass saved userspace state to exception handlersBobby Bingham1-16/+7
The compiler is permitted to generate code which overwrites the parameters to a function. If those parameters include the only saved copy we have of userspace's registers, we're in trouble. Signed-off-by: Bobby Bingham <koorogi@koorogi.info> Cc: Paul Mundt <paul.mundt@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-14sh: delete __cpuinit usage from all sh filesPaul Gortmaker1-1/+1
The __cpuinit type of throwaway sections might have made sense some time ago when RAM was more constrained, but now the savings do not offset the cost and complications. For example, the fix in commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time") is a good example of the nasty type of bugs that can be created with improper use of the various __init prefixes. After a discussion on LKML[1] it was decided that cpuinit should go the way of devinit and be phased out. Once all the users are gone, we can then finally remove the macros themselves from linux/init.h. Note that some harmless section mismatch warnings may result, since notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c) are flagged as __cpuinit -- so if we remove the __cpuinit from arch specific callers, we will also get section mismatch warnings. As an intermediate step, we intend to turn the linux/init.h cpuinit content into no-ops as early as possible, since that will get rid of these warnings. In any case, they are temporary and harmless. This removes all the arch/sh uses of the __cpuinit macros from all C files. Currently sh does not have any __CPUINIT used in assembly files. [1] https://lkml.org/lkml/2013/5/20/589 Cc: Paul Mundt <lethal@linux-sh.org> Cc: linux-sh@vger.kernel.org Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2012-06-14sh: Consolidate die definitions for trap handlers.Paul Mundt1-71/+0
This kills off the _64 versions and consolidates on the more robust _32 versions instead. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-05-24sh64: Convert to unwinder API.Paul Mundt1-50/+0
This switches over to use the sh unwinder API which brings it all in line with the general sh routines (which we shuffle around at the same time), and lets us kill off more sh64-specific cruft. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-03-28Disintegrate asm/system.h for SHDavid Howells1-1/+2
Disintegrate asm/system.h for SH. Signed-off-by: David Howells <dhowells@redhat.com> cc: linux-sh@vger.kernel.org
2011-08-29sh: Add unaligned memory access for PC relative intructionsPhil Edworthy1-0/+35
This adds unaligned memory access support for the following instructions: mov.w @(disp,PC),Rn mov.l @(disp,PC),Rn These instructions are often used on SH2A toolchains. Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-08-29sh: Fix unaligned memory access for branches without delay slotsPhil Edworthy1-0/+2
This patch just clears the return code for those cases where an unaligned memory access occurs on branch instructions without a delay slot. Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-07-01perf: Remove the nmi parameter from the swevent and overflow interfacePeter Zijlstra1-1/+1
The nmi parameter indicated if we could do wakeups from the current context, if not, we would set some state and self-IPI and let the resulting interrupt do the wakeup. For the various event classes: - hardware: nmi=0; PMI is in fact an NMI or we run irq_work_run from the PMI-tail (ARM etc.) - tracepoint: nmi=0; since tracepoint could be from NMI context. - software: nmi=[0,1]; some, like the schedule thing cannot perform wakeups, and hence need 0. As one can see, there is very little nmi=1 usage, and the down-side of not using it is that on some platforms some software events can have a jiffy delay in wakeup (when arch_irq_work_raise isn't implemented). The up-side however is that we can remove the nmi parameter and save a bunch of conditionals in fast paths. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Michael Cree <mcree@orcon.net.nz> Cc: Will Deacon <will.deacon@arm.com> Cc: Deng-Cheng Zhu <dengcheng.zhu@gmail.com> Cc: Anton Blanchard <anton@samba.org> Cc: Eric B Munson <emunson@mgebm.net> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Paul Mundt <lethal@linux-sh.org> Cc: David S. Miller <davem@davemloft.net> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jason Wessel <jason.wessel@windriver.com> Cc: Don Zickus <dzickus@redhat.com> Link: http://lkml.kernel.org/n/tip-agjev8eu666tvknpb3iaj0fg@git.kernel.org Signed-off-by: Ingo Molnar <mingo@elte.hu>
2011-05-13sysfs: remove "last sysfs file:" line from the oops messagesGreg Kroah-Hartman1-1/+0
On some arches (x86, sh, arm, unicore, powerpc) the oops message would print out the last sysfs file accessed. This was very useful in finding a number of sysfs and driver core bugs in the 2.5 and early 2.6 development days, but it has been a number of years since this file has actually helped in debugging anything that couldn't also be trivially determined from the stack traceback. So it's time to delete the line. This is good as we need all the space we can get for oops messages at times on consoles. Acked-by: Phil Carmody <ext-phil.2.carmody@nokia.com> Acked-by: Ingo Molnar <mingo@elte.hu> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-10-13sh: wire up perf alignment and emulation faults.Paul Mundt1-7/+19
This plugs in the alignment and emulation fault reporting for perf sw events. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-09-30sh: boot kernel with SR.BL setMagnus Damm1-0/+3
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>
2010-02-17sh: Setup boot CPU VBR early to enable early page faults.Paul Mundt1-7/+0
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>
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>