diff options
author | Olof Johansson <olof@lixom.net> | 2007-04-23 11:11:55 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-04-24 08:06:59 -0400 |
commit | 687304014f7ca8e2fbb3feaefef356b4a0da65ad (patch) | |
tree | 2212a33688e74d8c8bef0affe67cabbf5a14e03c | |
parent | 6cfef5b27e49e826125f12637ee0d7210a896044 (diff) |
[POWERPC] Save trap number in bad_stack
Save the trap number in the case of getting a bad stack in an exception
handler. It is sometimes useful to know what exception it was that caused
this to happen. Without this, no trap number is reported.
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/kernel/asm-offsets.c | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/head_64.S | 10 | ||||
-rw-r--r-- | include/asm-powerpc/paca.h | 1 |
3 files changed, 10 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 9735e828b52d..0c5150c69175 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c | |||
@@ -139,6 +139,7 @@ int main(void) | |||
139 | DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time)); | 139 | DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time)); |
140 | DEFINE(PACA_SLBSHADOWPTR, offsetof(struct paca_struct, slb_shadow_ptr)); | 140 | DEFINE(PACA_SLBSHADOWPTR, offsetof(struct paca_struct, slb_shadow_ptr)); |
141 | DEFINE(PACA_DATA_OFFSET, offsetof(struct paca_struct, data_offset)); | 141 | DEFINE(PACA_DATA_OFFSET, offsetof(struct paca_struct, data_offset)); |
142 | DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save)); | ||
142 | 143 | ||
143 | DEFINE(SLBSHADOW_STACKVSID, | 144 | DEFINE(SLBSHADOW_STACKVSID, |
144 | offsetof(struct slb_shadow, save_area[SLB_NUM_BOLTED - 1].vsid)); | 145 | offsetof(struct slb_shadow, save_area[SLB_NUM_BOLTED - 1].vsid)); |
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S index aff5398a5f63..1111fcec7673 100644 --- a/arch/powerpc/kernel/head_64.S +++ b/arch/powerpc/kernel/head_64.S | |||
@@ -278,8 +278,12 @@ exception_marker: | |||
278 | beq- 1f; \ | 278 | beq- 1f; \ |
279 | ld r1,PACAKSAVE(r13); /* kernel stack to use */ \ | 279 | ld r1,PACAKSAVE(r13); /* kernel stack to use */ \ |
280 | 1: cmpdi cr1,r1,0; /* check if r1 is in userspace */ \ | 280 | 1: cmpdi cr1,r1,0; /* check if r1 is in userspace */ \ |
281 | bge- cr1,bad_stack; /* abort if it is */ \ | 281 | bge- cr1,2f; /* abort if it is */ \ |
282 | std r9,_CCR(r1); /* save CR in stackframe */ \ | 282 | b 3f; \ |
283 | 2: li r1,(n); /* will be reloaded later */ \ | ||
284 | sth r1,PACA_TRAP_SAVE(r13); \ | ||
285 | b bad_stack; \ | ||
286 | 3: std r9,_CCR(r1); /* save CR in stackframe */ \ | ||
283 | std r11,_NIP(r1); /* save SRR0 in stackframe */ \ | 287 | std r11,_NIP(r1); /* save SRR0 in stackframe */ \ |
284 | std r12,_MSR(r1); /* save SRR1 in stackframe */ \ | 288 | std r12,_MSR(r1); /* save SRR1 in stackframe */ \ |
285 | std r10,0(r1); /* make stack chain pointer */ \ | 289 | std r10,0(r1); /* make stack chain pointer */ \ |
@@ -940,6 +944,8 @@ bad_stack: | |||
940 | SAVE_2GPRS(7,r1) | 944 | SAVE_2GPRS(7,r1) |
941 | SAVE_10GPRS(12,r1) | 945 | SAVE_10GPRS(12,r1) |
942 | SAVE_10GPRS(22,r1) | 946 | SAVE_10GPRS(22,r1) |
947 | lhz r12,PACA_TRAP_SAVE(r13) | ||
948 | std r12,_TRAP(r1) | ||
943 | addi r11,r1,INT_FRAME_SIZE | 949 | addi r11,r1,INT_FRAME_SIZE |
944 | std r11,0(r1) | 950 | std r11,0(r1) |
945 | li r12,0 | 951 | li r12,0 |
diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h index 4de851d91f96..cf95274f735e 100644 --- a/include/asm-powerpc/paca.h +++ b/include/asm-powerpc/paca.h | |||
@@ -94,6 +94,7 @@ struct paca_struct { | |||
94 | u64 stab_rr; /* stab/slb round-robin counter */ | 94 | u64 stab_rr; /* stab/slb round-robin counter */ |
95 | u64 saved_r1; /* r1 save for RTAS calls */ | 95 | u64 saved_r1; /* r1 save for RTAS calls */ |
96 | u64 saved_msr; /* MSR saved here by enter_rtas */ | 96 | u64 saved_msr; /* MSR saved here by enter_rtas */ |
97 | u16 trap_save; /* Used when bad stack is encountered */ | ||
97 | u8 soft_enabled; /* irq soft-enable flag */ | 98 | u8 soft_enabled; /* irq soft-enable flag */ |
98 | u8 hard_enabled; /* set if irqs are enabled in MSR */ | 99 | u8 hard_enabled; /* set if irqs are enabled in MSR */ |
99 | u8 io_sync; /* writel() needs spin_unlock sync */ | 100 | u8 io_sync; /* writel() needs spin_unlock sync */ |