]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/context/src/asm/ontop_ppc64_sysv_xcoff_gas.S
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / context / src / asm / ontop_ppc64_sysv_xcoff_gas.S
CommitLineData
1e59de90
TL
1/*
2 Copyright Oliver Kowalke 2009.
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at
5 http://www.boost.org/LICENSE_1_0.txt)
6*/
7
8/*******************************************************
9 * *
10 * ------------------------------------------------- *
11 * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
12 * ------------------------------------------------- *
13 * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
14 * ------------------------------------------------- *
15 * | TOC | R14 | R15 | R16 | *
16 * ------------------------------------------------- *
17 * ------------------------------------------------- *
18 * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
19 * ------------------------------------------------- *
20 * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
21 * ------------------------------------------------- *
22 * | R17 | R18 | R19 | R20 | *
23 * ------------------------------------------------- *
24 * ------------------------------------------------- *
25 * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
26 * ------------------------------------------------- *
27 * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
28 * ------------------------------------------------- *
29 * | R21 | R22 | R23 | R24 | *
30 * ------------------------------------------------- *
31 * ------------------------------------------------- *
32 * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
33 * ------------------------------------------------- *
34 * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
35 * ------------------------------------------------- *
36 * | R25 | R26 | R27 | R28 | *
37 * ------------------------------------------------- *
38 * ------------------------------------------------- *
39 * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
40 * ------------------------------------------------- *
41 * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
42 * ------------------------------------------------- *
43 * | R29 | R30 | R31 | hidden | *
44 * ------------------------------------------------- *
45 * ------------------------------------------------- *
46 * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
47 * ------------------------------------------------- *
48 * | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
49 * ------------------------------------------------- *
50 * | CR | LR | PC | back-chain| *
51 * ------------------------------------------------- *
52 * ------------------------------------------------- *
53 * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
54 * ------------------------------------------------- *
55 * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
56 * ------------------------------------------------- *
57 * | cr saved | lr saved | compiler | linker | *
58 * ------------------------------------------------- *
59 * ------------------------------------------------- *
60 * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
61 * ------------------------------------------------- *
62 * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
63 * ------------------------------------------------- *
64 * | TOC saved | FCTX | DATA | | *
65 * ------------------------------------------------- *
66 * *
67 *******************************************************/
68
69 .file "ontop_ppc64_sysv_xcoff_gas.S"
70 .toc
71 .csect .text[PR], 5
72 .align 2
73 .globl ontop_fcontext[DS]
74 .globl .ontop_fcontext
75 .csect ontop_fcontext[DS], 3
76ontop_fcontext:
77 .llong .ontop_fcontext[PR], TOC[tc0], 0
78 .csect .text[PR], 5
b32b8144 79.ontop_fcontext:
7c673cae
FG
80 # reserve space on stack
81 subi 1, 1, 184
82
1e59de90 83 std 2, 0(1) # save TOC
7c673cae
FG
84 std 14, 8(1) # save R14
85 std 15, 16(1) # save R15
86 std 16, 24(1) # save R16
87 std 17, 32(1) # save R17
88 std 18, 40(1) # save R18
89 std 19, 48(1) # save R19
90 std 20, 56(1) # save R20
91 std 21, 64(1) # save R21
92 std 22, 72(1) # save R22
93 std 23, 80(1) # save R23
94 std 24, 88(1) # save R24
95 std 25, 96(1) # save R25
96 std 26, 104(1) # save R26
97 std 27, 112(1) # save R27
1e59de90 98 std 28, 120(1) # save R28
7c673cae
FG
99 std 29, 128(1) # save R29
100 std 30, 136(1) # save R30
101 std 31, 144(1) # save R31
102 std 3, 152(1) # save hidden
103
104 # save CR
105 mfcr 0
106 std 0, 160(1)
107 # save LR
108 mflr 0
109 std 0, 168(1)
110 # save LR as PC
111 std 0, 176(1)
112
113 # store RSP (pointing to context-data) in R7
114 mr 7, 1
115
116 # restore RSP (pointing to context-data) from R4
117 mr 1, 4
118
7c673cae
FG
119 ld 14, 8(1) # restore R14
120 ld 15, 16(1) # restore R15
121 ld 16, 24(1) # restore R16
122 ld 17, 32(1) # restore R17
123 ld 18, 40(1) # restore R18
124 ld 19, 48(1) # restore R19
125 ld 20, 56(1) # restore R20
126 ld 21, 64(1) # restore R21
127 ld 22, 72(1) # restore R22
128 ld 23, 80(1) # restore R23
129 ld 24, 88(1) # restore R24
130 ld 25, 96(1) # restore R25
131 ld 26, 104(1) # restore R26
132 ld 27, 112(1) # restore R27
133 ld 28, 120(1) # restore R28
134 ld 29, 128(1) # restore R29
135 ld 30, 136(1) # restore R30
136 ld 31, 144(1) # restore R31
1e59de90 137 ld 3, 152(1) # restore hidden
7c673cae
FG
138
139 # restore CR
140 ld 0, 160(1)
141 mtcr 0
1e59de90
TL
142
143 # copy transfer_t into ontop_fn arg registers
144 mr 4, 7
145 # arg pointer already in r5
146 # hidden arg already in r3
147
148 # restore CTR
149 ld 7, 0(6)
150 mtctr 7
151 # restore TOC
152 ld 2, 8(6)
153
154 # zero in r3 indicates first jump to context-function
155 cmpdi 3, 0
156 beq use_entry_arg
157
158return_to_ctx:
7c673cae
FG
159 # restore LR
160 ld 0, 168(1)
161 mtlr 0
7c673cae
FG
162
163 # adjust stack
164 addi 1, 1, 184
165
1e59de90
TL
166 # jump to context
167 bctr
168
169use_entry_arg:
170 # compute return-value struct address
171 # (passed has hidden arg to ontop_fn)
172 addi 3, 1, 8
173
174 # jump to context and update LR
175 bctrl
7c673cae
FG
176
177 # restore CTR
1e59de90
TL
178 ld 7, 176(1)
179 mtctr 7
180 # restore TOC
181 ld 2, 0(1)
7c673cae 182
1e59de90
TL
183 # copy returned transfer_t into entry_fn arg registers
184 ld 3, 8(1)
185 ld 4, 16(1)
186
187 b return_to_ctx