prism2.device: Compiler delint
[AROS.git] / arch / .unmaintained / dummy / stackswap.c
blob4eea3b64db61dfb9a3b8bd397531a5ace10dfa1b
1 |*****************************************************************************
3 | NAME
5 | __AROS_LH1(void, StackSwap,
7 | SYNOPSIS
8 | __AROS_LA(struct StackSwapStruct *, newStack, A0),
10 | LOCATION
11 | struct ExecBase *, SysBase, 122, Exec)
13 | FUNCTION
14 | This function switches to the new stack given by the parameters in the
15 | stackswapstruct structure. The old stack parameters are returned in
16 | the same structure so that the stack can be restored later
18 | INPUTS
19 | newStack - parameters for the new stack
21 | RESULT
23 | NOTES
25 | EXAMPLE
27 | BUGS
29 | SEE ALSO
31 | INTERNALS
33 | HISTORY
35 |******************************************************************************
37 Disable = -0x78
38 Enable = -0x7e
39 ThisTask = 0x114
40 tc_SPLower = 0x3a
42 .globl _Exec_StackSwap
43 _Exec_StackSwap:
44 | Preserve returnaddress and fix sp
45 movel sp@+,d0
47 | Get pointer to tc_SPLower in a1 (tc_SPUpper is next)
48 movel a6@(ThisTask),a1
49 leal a1@(tc_SPLower),a1
51 | Just to be sure interrupts always find a good stackframe
52 jsr a6@(Disable)
54 | Swap Lower boundaries
55 movel a1@,d1
56 movel a0@,a1@+
57 movel d1,a0@+
59 | Swap higher boundaries
60 movel a1@,d1
61 movel a0@,a1@
62 movel d1,a0@+
64 | Swap stackpointers
65 movel sp,d1
66 movel a0@,sp
67 movel d1,a0@
69 | Reenable interrupts.
70 jsr a6@(Enable)
72 | Restore returnaddress and return
73 movel d1,sp@-
74 rts