1 /*-------------------------------------------------------------
3 decrementer_handler.S -- PPC decrementer exception support
6 Michael Wiedenbauer (shagkur)
7 Dave Murphy (WinterMute)
9 This software is provided 'as-is', without any express or implied
10 warranty. In no event will the authors be held liable for any
11 damages arising from the use of this software.
13 Permission is granted to anyone to use this software for any
14 purpose, including commercial applications, and to alter it and
15 redistribute it freely, subject to the following restrictions:
17 1. The origin of this software must not be misrepresented; you
18 must not claim that you wrote the original software. If you use
19 this software in a product, an acknowledgment in the product
20 documentation would be appreciated but is not required.
22 2. Altered source versions must be plainly marked as such, and
23 must not be misrepresented as being the original software.
25 3. This notice may not be removed or altered from any source
29 -------------------------------------------------------------*/
34 #define EXCEPTION_PROLOG \
36 stw r0,GQR0_OFFSET(sp); \
38 stw r0,GQR1_OFFSET(sp); \
40 stw r0,GQR2_OFFSET(sp); \
42 stw r0,GQR3_OFFSET(sp); \
44 stw r0,GQR4_OFFSET(sp); \
46 stw r0,GQR5_OFFSET(sp); \
48 stw r0,GQR6_OFFSET(sp); \
50 stw r0,GQR7_OFFSET(sp); \
51 stw r6,GPR6_OFFSET(sp); \
52 stw r7,GPR7_OFFSET(sp); \
53 stw r8,GPR8_OFFSET(sp); \
54 stw r9,GPR9_OFFSET(sp); \
55 stw r10,GPR10_OFFSET(sp); \
56 stw r11,GPR11_OFFSET(sp); \
57 stw r12,GPR12_OFFSET(sp); \
58 stw r13,GPR13_OFFSET(sp); \
59 stw r14,GPR14_OFFSET(sp); \
60 stw r15,GPR15_OFFSET(sp)
62 #define EXCEPTION_EPILOG \
63 lwz r4,GQR0_OFFSET(sp); \
65 lwz r4,GQR1_OFFSET(sp); \
67 lwz r4,GQR2_OFFSET(sp); \
69 lwz r4,GQR3_OFFSET(sp); \
71 lwz r4,GQR4_OFFSET(sp); \
73 lwz r4,GQR5_OFFSET(sp); \
75 lwz r4,GQR6_OFFSET(sp); \
77 lwz r4,GQR7_OFFSET(sp); \
79 lwz r15,GPR15_OFFSET(sp); \
80 lwz r14,GPR14_OFFSET(sp); \
81 lwz r13,GPR13_OFFSET(sp); \
82 lwz r12,GPR12_OFFSET(sp); \
83 lwz r11,GPR11_OFFSET(sp); \
84 lwz r10,GPR10_OFFSET(sp); \
85 lwz r9,GPR9_OFFSET(sp); \
86 lwz r8,GPR8_OFFSET(sp); \
87 lwz r7,GPR7_OFFSET(sp); \
88 lwz r6,GPR6_OFFSET(sp); \
89 lwz r5,GPR5_OFFSET(sp)
91 .extern c_decrementer_handler
92 .globl dec_exceptionhandler
94 stwu sp,-EXCEPTION_FRAME_END(sp) //now we're able to adjust the stackpointer with it's cached address
104 lis r15,_thread_dispatch_disable_level@ha
113 lwz r6,_thread_dispatch_disable_level@l(r15)
116 stw r6,_thread_dispatch_disable_level@l(r15)
119 bl c_decrementer_handler
122 lwz r3,_thread_dispatch_disable_level@l(r15)
126 stw r3,_thread_dispatch_disable_level@l(r15)
130 lis r4,_context_switch_want@ha
131 lwz r5,_context_switch_want@l(r4)
143 lwz r4,CTR_OFFSET(sp)
145 lwz r4,XER_OFFSET(sp)
156 lwz r0,GPR0_OFFSET(sp)
157 lwz toc,GPR2_OFFSET(sp)
159 lwz r4,SRR0_OFFSET(sp)
161 lwz r4,SRR1_OFFSET(sp)
165 lwz r4,GPR4_OFFSET(sp)
166 lwz r3,GPR3_OFFSET(sp)
167 addi sp,sp,EXCEPTION_FRAME_END