diff options
-rw-r--r-- | arch/sparc64/kernel/etrap.S | 4 | ||||
-rw-r--r-- | include/asm-sparc64/ptrace.h | 18 |
2 files changed, 20 insertions, 2 deletions
diff --git a/arch/sparc64/kernel/etrap.S b/arch/sparc64/kernel/etrap.S index 4b2bf9eb447a..b49d3b60bc0c 100644 --- a/arch/sparc64/kernel/etrap.S +++ b/arch/sparc64/kernel/etrap.S | |||
@@ -53,7 +53,11 @@ etrap_irq: | |||
53 | stx %g3, [%g2 + STACKFRAME_SZ + PT_V9_TPC] | 53 | stx %g3, [%g2 + STACKFRAME_SZ + PT_V9_TPC] |
54 | rd %y, %g3 | 54 | rd %y, %g3 |
55 | stx %g1, [%g2 + STACKFRAME_SZ + PT_V9_TNPC] | 55 | stx %g1, [%g2 + STACKFRAME_SZ + PT_V9_TNPC] |
56 | rdpr %tt, %g1 | ||
56 | st %g3, [%g2 + STACKFRAME_SZ + PT_V9_Y] | 57 | st %g3, [%g2 + STACKFRAME_SZ + PT_V9_Y] |
58 | sethi %hi(PT_REGS_MAGIC), %g3 | ||
59 | or %g3, %g1, %g1 | ||
60 | st %g1, [%g2 + STACKFRAME_SZ + PT_V9_MAGIC] | ||
57 | 61 | ||
58 | rdpr %cansave, %g1 | 62 | rdpr %cansave, %g1 |
59 | brnz,pt %g1, etrap_save | 63 | brnz,pt %g1, etrap_save |
diff --git a/include/asm-sparc64/ptrace.h b/include/asm-sparc64/ptrace.h index 6da197803efc..b4b951d570bb 100644 --- a/include/asm-sparc64/ptrace.h +++ b/include/asm-sparc64/ptrace.h | |||
@@ -8,6 +8,8 @@ | |||
8 | * stack during a system call and basically all traps. | 8 | * stack during a system call and basically all traps. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #define PT_REGS_MAGIC 0x57ac6c00 | ||
12 | |||
11 | #ifndef __ASSEMBLY__ | 13 | #ifndef __ASSEMBLY__ |
12 | 14 | ||
13 | struct pt_regs { | 15 | struct pt_regs { |
@@ -16,7 +18,19 @@ struct pt_regs { | |||
16 | unsigned long tpc; | 18 | unsigned long tpc; |
17 | unsigned long tnpc; | 19 | unsigned long tnpc; |
18 | unsigned int y; | 20 | unsigned int y; |
19 | unsigned int fprs; | 21 | |
22 | /* We encode a magic number, PT_REGS_MAGIC, along | ||
23 | * with the %tt (trap type) register value at trap | ||
24 | * entry time. The magic number allows us to identify | ||
25 | * accurately a trap stack frame in the stack | ||
26 | * unwinder, and the %tt value allows us to test | ||
27 | * things like "in a system call" etc. for an arbitray | ||
28 | * process. | ||
29 | * | ||
30 | * The PT_REGS_MAGIC is choosen such that it can be | ||
31 | * loaded completely using just a sethi instruction. | ||
32 | */ | ||
33 | unsigned int magic; | ||
20 | }; | 34 | }; |
21 | 35 | ||
22 | struct pt_regs32 { | 36 | struct pt_regs32 { |
@@ -147,7 +161,7 @@ extern void __show_regs(struct pt_regs *); | |||
147 | #define PT_V9_TPC 0x88 | 161 | #define PT_V9_TPC 0x88 |
148 | #define PT_V9_TNPC 0x90 | 162 | #define PT_V9_TNPC 0x90 |
149 | #define PT_V9_Y 0x98 | 163 | #define PT_V9_Y 0x98 |
150 | #define PT_V9_FPRS 0x9c | 164 | #define PT_V9_MAGIC 0x9c |
151 | #define PT_TSTATE PT_V9_TSTATE | 165 | #define PT_TSTATE PT_V9_TSTATE |
152 | #define PT_TPC PT_V9_TPC | 166 | #define PT_TPC PT_V9_TPC |
153 | #define PT_TNPC PT_V9_TNPC | 167 | #define PT_TNPC PT_V9_TNPC |