From: olof@lixom.net (Olof Johansson)
To: paulus@samba.org
Cc: linuxppc-dev@ozlabs.org, anton@samba.org
Subject: [PATCH] [v3] powerpc: save trap number in bad_stack
Date: Mon, 23 Apr 2007 07:19:31 -0500 [thread overview]
Message-ID: <20070423121931.GA683@lixom.net> (raw)
In-Reply-To: <20070422233821.GB28479@lixom.net>
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 is reported.
Signed-off-by: Olof Johansson <olof@lixom.net>
Index: powerpc/arch/powerpc/kernel/asm-offsets.c
===================================================================
--- powerpc.orig/arch/powerpc/kernel/asm-offsets.c
+++ powerpc/arch/powerpc/kernel/asm-offsets.c
@@ -139,6 +139,7 @@ int main(void)
DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time));
DEFINE(PACA_SLBSHADOWPTR, offsetof(struct paca_struct, slb_shadow_ptr));
DEFINE(PACA_DATA_OFFSET, offsetof(struct paca_struct, data_offset));
+ DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save));
DEFINE(SLBSHADOW_STACKVSID,
offsetof(struct slb_shadow, save_area[SLB_NUM_BOLTED - 1].vsid));
Index: powerpc/include/asm-powerpc/paca.h
===================================================================
--- powerpc.orig/include/asm-powerpc/paca.h
+++ powerpc/include/asm-powerpc/paca.h
@@ -68,6 +68,7 @@ struct paca_struct {
void *emergency_sp; /* pointer to emergency stack */
u64 data_offset; /* per cpu data offset */
s16 hw_cpu_id; /* Physical processor number */
+ u16 trap_save; /* Used when bad stack is encountered */
u8 cpu_start; /* At startup, processor spins until */
/* this becomes non-zero. */
struct slb_shadow *slb_shadow_ptr;
Index: powerpc/arch/powerpc/kernel/head_64.S
===================================================================
--- powerpc.orig/arch/powerpc/kernel/head_64.S
+++ powerpc/arch/powerpc/kernel/head_64.S
@@ -278,8 +278,12 @@ exception_marker:
beq- 1f; \
ld r1,PACAKSAVE(r13); /* kernel stack to use */ \
1: cmpdi cr1,r1,0; /* check if r1 is in userspace */ \
- bge- cr1,bad_stack; /* abort if it is */ \
- std r9,_CCR(r1); /* save CR in stackframe */ \
+ bge- cr1,2f; /* abort if it is */ \
+ b 3f; \
+2: li r1,(n); /* will be reloaded later */ \
+ sth r1,PACA_TRAP_SAVE(r13); \
+ b bad_stack; \
+3: std r9,_CCR(r1); /* save CR in stackframe */ \
std r11,_NIP(r1); /* save SRR0 in stackframe */ \
std r12,_MSR(r1); /* save SRR1 in stackframe */ \
std r10,0(r1); /* make stack chain pointer */ \
@@ -940,6 +944,8 @@ bad_stack:
SAVE_2GPRS(7,r1)
SAVE_10GPRS(12,r1)
SAVE_10GPRS(22,r1)
+ lhz r12,PACA_TRAP_SAVE(r13)
+ std r12,_TRAP(r1)
addi r11,r1,INT_FRAME_SIZE
std r11,0(r1)
li r12,0
next prev parent reply other threads:[~2007-04-23 12:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-16 6:23 [PATCH] powerpc: save trap number in bad_stack Olof Johansson
2007-04-19 23:17 ` Benjamin Herrenschmidt
2007-04-20 2:18 ` Michael Ellerman
2007-04-20 8:51 ` Segher Boessenkool
2007-04-22 23:34 ` Olof Johansson
2007-04-22 23:38 ` [PATCH] [v2] " Olof Johansson
2007-04-23 9:29 ` Gabriel Paubert
2007-04-23 11:49 ` Olof Johansson
2007-04-23 12:19 ` Olof Johansson [this message]
2007-04-23 15:11 ` [PATCH] [v4] " Olof Johansson
2007-04-23 15:34 ` Stephen Rothwell
2007-04-23 13:22 ` [PATCH] [v2] " Stephen Rothwell
2007-04-23 13:33 ` Michael Ellerman
2007-04-23 13:39 ` David Gibson
2007-04-23 13:54 ` Olof Johansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070423121931.GA683@lixom.net \
--to=olof@lixom.net \
--cc=anton@samba.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.