diff options
author | Michael Neuling <mikey@neuling.org> | 2008-01-17 23:50:30 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-01-25 06:52:50 -0500 |
commit | c3b75bd7bbf4a0438dc140033b80657995fd30ed (patch) | |
tree | 4621ebbf620d6262fccf61811824386b9ba50915 /arch/powerpc/kernel/misc.S | |
parent | caa34c9e9cab6afb243a3da406cce272805c48c5 (diff) |
[POWERPC] Make setjmp/longjmp code usable outside of xmon
This makes the setjmp/longjmp code used by xmon, generically available
to other code. It also removes the requirement for debugger hooks to
be only called on 0x300 (data storage) exception.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/misc.S')
-rw-r--r-- | arch/powerpc/kernel/misc.S | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/misc.S b/arch/powerpc/kernel/misc.S index 74ce0c7a7b1e..7b9160220698 100644 --- a/arch/powerpc/kernel/misc.S +++ b/arch/powerpc/kernel/misc.S | |||
@@ -8,6 +8,8 @@ | |||
8 | * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com) | 8 | * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com) |
9 | * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com) | 9 | * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com) |
10 | * | 10 | * |
11 | * setjmp/longjmp code by Paul Mackerras. | ||
12 | * | ||
11 | * This program is free software; you can redistribute it and/or | 13 | * This program is free software; you can redistribute it and/or |
12 | * modify it under the terms of the GNU General Public License | 14 | * modify it under the terms of the GNU General Public License |
13 | * as published by the Free Software Foundation; either version | 15 | * as published by the Free Software Foundation; either version |
@@ -15,6 +17,8 @@ | |||
15 | */ | 17 | */ |
16 | #include <asm/ppc_asm.h> | 18 | #include <asm/ppc_asm.h> |
17 | #include <asm/unistd.h> | 19 | #include <asm/unistd.h> |
20 | #include <asm/asm-compat.h> | ||
21 | #include <asm/asm-offsets.h> | ||
18 | 22 | ||
19 | .text | 23 | .text |
20 | 24 | ||
@@ -51,3 +55,64 @@ _GLOBAL(kernel_execve) | |||
51 | bnslr | 55 | bnslr |
52 | neg r3,r3 | 56 | neg r3,r3 |
53 | blr | 57 | blr |
58 | |||
59 | _GLOBAL(setjmp) | ||
60 | mflr r0 | ||
61 | PPC_STL r0,0(r3) | ||
62 | PPC_STL r1,SZL(r3) | ||
63 | PPC_STL r2,2*SZL(r3) | ||
64 | mfcr r0 | ||
65 | PPC_STL r0,3*SZL(r3) | ||
66 | PPC_STL r13,4*SZL(r3) | ||
67 | PPC_STL r14,5*SZL(r3) | ||
68 | PPC_STL r15,6*SZL(r3) | ||
69 | PPC_STL r16,7*SZL(r3) | ||
70 | PPC_STL r17,8*SZL(r3) | ||
71 | PPC_STL r18,9*SZL(r3) | ||
72 | PPC_STL r19,10*SZL(r3) | ||
73 | PPC_STL r20,11*SZL(r3) | ||
74 | PPC_STL r21,12*SZL(r3) | ||
75 | PPC_STL r22,13*SZL(r3) | ||
76 | PPC_STL r23,14*SZL(r3) | ||
77 | PPC_STL r24,15*SZL(r3) | ||
78 | PPC_STL r25,16*SZL(r3) | ||
79 | PPC_STL r26,17*SZL(r3) | ||
80 | PPC_STL r27,18*SZL(r3) | ||
81 | PPC_STL r28,19*SZL(r3) | ||
82 | PPC_STL r29,20*SZL(r3) | ||
83 | PPC_STL r30,21*SZL(r3) | ||
84 | PPC_STL r31,22*SZL(r3) | ||
85 | li r3,0 | ||
86 | blr | ||
87 | |||
88 | _GLOBAL(longjmp) | ||
89 | PPC_LCMPI r4,0 | ||
90 | bne 1f | ||
91 | li r4,1 | ||
92 | 1: PPC_LL r13,4*SZL(r3) | ||
93 | PPC_LL r14,5*SZL(r3) | ||
94 | PPC_LL r15,6*SZL(r3) | ||
95 | PPC_LL r16,7*SZL(r3) | ||
96 | PPC_LL r17,8*SZL(r3) | ||
97 | PPC_LL r18,9*SZL(r3) | ||
98 | PPC_LL r19,10*SZL(r3) | ||
99 | PPC_LL r20,11*SZL(r3) | ||
100 | PPC_LL r21,12*SZL(r3) | ||
101 | PPC_LL r22,13*SZL(r3) | ||
102 | PPC_LL r23,14*SZL(r3) | ||
103 | PPC_LL r24,15*SZL(r3) | ||
104 | PPC_LL r25,16*SZL(r3) | ||
105 | PPC_LL r26,17*SZL(r3) | ||
106 | PPC_LL r27,18*SZL(r3) | ||
107 | PPC_LL r28,19*SZL(r3) | ||
108 | PPC_LL r29,20*SZL(r3) | ||
109 | PPC_LL r30,21*SZL(r3) | ||
110 | PPC_LL r31,22*SZL(r3) | ||
111 | PPC_LL r0,3*SZL(r3) | ||
112 | mtcrf 0x38,r0 | ||
113 | PPC_LL r0,0(r3) | ||
114 | PPC_LL r1,SZL(r3) | ||
115 | PPC_LL r2,2*SZL(r3) | ||
116 | mtlr r0 | ||
117 | mr r3,r4 | ||
118 | blr | ||