Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel
In directory usw-pr-cvs1:/tmp/cvs-serv27409
Modified Files:
entry.S
Log Message:
Ensure that the pt_regs structure created when an interrupt occurs
contains the correct stack pointer for the previous mode (rather than
always being the user SP - makes stack dumps more useful)
Index: entry.S
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/entry.S,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- entry.S 2001/01/26 00:27:00 1.2
+++ entry.S 2001/01/29 00:55:04 1.3
@@ -60,7 +60,26 @@
pushl (sp)[r0] /* Push saved PSL again */
pushl (sp)[r0] /* Push saved PC again */
- mfpr $PR_USP,-(sp) /* Save user SP at time of exception */
+ extzv $22, $2, 4(sp), -(sp) /* Extract PREVMODE field from saved
+ PSL and save on stack (because we
+ don't have any spare registers yet) */
+ cmpzv $24, $2, 8(sp), (sp) /* Is PREVMODE == CURMODE? */
+ beql same_mode
+ mfpr (sp),(sp) /* HACK ALERT! The processor modes are 0..3
+ for kernel..user mode. The stack pointer
+ internal processor registers are also 0..3
+ for kernel..user mode. So, using the
+ PREVMODE value we just saved on the stack,
+ we overwrite it with the correct stack
+ pointer register. Net result: the saved_sp
+ here is the correct stack pointer for the
+ processor mode before the exception occurred */
+ brb sp_saved
+same_mode:
+ moval 16(sp)[r0],(sp) /* Exception is not changing modes. Therefore
+ we calculate how far up the stack the SP
+ was pointing when the exception occurred. */
+sp_saved:
pushr $0x3ffe /* Push FP to R1 */
pushl 64(sp) /* Duplicate saved R0 */
@@ -69,7 +88,7 @@
SP: saved R0
+4 saved R1
...
- +56 saved user SP
+ +56 saved SP for previous mode
+60 saved PC
+64 saved PSL
+68 saved R0
@@ -111,7 +130,7 @@
/* The stack now looks like:
- SP: saved user SP
+ SP: saved SP for previous mode
+4 saved PC (maybe modified by exception handler)
+8 saved PSL (end of struct pt_regs)
+12 saved R0 (maybe modified by exception handler)
@@ -135,7 +154,7 @@
/* The stack now looks like:
- SP: saved user SP
+ SP: saved SP for previous mode
+4 saved PC (maybe modified by exception handler)
+8 saved PSL (end of struct pt_regs)
+12 saved R0 (maybe modified by exception handler)
|