Commit d097efa9 authored by Sam Ravnborg's avatar Sam Ravnborg Committed by David S. Miller
Browse files

sparc32: drop hardcoding trap_level in kgdb_trap



Fix this so we pass the trap_level from the actual trap
code like we do in sparc64.
Add use on ENTRY(), ENDPROC() in the assembler function too.

This fixes a bug where the hardcoded value for trap_level
was the sparc64 value.

As the generic code does not use the trap_level argument
(for sparc32) - this patch does not have any functional impact.

Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 33656a1f
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -44,9 +44,9 @@


#ifdef CONFIG_KGDB
#ifdef CONFIG_KGDB
#define KGDB_TRAP(num)                  \
#define KGDB_TRAP(num)                  \
	mov num, %l7;                   \
	b kgdb_trap_low;                \
	b kgdb_trap_low;                \
	rd %psr,%l0;                    \
	rd %psr,%l0;                    \
	nop; \
	nop;
	nop;
#else
#else
#define KGDB_TRAP(num) \
#define KGDB_TRAP(num) \
+1 −1
Original line number Original line Diff line number Diff line
@@ -28,10 +28,10 @@ enum regnames {
#define NUMREGBYTES		((GDB_CSR + 1) * 4)
#define NUMREGBYTES		((GDB_CSR + 1) * 4)
#else
#else
#define NUMREGBYTES		((GDB_Y + 1) * 8)
#define NUMREGBYTES		((GDB_Y + 1) * 8)
#endif


struct pt_regs;
struct pt_regs;
asmlinkage void kgdb_trap(unsigned long trap_level, struct pt_regs *regs);
asmlinkage void kgdb_trap(unsigned long trap_level, struct pt_regs *regs);
#endif


void arch_kgdb_breakpoint(void);
void arch_kgdb_breakpoint(void);


+4 −6
Original line number Original line Diff line number Diff line
@@ -1225,20 +1225,18 @@ breakpoint_trap:
	RESTORE_ALL
	RESTORE_ALL


#ifdef CONFIG_KGDB
#ifdef CONFIG_KGDB
	.align	4
	ENTRY(kgdb_trap_low)
	.globl	kgdb_trap_low
	.type	kgdb_trap_low,#function
kgdb_trap_low:
	rd	%wim,%l3
	rd	%wim,%l3
	SAVE_ALL
	SAVE_ALL
	wr 	%l0, PSR_ET, %psr
	wr 	%l0, PSR_ET, %psr
	WRITE_PAUSE
	WRITE_PAUSE


	mov	%l7, %o0		! trap_level
	call	kgdb_trap
	call	kgdb_trap
	 add	%sp, STACKFRAME_SZ, %o0
	 add	%sp, STACKFRAME_SZ, %o1	! struct pt_regs *regs


	RESTORE_ALL
	RESTORE_ALL
	.size	kgdb_trap_low,.-kgdb_trap_low
	ENDPROC(kgdb_trap_low)
#endif
#endif


	.align	4
	.align	4
+3 −3
Original line number Original line Diff line number Diff line
@@ -135,19 +135,19 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,


extern void do_hw_interrupt(struct pt_regs *regs, unsigned long type);
extern void do_hw_interrupt(struct pt_regs *regs, unsigned long type);


asmlinkage void kgdb_trap(struct pt_regs *regs)
asmlinkage void kgdb_trap(unsigned long trap_level, struct pt_regs *regs)
{
{
	unsigned long flags;
	unsigned long flags;


	if (user_mode(regs)) {
	if (user_mode(regs)) {
		do_hw_interrupt(regs, 0xfd);
		do_hw_interrupt(regs, trap_level);
		return;
		return;
	}
	}


	flushw_all();
	flushw_all();


	local_irq_save(flags);
	local_irq_save(flags);
	kgdb_handle_exception(0x172, SIGTRAP, 0, regs);
	kgdb_handle_exception(trap_level, SIGTRAP, 0, regs);
	local_irq_restore(flags);
	local_irq_restore(flags);
}
}