powerpc64: Add a trap stack area
Currently, the trap code switches to the the temporary stack in the dbtrap section. It works in most cases, but in the beginning of the execution, the temp stack is being used, as starting in the powerpc_init() code. In this current scenario, the stack is being overwritten, which causes the return of breakpoint() to take abnormal execution. This current patchset create a small stack to use by the dbtrap: codepath avoiding the corruption of the temporary stack. PR: 224872 Submitted by: breno.leitao_gmail.com Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D14484
This commit is contained in:
parent
bac4817b3a
commit
6174048251
@ -60,6 +60,12 @@ GLOBAL(__endkernel)
|
||||
GLOBAL(tmpstk)
|
||||
.space TMPSTKSZ
|
||||
|
||||
#ifdef KDB
|
||||
#define TRAPSTKSZ 4096 /* 4k trap stack */
|
||||
GLOBAL(trapstk)
|
||||
.space TRAPSTKSZ
|
||||
#endif
|
||||
|
||||
.text
|
||||
.globl btext
|
||||
btext:
|
||||
|
@ -65,6 +65,14 @@ GLOBAL(tmpstk)
|
||||
TOC_ENTRY(tmpstk)
|
||||
TOC_ENTRY(can_wakeup)
|
||||
|
||||
#ifdef KDB
|
||||
#define TRAPSTKSZ 4096 /* 4k trap stack */
|
||||
GLOBAL(trapstk)
|
||||
.space TRAPSTKSZ
|
||||
TOC_ENTRY(trapstk)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Entry point for bootloaders that do not fully implement ELF and start
|
||||
* at the beginning of the image (kexec, notably). In its own section so
|
||||
|
@ -864,8 +864,8 @@ dbtrap:
|
||||
mtsprg3 %r1
|
||||
|
||||
lwz %r1,TRAP_TOCBASE(0) /* get new SP */
|
||||
lwz %r1,tmpstk@got(%r1)
|
||||
addi %r1,%r1,TMPSTKSZ-16
|
||||
lwz %r1,trapstk@got(%r1)
|
||||
addi %r1,%r1,TRAPSTKSZ-16
|
||||
|
||||
FRAME_SETUP(PC_DBSAVE)
|
||||
/* Call C trap code: */
|
||||
|
@ -897,8 +897,8 @@ dbtrap:
|
||||
mtsprg3 %r1
|
||||
|
||||
GET_TOCBASE(%r1) /* get new SP */
|
||||
ld %r1,TOC_REF(tmpstk)(%r1)
|
||||
addi %r1,%r1,(TMPSTKSZ-48)
|
||||
ld %r1,TOC_REF(trapstk)(%r1)
|
||||
addi %r1,%r1,(TRAPSTKSZ-48)
|
||||
|
||||
FRAME_SETUP(PC_DBSAVE)
|
||||
/* Call C trap code: */
|
||||
|
Loading…
Reference in New Issue
Block a user