Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1e1030dc authored by Paul Mundt's avatar Paul Mundt
Browse files

sh: nmi_debug support.



This implements support for NMI debugging that was shamelessly copied
from the avr32 port. A bit of special magic is needed in the interrupt
exception path given that the NMI exception handler is stubbed in to the
regular exception handling table despite being reported in INTEVT. So we
mangle the lookup and kick off an EXPEVT-style exception dispatch from
the INTEVT path for exceptions that do_IRQ() has no chance of handling.
As a result, we also drop the evt2irq() conversion from the do_IRQ() path
and just do it in assembly.

Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent ac6a0cf6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1514,7 +1514,7 @@ and is between 256 and 4096 characters. It is defined in the file
			of returning the full 64-bit number.
			The default is to return 64-bit inode numbers.

	nmi_debug=	[KNL,AVR32] Specify one or more actions to take
	nmi_debug=	[KNL,AVR32,SH] Specify one or more actions to take
			when a NMI is triggered.
			Format: [state][,regs][,debounce][,die]

+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
/* Grossly misnamed. */
enum die_val {
	DIE_TRAP,
	DIE_NMI,
	DIE_OOPS,
};

+1 −1
Original line number Diff line number Diff line
@@ -169,7 +169,7 @@ BUILD_TRAP_HANDLER(breakpoint);
BUILD_TRAP_HANDLER(singlestep);
BUILD_TRAP_HANDLER(fpu_error);
BUILD_TRAP_HANDLER(fpu_state_restore);
BUILD_TRAP_HANDLER(unwinder);
BUILD_TRAP_HANDLER(nmi);

#ifdef CONFIG_BUG
extern void handle_BUG(struct pt_regs *);
+4 −3
Original line number Diff line number Diff line
@@ -10,9 +10,10 @@ CFLAGS_REMOVE_ftrace.o = -pg
endif

obj-y	:= debugtraps.o dumpstack.o idle.o io.o io_generic.o irq.o	\
	   machvec.o process_$(BITS).o ptrace_$(BITS).o setup.o 	\
	   signal_$(BITS).o sys_sh.o sys_sh$(BITS).o syscalls_$(BITS).o	\
	   time.o topology.o traps.o traps_$(BITS).o unwinder.o
	   machvec.o nmi_debug.o process_$(BITS).o ptrace_$(BITS).o	\
	   setup.o signal_$(BITS).o sys_sh.o sys_sh$(BITS).o		\
	   syscalls_$(BITS).o time.o topology.o traps.o			\
	   traps_$(BITS).o unwinder.o

obj-y				+= cpu/
obj-$(CONFIG_VSYSCALL)		+= vsyscall/
+26 −0
Original line number Diff line number Diff line
@@ -532,7 +532,33 @@ ENTRY(handle_interrupt)
	mov.l	2f, r4
	mov.l	3f, r9
	mov.l	@r4, r4		! pass INTEVT vector as arg0

	shlr2	r4
	shlr	r4
	mov	r4, r0		! save vector->jmp table offset for later

	shlr2	r4		! vector to IRQ# conversion
	add	#-0x10, r4

	cmp/pz	r4		! is it a valid IRQ?
	bt	10f

	/*
	 * We got here as a result of taking the INTEVT path for something
	 * that isn't a valid hard IRQ, therefore we bypass the do_IRQ()
	 * path and special case the event dispatch instead.  This is the
	 * expected path for the NMI (and any other brilliantly implemented
	 * exception), which effectively wants regular exception dispatch
	 * but is unfortunately reported through INTEVT rather than
	 * EXPEVT.  Grr.
	 */
	mov.l	6f, r9
	mov.l	@(r0, r9), r9
	jmp	@r9
	 mov	r15, r8		! trap handlers take saved regs in r8

10:
	jmp	@r9		! Off to do_IRQ() we go.
	 mov	r15, r5		! pass saved registers as arg1

ENTRY(exception_none)
Loading