only bring in as many sdl things as are strictly necessary
[tangerine.git] / arch / ppc-sam440 / exec / stackswap.S
blob491b6c86ce604c7bdfe96a0bbb66db2cb9b28e48
1 #include <aros/ppc/asm.h>
2 #include <aros/config.h>
4                 .text
5                 .align 4
6                 .globl AROS_SLIB_ENTRY(StackSwap, Exec)
7                 .type AROS_SLIB_ENTRY(StackSwap, Exec), @function 
9 #define SysBase %r30
10 #define SSS     %r29
12 AROS_SLIB_ENTRY(StackSwap, Exec):
13                 stwu %r1, -32(%r1)
14                 
15                 stw %r3,8(%r1)
16                 stw %r4,12(%r1)
17                 stw %r30,16(%r1)
18                 stw %r29,20(%r1)
19                 stw %r28,24(%r1)
20                 
21                 mr  SSS,%r3
22                 mr  SysBase,%r4
23                 
24                 mflr %r28
25                 
26                 lwz %r11,Disable(SysBase)
27                 mtctr %r11
28                 mr %r3, SysBase
29                 bctrl
30                 
31                 lwz %r3,ThisTask(SysBase)
32                 
33                 lwz %r4,tc_SPLower(%r3)
34                 lwz %r5,stk_Lower(SSS)
35                 stw %r4,stk_Lower(SSS)
36                 stw %r5,tc_SPLower(%r3)
37                 
38                 lwz %r4,tc_SPUpper(%r3)
39                 lwz %r5,stk_Upper(SSS)
40                 stw %r4,stk_Upper(SSS)
41                 stw %r5,tc_SPUpper(%r3)
43                 lwz %r4,stk_Pointer(SSS)
44                 addi %r11,%r1,32
45                 stw %r11,stk_Pointer(SSS)
46                 mr %r1,%r4
48                 lwz %r11,Enable(SysBase)
49                 mtctr %r11
50                 mr %r3,SysBase
51                 bctrl
53                 lwz %r3,stk_Pointer(SSS)
55                 lwz %r30,16-32(%r3)
56                 lwz %r29,20-32(%r3)
58                 mtlr %r28
59                 lwz %r28,24-32(%r3)
60                 
61                 blr