Mercurial > pub > dyncall > dyncall
comparison doc/disas_examples/ppc.darwin.disas @ 327:c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
author | Tassilo Philipp |
---|---|
date | Fri, 22 Nov 2019 23:08:59 +0100 |
parents | |
children | 74c056b597b7 |
comparison
equal
deleted
inserted
replaced
326:09aaa2e774cd | 327:c0390dc85a07 |
---|---|
1 ; #include <stdlib.h> | |
2 ; | |
3 ; void leaf_call(int b, int c, int d, int e, int f, int g, int h) | |
4 ; { | |
5 ; } | |
6 ; | |
7 ; void nonleaf_call(int a, int b, int c, int d, int e, int f, int g, int h) | |
8 ; { | |
9 ; /* use some local data */ | |
10 ; *(char*)alloca(220) = 'L'; | |
11 ; leaf_call(b, c, d, e, f, g, h); | |
12 ; } | |
13 ; | |
14 ; int main() | |
15 ; { | |
16 ; nonleaf_call(0, 1, 2, 3, 4, 5, 6, 7); | |
17 ; return 0; | |
18 ; } | |
19 | |
20 | |
21 | |
22 ; output from darwin-8.0.1-ppc w/ gcc 3.3 | |
23 | |
24 _leaf_call: | |
25 0: bf c1 ff f8 stmw 30, -8(1) | |
26 4: 94 21 ff d0 stwu 1, -48(1) | |
27 8: 7c 3e 0b 78 mr 30, 1 | |
28 c: 90 7e 00 48 stw 3, 72(30) | |
29 10: 90 9e 00 4c stw 4, 76(30) | |
30 14: 90 be 00 50 stw 5, 80(30) | |
31 18: 90 de 00 54 stw 6, 84(30) | |
32 1c: 90 fe 00 58 stw 7, 88(30) | |
33 20: 91 1e 00 5c stw 8, 92(30) | |
34 24: 91 3e 00 60 stw 9, 96(30) | |
35 28: 80 21 00 00 lwz 1, 0(1) | |
36 2c: bb c1 ff f8 lmw 30, -8(1) | |
37 30: 4e 80 00 20 blr | |
38 | |
39 _nonleaf_call: | |
40 34: 7c 08 02 a6 mflr 0 ; | lr -> gpr0 | |
41 38: bf c1 ff f8 stmw 30, -8(1) ; | store gpr{30,31} | |
42 3c: 90 01 00 08 stw 0, 8(1) ; | prolog store lr | |
43 40: 94 21 ff b0 stwu 1, -80(1) ; | open frame and store sp at top of stack | |
44 44: 7c 3e 0b 78 mr 30, 1 ; / sp -> gpr30, latter used for some fixed addressing below | |
45 48: 90 7e 00 68 stw 3, 104(30) ; \ | |
46 4c: 90 9e 00 6c stw 4, 108(30) ; | | |
47 50: 90 be 00 70 stw 5, 112(30) ; | | |
48 54: 90 de 00 74 stw 6, 116(30) ; | | |
49 58: 90 fe 00 78 stw 7, 120(30) ; | all in args -> spill area in prev frame | |
50 5c: 91 1e 00 7c stw 8, 124(30) ; | | |
51 60: 91 3e 00 80 stw 9, 128(30) ; | | |
52 64: 91 5e 00 84 stw 10, 132(30) ; | | |
53 68: 80 01 00 00 lwz 0, 0(1) ; fetch sp saved on stack of top by prolog -> gpr0, and ... | |
54 6c: 94 01 ff 10 stwu 0, -240(1) ; ... update it further up the stack for alloca(220) - with padding to guarantee alignment | |
55 70: 38 41 00 40 addi 2, 1, 64 ; | | |
56 74: 38 02 00 0f addi 0, 2, 15 ; | start of alloca()'d memory -> gpr2, by ... | |
57 78: 54 00 e1 3e srwi 0, 0, 4 ; | ... using gpr0 as helper to align to 16b, leaving at least 64b at top of stack | |
58 7c: 54 02 20 36 slwi 2, 0, 4 ; | | |
59 80: 38 00 00 4c li 0, 76 ; 'L' -> gpr0, and ... | |
60 84: 98 02 00 00 stb 0, 0(2) ; ... store in local area (of alloca()'d space) | |
61 88: 80 7e 00 6c lwz 3, 108(30) ; | | |
62 8c: 80 9e 00 70 lwz 4, 112(30) ; | | |
63 90: 80 be 00 74 lwz 5, 116(30) ; | | |
64 94: 80 de 00 78 lwz 6, 120(30) ; | arg 0,1,2,3,4,5,6 (fetched from spill area from prev frame) | |
65 98: 80 fe 00 7c lwz 7, 124(30) ; | | |
66 9c: 81 1e 00 80 lwz 8, 128(30) ; | | |
67 a0: 81 3e 00 84 lwz 9, 132(30) ; | | |
68 a4: 4b ff ff 5d bl .+67108700 ; call and put return address -> lr | |
69 a8: 80 21 00 00 lwz 1, 0(1) ; | | |
70 ac: 80 01 00 08 lwz 0, 8(1) ; | | |
71 b0: 7c 08 03 a6 mtlr 0 ; | epilog | |
72 b4: bb c1 ff f8 lmw 30, -8(1) ; | | |
73 b8: 4e 80 00 20 blr ; | | |
74 | |
75 _main: | |
76 bc: 7c 08 02 a6 mflr 0 ; | | |
77 c0: bf c1 ff f8 stmw 30, -8(1) ; | | |
78 c4: 90 01 00 08 stw 0, 8(1) ; | prolog | |
79 c8: 94 21 ff b0 stwu 1, -80(1) ; | | |
80 cc: 7c 3e 0b 78 mr 30, 1 ; | | |
81 d0: 38 60 00 00 li 3, 0 ; arg 0 | |
82 d4: 38 80 00 01 li 4, 1 ; arg 1 | |
83 d8: 38 a0 00 02 li 5, 2 ; arg 2 | |
84 dc: 38 c0 00 03 li 6, 3 ; arg 3 | |
85 e0: 38 e0 00 04 li 7, 4 ; arg 4 | |
86 e4: 39 00 00 05 li 8, 5 ; arg 5 | |
87 e8: 39 20 00 06 li 9, 6 ; arg 6 | |
88 ec: 39 40 00 07 li 10, 7 ; arg 7 | |
89 f0: 4b ff ff 45 bl .+67108676 ; call and put return address -> lr | |
90 f4: 38 00 00 00 li 0, 0 ; return value (pointlessly) via gpr0 ... | |
91 f8: 7c 03 03 78 mr 3, 0 ; ... to gpr3 | |
92 fc: 80 21 00 00 lwz 1, 0(1) ; | | |
93 100: 80 01 00 08 lwz 0, 8(1) ; | | |
94 104: 7c 08 03 a6 mtlr 0 ; | epilog | |
95 108: bb c1 ff f8 lmw 30, -8(1) ; | | |
96 10c: 4e 80 00 20 blr ; | | |
97 | |
98 | |
99 | |
100 ; ------------- more than 8 int args -----------> | |
101 | |
102 ; #include <stdlib.h> | |
103 ; | |
104 ; void leaf_call(int b, int c, int d, int e, int f, int g, int h, int i, int j) | |
105 ; { | |
106 ; } | |
107 ; | |
108 ; void nonleaf_call(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j) | |
109 ; { | |
110 ; /* use some local data */ | |
111 ; *(char*)alloca(220) = 'L'; | |
112 ; leaf_call(b, c, d, e, f, g, h, i, j); | |
113 ; } | |
114 ; | |
115 ; int main() | |
116 ; { | |
117 ; nonleaf_call(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); | |
118 ; return 0; | |
119 ; } | |
120 | |
121 | |
122 | |
123 ; output from darwin-8.0.1-ppc w/ gcc 3.3 | |
124 | |
125 _leaf_call: | |
126 0: bf c1 ff f8 stmw 30, -8(1) | |
127 4: 94 21 ff d0 stwu 1, -48(1) | |
128 8: 7c 3e 0b 78 mr 30, 1 | |
129 c: 90 7e 00 48 stw 3, 72(30) | |
130 10: 90 9e 00 4c stw 4, 76(30) | |
131 14: 90 be 00 50 stw 5, 80(30) | |
132 18: 90 de 00 54 stw 6, 84(30) | |
133 1c: 90 fe 00 58 stw 7, 88(30) | |
134 20: 91 1e 00 5c stw 8, 92(30) | |
135 24: 91 3e 00 60 stw 9, 96(30) | |
136 28: 91 5e 00 64 stw 10, 100(30) | |
137 2c: 80 21 00 00 lwz 1, 0(1) | |
138 30: bb c1 ff f8 lmw 30, -8(1) | |
139 34: 4e 80 00 20 blr | |
140 | |
141 _nonleaf_call: | |
142 38: 7c 08 02 a6 mflr 0 ; | | |
143 3c: bf c1 ff f8 stmw 30, -8(1) ; | | |
144 40: 90 01 00 08 stw 0, 8(1) ; | prolog | |
145 44: 94 21 ff a0 stwu 1, -96(1) ; | | |
146 48: 7c 3e 0b 78 mr 30, 1 ; / | |
147 4c: 90 7e 00 78 stw 3, 120(30) ; \ | |
148 50: 90 9e 00 7c stw 4, 124(30) ; | | |
149 54: 90 be 00 80 stw 5, 128(30) ; | | |
150 58: 90 de 00 84 stw 6, 132(30) ; | | |
151 5c: 90 fe 00 88 stw 7, 136(30) ; | in args 0,1,2,3,4,5,6,7 -> spill area in prev frame | |
152 60: 91 1e 00 8c stw 8, 140(30) ; | | |
153 64: 91 3e 00 90 stw 9, 144(30) ; | | |
154 68: 91 5e 00 94 stw 10, 148(30) ; | | |
155 6c: 80 01 00 00 lwz 0, 0(1) ; fetch sp saved on stack of top by prolog -> gpr0, and ... | |
156 70: 94 01 ff 10 stwu 0, -240(1) ; ... update it further up the stack for alloca(220) - with padding to guarantee alignment | |
157 74: 38 41 00 50 addi 2, 1, 80 ; | | |
158 78: 38 02 00 0f addi 0, 2, 15 ; | start of alloca()'d memory -> gpr2, by ... | |
159 7c: 54 00 e1 3e srwi 0, 0, 4 ; | ... using gpr0 as helper to align to 16b, leaving at least 64b at top of stack | |
160 80: 54 02 20 36 slwi 2, 0, 4 ; | | |
161 84: 38 00 00 4c li 0, 76 ; 'L' -> gpr0, and ... | |
162 88: 98 02 00 00 stb 0, 0(2) ; ... store in local area (of alloca()'d space) | |
163 8c: 80 1e 00 9c lwz 0, 156(30) ; arg 7 (fetched from stack param area from prev frame), and ... | |
164 90: 90 01 00 38 stw 0, 56(1) ; ... "pushed" onto stack | |
165 94: 80 7e 00 7c lwz 3, 124(30) ; | | |
166 98: 80 9e 00 80 lwz 4, 128(30) ; | | |
167 9c: 80 be 00 84 lwz 5, 132(30) ; | | |
168 a0: 80 de 00 88 lwz 6, 136(30) ; | arg 0,1,2,3,4,5,6 (fetched from spill area from prev frame) | |
169 a4: 80 fe 00 8c lwz 7, 140(30) ; | | |
170 a8: 81 1e 00 90 lwz 8, 144(30) ; | | |
171 ac: 81 3e 00 94 lwz 9, 148(30) ; | | |
172 b0: 81 5e 00 98 lwz 10, 152(30) ; arg 7 (fetched from stack param area from prev frame) | |
173 b4: 4b ff ff 4d bl .+67108684 ; call and put return address -> lr | |
174 b8: 80 21 00 00 lwz 1, 0(1) ; | | |
175 bc: 80 01 00 08 lwz 0, 8(1) ; | | |
176 c0: 7c 08 03 a6 mtlr 0 ; | epilog | |
177 c4: bb c1 ff f8 lmw 30, -8(1) ; | | |
178 c8: 4e 80 00 20 blr ; | | |
179 | |
180 _main: | |
181 cc: 7c 08 02 a6 mflr 0 ; | | |
182 d0: bf c1 ff f8 stmw 30, -8(1) ; | | |
183 d4: 90 01 00 08 stw 0, 8(1) ; | prolog | |
184 d8: 94 21 ff a0 stwu 1, -96(1) ; | | |
185 dc: 7c 3e 0b 78 mr 30, 1 ; | | |
186 e0: 38 00 00 08 li 0, 8 ; arg 8, ... | |
187 e4: 90 01 00 38 stw 0, 56(1) ; ... "pushed" onto stack | |
188 e8: 38 00 00 09 li 0, 9 ; arg 9, ... | |
189 ec: 90 01 00 3c stw 0, 60(1) ; ... "pushed" onto stack | |
190 f0: 38 60 00 00 li 3, 0 ; arg 0 | |
191 f4: 38 80 00 01 li 4, 1 ; arg 1 | |
192 f8: 38 a0 00 02 li 5, 2 ; arg 2 | |
193 fc: 38 c0 00 03 li 6, 3 ; arg 3 | |
194 100: 38 e0 00 04 li 7, 4 ; arg 4 | |
195 104: 39 00 00 05 li 8, 5 ; arg 5 | |
196 108: 39 20 00 06 li 9, 6 ; arg 6 | |
197 10c: 39 40 00 07 li 10, 7 ; arg 7 | |
198 110: 4b ff ff 29 bl .+67108648 ; call and put return address -> lr | |
199 114: 38 00 00 00 li 0, 0 ; return value (pointlessly) via gpr0 ... | |
200 118: 7c 03 03 78 mr 3, 0 ; ... to gpr3 | |
201 11c: 80 21 00 00 lwz 1, 0(1) ; | | |
202 120: 80 01 00 08 lwz 0, 8(1) ; | | |
203 124: 7c 08 03 a6 mtlr 0 ; | epilog | |
204 128: bb c1 ff f8 lmw 30, -8(1) ; | | |
205 12c: 4e 80 00 20 blr ; | | |
206 | |
207 | |
208 | |
209 ; ------------- var args with ints and floats to see spilling (which remains only int regs), b/c doubles are passed via them and floats are promoted to doubles in (...) -----------> | |
210 | |
211 ; #include <stdlib.h> | |
212 ; #include <stdarg.h> | |
213 ; | |
214 ; void leaf_call(int b, int c, int d, int e, float f, float g, int h, int i, float j) | |
215 ; { | |
216 ; } | |
217 ; | |
218 ; void nonleaf_call(int a, ...) | |
219 ; { | |
220 ; int b, c, d, e, h, i; | |
221 ; float f, g, j; | |
222 ; va_list ap; | |
223 ; va_start(ap, a); | |
224 ; b = va_arg(ap, int); | |
225 ; c = va_arg(ap, int); | |
226 ; d = va_arg(ap, int); | |
227 ; e = va_arg(ap, int); | |
228 ; f = (float)va_arg(ap, double); | |
229 ; g = (float)va_arg(ap, double); | |
230 ; h = va_arg(ap, int); | |
231 ; i = va_arg(ap, int); | |
232 ; j = (float)va_arg(ap, double); | |
233 ; /* use some local data */ | |
234 ; *(char*)alloca(220) = 'L'; | |
235 ; leaf_call(b, c, d, e, f, g, h, i, j); | |
236 ; } | |
237 ; | |
238 ; int main() | |
239 ; { | |
240 ; nonleaf_call(0, 1, 2, 3, 4, 5.f, 6.f, 7, 8, 9.f); | |
241 ; return 0; | |
242 ; } | |
243 | |
244 | |
245 | |
246 ; output from darwin-8.0.1-ppc w/ gcc 3.3 | |
247 | |
248 _leaf_call: | |
249 0: bf c1 ff f8 stmw 30, -8(1) | |
250 4: 94 21 ff d0 stwu 1, -48(1) | |
251 8: 7c 3e 0b 78 mr 30, 1 | |
252 c: 90 7e 00 48 stw 3, 72(30) | |
253 10: 90 9e 00 4c stw 4, 76(30) | |
254 14: 90 be 00 50 stw 5, 80(30) | |
255 18: 90 de 00 54 stw 6, 84(30) | |
256 1c: d0 3e 00 58 stfs 1, 88(30) | |
257 20: d0 5e 00 5c stfs 2, 92(30) | |
258 24: 91 3e 00 60 stw 9, 96(30) | |
259 28: 91 5e 00 64 stw 10, 100(30) | |
260 2c: d0 7e 00 68 stfs 3, 104(30) | |
261 30: 80 21 00 00 lwz 1, 0(1) | |
262 34: bb c1 ff f8 lmw 30, -8(1) | |
263 38: 4e 80 00 20 blr | |
264 | |
265 _nonleaf_call: | |
266 3c: 7c 08 02 a6 mflr 0 ; | | |
267 40: bf c1 ff f8 stmw 30, -8(1) ; | | |
268 44: 90 01 00 08 stw 0, 8(1) ; | prolog | |
269 48: 94 21 ff 70 stwu 1, -144(1) ; | | |
270 4c: 7c 3e 0b 78 mr 30, 1 ; / | |
271 50: 90 9e 00 ac stw 4, 172(30) ; \ | |
272 54: 90 be 00 b0 stw 5, 176(30) ; | | |
273 58: 90 de 00 b4 stw 6, 180(30) ; | | |
274 5c: 90 fe 00 b8 stw 7, 184(30) ; | | |
275 60: 91 1e 00 bc stw 8, 188(30) ; | in args ,1,2,3,4,5,6,7 -> spill area in prev frame | |
276 64: 91 3e 00 c0 stw 9, 192(30) ; | | |
277 68: 91 5e 00 c4 stw 10, 196(30) ; | | |
278 6c: 90 7e 00 a8 stw 3, 168(30) ; | <- this is in arg 0, the only named arg | |
279 70: 38 1e 00 ac addi 0, 30, 172 ; get pointer to first unnamed arg in gpr0 for vararg iteration, ... | |
280 74: 90 1e 00 74 stw 0, 116(30) ; ... and store read ptr in local area | |
281 78: 81 3e 00 74 lwz 9, 116(30) ; \ read ptr -> gpr0 | |
282 7c: 80 5e 00 74 lwz 2, 116(30) ; | use gpr2 as helper ... | |
283 80: 38 02 00 04 addi 0, 2, 4 ; | ... to increment read ptr ... | |
284 84: 90 1e 00 74 stw 0, 116(30) ; | in arg 1 ... and restore | |
285 88: 80 09 00 00 lwz 0, 0(9) ; | load in arg 1, and ... | |
286 8c: 90 1e 00 50 stw 0, 80(30) ; / ... store in temp space in local area | |
287 90: 81 3e 00 74 lwz 9, 116(30) ; \ | |
288 94: 80 5e 00 74 lwz 2, 116(30) ; | | |
289 98: 38 02 00 04 addi 0, 2, 4 ; | | |
290 9c: 90 1e 00 74 stw 0, 116(30) ; | in arg 2 | |
291 a0: 80 09 00 00 lwz 0, 0(9) ; | | |
292 a4: 90 1e 00 54 stw 0, 84(30) ; / | |
293 a8: 81 3e 00 74 lwz 9, 116(30) ; \ | |
294 ac: 80 5e 00 74 lwz 2, 116(30) ; | | |
295 b0: 38 02 00 04 addi 0, 2, 4 ; | | |
296 b4: 90 1e 00 74 stw 0, 116(30) ; | in arg 3 | |
297 b8: 80 09 00 00 lwz 0, 0(9) ; | | |
298 bc: 90 1e 00 58 stw 0, 88(30) ; / | |
299 c0: 81 3e 00 74 lwz 9, 116(30) ; \ | |
300 c4: 80 5e 00 74 lwz 2, 116(30) ; | | |
301 c8: 38 02 00 04 addi 0, 2, 4 ; | | |
302 cc: 90 1e 00 74 stw 0, 116(30) ; | in arg 4 | |
303 d0: 80 09 00 00 lwz 0, 0(9) ; | | |
304 d4: 90 1e 00 5c stw 0, 92(30) ; / | |
305 d8: 81 3e 00 74 lwz 9, 116(30) ; \ | |
306 dc: 80 5e 00 74 lwz 2, 116(30) ; | | |
307 e0: 38 02 00 08 addi 0, 2, 8 ; | | |
308 e4: 90 1e 00 74 stw 0, 116(30) ; | in arg 5 (float, promoted to double) | |
309 e8: c8 09 00 00 lfd 0, 0(9) ; | | |
310 ec: fc 00 00 18 frsp 0, 0 ; | | |
311 f0: d0 1e 00 68 stfs 0, 104(30) ; / | |
312 f4: 81 3e 00 74 lwz 9, 116(30) ; \ | |
313 f8: 80 5e 00 74 lwz 2, 116(30) ; | | |
314 fc: 38 02 00 08 addi 0, 2, 8 ; | | |
315 100: 90 1e 00 74 stw 0, 116(30) ; | in arg 6 (float, promoted to double) | |
316 104: c8 09 00 00 lfd 0, 0(9) ; | | |
317 108: fc 00 00 18 frsp 0, 0 ; | | |
318 10c: d0 1e 00 6c stfs 0, 108(30) ; / | |
319 110: 81 3e 00 74 lwz 9, 116(30) ; \ | |
320 114: 80 5e 00 74 lwz 2, 116(30) ; | | |
321 118: 38 02 00 04 addi 0, 2, 4 ; | | |
322 11c: 90 1e 00 74 stw 0, 116(30) ; | in arg 7 | |
323 120: 80 09 00 00 lwz 0, 0(9) ; | | |
324 124: 90 1e 00 60 stw 0, 96(30) ; / | |
325 128: 81 3e 00 74 lwz 9, 116(30) ; \ | |
326 12c: 80 5e 00 74 lwz 2, 116(30) ; | | |
327 130: 38 02 00 04 addi 0, 2, 4 ; | | |
328 134: 90 1e 00 74 stw 0, 116(30) ; | in arg 8 | |
329 138: 80 09 00 00 lwz 0, 0(9) ; | | |
330 13c: 90 1e 00 64 stw 0, 100(30) ; / | |
331 140: 81 3e 00 74 lwz 9, 116(30) ; \ | |
332 144: 80 5e 00 74 lwz 2, 116(30) ; | | |
333 148: 38 02 00 08 addi 0, 2, 8 ; | | |
334 14c: 90 1e 00 74 stw 0, 116(30) ; | in arg 9 (float, promoted to double) | |
335 150: c8 09 00 00 lfd 0, 0(9) ; | | |
336 154: fc 00 00 18 frsp 0, 0 ; | | |
337 158: d0 1e 00 70 stfs 0, 112(30) ; / | |
338 15c: 80 01 00 00 lwz 0, 0(1) ; fetch sp saved on stack of top by prolog -> g | |
339 160: 94 01 ff 10 stwu 0, -240(1) ; ... update it further up the stack for alloca | |
340 164: 38 41 00 50 addi 2, 1, 80 ; | | |
341 168: 38 02 00 0f addi 0, 2, 15 ; | start of alloca()'d memory -> gpr2, by ... | |
342 16c: 54 00 e1 3e srwi 0, 0, 4 ; | ... using gpr0 as helper to align to 16b, l | |
343 170: 54 02 20 36 slwi 2, 0, 4 ; | | |
344 174: 38 00 00 4c li 0, 76 ; 'L' -> gpr0, and ... | |
345 178: 98 02 00 00 stb 0, 0(2) ; ... store in local area (of alloca()'d space) | |
346 17c: 80 7e 00 50 lwz 3, 80(30) ; arg 0 | |
347 180: 80 9e 00 54 lwz 4, 84(30) ; arg 1 | |
348 184: 80 be 00 58 lwz 5, 88(30) ; arg 2 | |
349 188: 80 de 00 5c lwz 6, 92(30) ; arg 3 | |
350 18c: c0 3e 00 68 lfs 1, 104(30) ; arg 4 (float) | |
351 190: c0 5e 00 6c lfs 2, 108(30) ; arg 5 (float) | |
352 194: 81 3e 00 60 lwz 9, 96(30) ; arg 6 | |
353 198: 81 5e 00 64 lwz 10, 100(30) ; arg 7 | |
354 19c: c0 7e 00 70 lfs 3, 112(30) ; arg 8 (float) | |
355 1a0: 4b ff fe 61 bl .+67108448 ; call and put return address -> lr | |
356 1a4: 80 21 00 00 lwz 1, 0(1) ; | | |
357 1a8: 80 01 00 08 lwz 0, 8(1) ; | | |
358 1ac: 7c 08 03 a6 mtlr 0 ; | epilog | |
359 1b0: bb c1 ff f8 lmw 30, -8(1) ; | | |
360 1b4: 4e 80 00 20 blr ; | | |
361 | |
362 _main: | |
363 1b8: 7c 08 02 a6 mflr 0 ; | | |
364 1bc: bf c1 ff f8 stmw 30, -8(1) ; | | |
365 1c0: 90 01 00 08 stw 0, 8(1) ; | prolog | |
366 1c4: 94 21 ff 90 stwu 1, -112(1) ; | | |
367 1c8: 7c 3e 0b 78 mr 30, 1 ; | | |
368 1cc: 42 9f 00 05 bcl 20, 31, .+4 ; ppc way to get PC in ... | |
369 1d0: 7f e8 02 a6 mflr 31 ; ... gpr31 | |
370 1d4: 38 00 00 07 li 0, 7 ; arg 7, ... | |
371 1d8: 90 01 00 3c stw 0, 60(1) ; ... "pushed" onto stack | |
372 1dc: 38 00 00 08 li 0, 8 ; arg 8, ... | |
373 1e0: 90 01 00 40 stw 0, 64(1) ; ... "pushed" onto stack | |
374 1e4: 3c 40 40 22 lis 2, 16418 ; | arg 9, top-half (double b/c of vararg), and ... | |
375 1e8: 38 60 00 00 li 3, 0 ; | ... bottom-half ... | |
376 1ec: 90 41 00 44 stw 2, 68(1) ; | ... "pushed" into stack | |
377 1f0: 90 61 00 48 stw 3, 72(1) ; | " | |
378 1f4: 38 00 00 00 li 0, 0 ; arg 6, bottom-half, ... | |
379 1f8: 90 01 00 38 stw 0, 56(1) ; ... "pushed" onto stack (first word in param area, top-half passed via gpr10, see below) | |
380 1fc: 38 60 00 00 li 3, 0 ; arg 0 | |
381 200: 38 80 00 01 li 4, 1 ; arg 1 | |
382 204: 38 a0 00 02 li 5, 2 ; arg 2 | |
383 208: 38 c0 00 03 li 6, 3 ; arg 3 | |
384 20c: 38 e0 00 04 li 7, 4 ; arg 4 | |
385 210: 3d 20 40 14 lis 9, 16404 ; | prep arg 5 (double b/c of vararg) for move to arg reg later: top-half -> gpr9 | |
386 214: 39 40 00 00 li 10, 0 ; | bottom-half -> gpr10 | |
387 218: 3c 5f 00 00 addis 2, 31, 0 ; PC -> gpr2, to ... | |
388 21c: c8 02 00 98 lfd 0, 152(2) ; ... load some static data (arg 5, the float) stored right after this function -> gpr0 | |
389 220: 7d 28 4b 78 mr 8, 9 ; arg 5, top-half | |
390 224: 7d 49 53 78 mr 9, 10 ; arg 5, bottom-half | |
391 228: fc 20 00 90 fmr 1, 0 ; arg 5 in 1st fp reg | |
392 22c: 3d 60 40 18 lis 11, 16408 ; | prep arg 6 (double b/c of vararg) for move to arg reg later: top-half -> gpr11 | |
393 230: 39 80 00 00 li 12, 0 ; | bottom-half -> gpr12 (this one is pointless, unused, bottom-half already placed on stack) | |
394 234: 3c 5f 00 00 addis 2, 31, 0 ; PC -> gpr2, to ... | |
395 238: c8 02 00 a0 lfd 0, 160(2) ; ... load some static data (arg 6, the 2nd float) stored right after this function -> gpr0 | |
396 23c: 7d 6a 5b 78 mr 10, 11 ; arg 6, top-half | |
397 240: fc 40 00 90 fmr 2, 0 ; arg 5 in 2nd fp reg | |
398 244: c8 01 00 44 lfd 0, 68(1) ; arg 9, ... | |
399 248: fc 60 00 90 fmr 3, 0 ; ... -> 3rd fp reg | |
400 24c: 4b ff fd f1 bl .+67108336 ; call and put return address -> lr | |
401 250: 7c 03 03 78 mr 3, 0 ; return value @@@unsure why gpr0 is guaranteed to be 0 here | |
402 254: 80 21 00 00 lwz 1, 0(1) ; | | |
403 258: 80 01 00 08 lwz 0, 8(1) ; | | |
404 25c: 7c 08 03 a6 mtlr 0 ; | epilog | |
405 260: bb c1 ff f8 lmw 30, -8(1) ; | | |
406 264: 4e 80 00 20 blr ; | | |
407 | |
408 ; vim: ft=asm | |
409 |