Mercurial > pub > dyncall > dyncall
comparison doc/disas_examples/mips64.n64.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 | 75c19f11b86a |
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 freebsd-12.0_r333647-malta_mips64elhf w/ gcc 4.2.1 | |
23 | |
24 0000000000000000 <leaf_call>: | |
25 0: 67bdffd0 daddiu sp,sp,-48 | |
26 4: ffbe0028 sd s8,40(sp) | |
27 8: ffbc0020 sd gp,32(sp) | |
28 c: 03a0f02d move s8,sp | |
29 10: 3c1c0000 lui gp,0x0 | |
30 14: 0399e02d daddu gp,gp,t9 | |
31 18: 679c0000 daddiu gp,gp,0 | |
32 1c: 0080102d move v0,a0 | |
33 20: 00a0182d move v1,a1 | |
34 24: 00c0202d move a0,a2 | |
35 28: 00e0282d move a1,a3 | |
36 2c: 0100302d move a2,a4 | |
37 30: 0120382d move a3,a5 | |
38 34: 0140402d move a4,a6 | |
39 38: 00021000 sll v0,v0,0x0 | |
40 3c: afc20000 sw v0,0(s8) | |
41 40: 00031000 sll v0,v1,0x0 | |
42 44: afc20004 sw v0,4(s8) | |
43 48: 00041000 sll v0,a0,0x0 | |
44 4c: afc20008 sw v0,8(s8) | |
45 50: 00051000 sll v0,a1,0x0 | |
46 54: afc2000c sw v0,12(s8) | |
47 58: 00061000 sll v0,a2,0x0 | |
48 5c: afc20010 sw v0,16(s8) | |
49 60: 00071000 sll v0,a3,0x0 | |
50 64: afc20014 sw v0,20(s8) | |
51 68: 00081000 sll v0,a4,0x0 | |
52 6c: afc20018 sw v0,24(s8) | |
53 70: 03c0e82d move sp,s8 | |
54 74: dfbe0028 ld s8,40(sp) | |
55 78: dfbc0020 ld gp,32(sp) | |
56 7c: 03e00008 jr ra | |
57 80: 67bd0030 daddiu sp,sp,48 | |
58 84: 00000000 nop | |
59 | |
60 0000000000000088 <nonleaf_call>: | |
61 88: 67bdff90 daddiu sp,sp,-112 ; | | |
62 8c: ffbf0060 sd ra,96(sp) ; | | |
63 90: ffbe0058 sd s8,88(sp) ; | prolog | |
64 94: ffbc0050 sd gp,80(sp) ; | | |
65 98: 03a0f02d move s8,sp ; | | |
66 9c: 3c1c0000 lui gp,0x0 ; @@@ unsure | |
67 a0: 0399e02d daddu gp,gp,t9 ; @@@ unsure | |
68 a4: 679c0000 daddiu gp,gp,0 ; @@@ unsure | |
69 a8: 0080102d move v0,a0 ; | | |
70 ac: 00a0182d move v1,a1 ; | | |
71 b0: 00c0202d move a0,a2 ; | pointlessly (?) moving a{0,1} to v{0,1} respectively, | |
72 b4: 00e0282d move a1,a3 ; | and all last 6 a? registers two regs down, freeing up | |
73 b8: 0100302d move a2,a4 ; | a{6,7}, which aren't used for anything though | |
74 bc: 0120382d move a3,a5 ; | | |
75 c0: 0140402d move a4,a6 ; | | |
76 c4: 0160482d move a5,a7 ; / | |
77 c8: 00021000 sll v0,v0,0x0 ; \ | |
78 cc: afc20000 sw v0,0(s8) ; | | |
79 d0: 00031000 sll v0,v1,0x0 ; | | |
80 d4: afc20004 sw v0,4(s8) ; | | |
81 d8: 00041000 sll v0,a0,0x0 ; | | |
82 dc: afc20008 sw v0,8(s8) ; | | |
83 e0: 00051000 sll v0,a1,0x0 ; | | |
84 e4: afc2000c sw v0,12(s8) ; | storing all register in args in local area on stack | |
85 e8: 00061000 sll v0,a2,0x0 ; | (using the set of pointlessly moved-to regs, above) | |
86 ec: afc20010 sw v0,16(s8) ; | | |
87 f0: 00071000 sll v0,a3,0x0 ; | | |
88 f4: afc20014 sw v0,20(s8) ; | | |
89 f8: 00081000 sll v0,a4,0x0 ; | | |
90 fc: afc20018 sw v0,24(s8) ; | | |
91 100: 00091000 sll v0,a5,0x0 ; | | |
92 104: afc2001c sw v0,28(s8) ; | | |
93 108: 67bdff10 daddiu sp,sp,-240 ; alloca(220) - with padding to guarantee alignment | |
94 10c: ffdd0020 sd sp,32(s8) ; | | |
95 110: dfc30020 ld v1,32(s8) ; | start of alloca()'d memory -> v1, by ... | |
96 114: 64620007 daddiu v0,v1,7 ; | ... using v0 as helper to align to 8b, and some unnecessary stores/reloads instead of a move | |
97 118: 000210fa dsrl v0,v0,0x3 ; | | |
98 11c: 000210f8 dsll v0,v0,0x3 ; | | |
99 120: ffc20020 sd v0,32(s8) ; move addr in v0 via local area ... | |
100 124: dfc30020 ld v1,32(s8) ; ... to v1 | |
101 128: 2402004c li v0,76 ; 'L' -> v0, and ... | |
102 12c: a0620000 sb v0,0(v1) ; ... store in local area (of alloca()'d space) | |
103 130: 8fc20004 lw v0,4(s8) ; prep arg 0 (pointlessly) to move to a0 below | |
104 134: 8fc30008 lw v1,8(s8) ; prep arg 1 (pointlessly) to move to a1 below | |
105 138: 8fc6000c lw a2,12(s8) ; arg 2 | |
106 13c: 8fc70010 lw a3,16(s8) ; arg 3 | |
107 140: 8fc80014 lw a4,20(s8) ; arg 4 | |
108 144: 8fc90018 lw a5,24(s8) ; arg 5 | |
109 148: 8fca001c lw a6,28(s8) ; arg 6 | |
110 14c: 0040202d move a0,v0 ; arg 0 | |
111 150: 0060282d move a1,v1 ; arg 1 | |
112 154: df990000 ld t9,0(gp) ; addr of callee -> t9 | |
113 158: 0320f809 jalr t9 ; return address -> ra, and call | |
114 15c: 00000000 nop ; branch delay slot | |
115 160: 03c0e82d move sp,s8 ; | | |
116 164: dfbf0060 ld ra,96(sp) ; | | |
117 168: dfbe0058 ld s8,88(sp) ; | | |
118 16c: dfbc0050 ld gp,80(sp) ; | epilog | |
119 170: 03e00008 jr ra ; | | |
120 174: 67bd0070 daddiu sp,sp,112 ; | branch delay slot style | |
121 | |
122 0000000000000178 <main>: | |
123 178: 67bdffe0 daddiu sp,sp,-32 ; | | |
124 17c: ffbf0010 sd ra,16(sp) ; | | |
125 180: ffbe0008 sd s8,8(sp) ; | prolog | |
126 184: ffbc0000 sd gp,0(sp) ; | | |
127 188: 03a0f02d move s8,sp ; | | |
128 18c: 3c1c0000 lui gp,0x0 ; @@@ unsure | |
129 190: 0399e02d daddu gp,gp,t9 ; @@@ unsure | |
130 194: 679c0000 daddiu gp,gp,0 ; @@@ unsure | |
131 198: 0000202d move a0,zero ; arg 0 | |
132 19c: 24050001 li a1,1 ; arg 1 | |
133 1a0: 24060002 li a2,2 ; arg 2 | |
134 1a4: 24070003 li a3,3 ; arg 3 | |
135 1a8: 24080004 li a4,4 ; arg 4 | |
136 1ac: 24090005 li a5,5 ; arg 5 | |
137 1b0: 240a0006 li a6,6 ; arg 6 | |
138 1b4: 240b0007 li a7,7 ; arg 7 | |
139 1b8: df990000 ld t9,0(gp) ; address of callee -> t9 | |
140 1bc: 0320f809 jalr t9 ; return address -> ra, and call | |
141 1c0: 00000000 nop ; branch delay slot | |
142 1c4: 0000102d move v0,zero ; return value | |
143 1c8: 03c0e82d move sp,s8 ; | | |
144 1cc: dfbf0010 ld ra,16(sp) ; | | |
145 1d0: dfbe0008 ld s8,8(sp) ; | | |
146 1d4: dfbc0000 ld gp,0(sp) ; | epilog | |
147 1d8: 03e00008 jr ra ; | | |
148 1dc: 67bd0020 daddiu sp,sp,32 ; | branch delay slot style | |
149 | |
150 | |
151 | |
152 ; output from debian-sid_20150616-malta_mips64el_n64 w/ gcc 4.9.2 | |
153 | |
154 0000000000000000 <leaf_call>: | |
155 0: 67bdffd0 daddiu sp,sp,-48 | |
156 4: ffbe0028 sd s8,40(sp) | |
157 8: 03a0f02d move s8,sp | |
158 c: 0080602d move t0,a0 | |
159 10: 00a0582d move a7,a1 | |
160 14: 00e0282d move a1,a3 | |
161 18: 0100202d move a0,a4 | |
162 1c: 0120182d move v1,a5 | |
163 20: 0140102d move v0,a6 | |
164 24: 000c3800 sll a3,t0,0x0 | |
165 28: afc70000 sw a3,0(s8) | |
166 2c: 000b3800 sll a3,a7,0x0 | |
167 30: afc70004 sw a3,4(s8) | |
168 34: 00063000 sll a2,a2,0x0 | |
169 38: afc60008 sw a2,8(s8) | |
170 3c: 00052800 sll a1,a1,0x0 | |
171 40: afc5000c sw a1,12(s8) | |
172 44: 00042000 sll a0,a0,0x0 | |
173 48: afc40010 sw a0,16(s8) | |
174 4c: 00031800 sll v1,v1,0x0 | |
175 50: afc30014 sw v1,20(s8) | |
176 54: 00021000 sll v0,v0,0x0 | |
177 58: afc20018 sw v0,24(s8) | |
178 5c: 03c0e82d move sp,s8 | |
179 60: dfbe0028 ld s8,40(sp) | |
180 64: 67bd0030 daddiu sp,sp,48 | |
181 68: 03e00008 jr ra | |
182 6c: 00200825 move at,at | |
183 | |
184 0000000000000070 <nonleaf_call>: | |
185 70: 67bdffc0 daddiu sp,sp,-64 ; | | |
186 74: ffbf0038 sd ra,56(sp) ; | | |
187 78: ffbe0030 sd s8,48(sp) ; | prolog | |
188 7c: ffbc0028 sd gp,40(sp) ; | | |
189 80: 03a0f02d move s8,sp ; | | |
190 84: 3c1c0000 lui gp,0x0 ; @@@ unsure | |
191 88: 0399e02d daddu gp,gp,t9 ; @@@ unsure | |
192 8c: 679c0000 daddiu gp,gp,0 ; @@@ unsure | |
193 90: 0080702d move t2,a0 ; | | |
194 94: 00a0682d move t1,a1 ; | | |
195 98: 00c0602d move t0,a2 ; | pointlessly (?) moving regs around, freeing effectively | |
196 9c: 00e0302d move a2,a3 ; | some registers for use below, still unnecessary though | |
197 a0: 0100282d move a1,a4 ; | with different code below | |
198 a4: 0120202d move a0,a5 ; | | |
199 a8: 0140182d move v1,a6 ; | | |
200 ac: 0160102d move v0,a7 ; / | |
201 b0: 000e3800 sll a3,t2,0x0 ; \ | |
202 b4: afc70000 sw a3,0(s8) ; | | |
203 b8: 000d3800 sll a3,t1,0x0 ; | | |
204 bc: afc70004 sw a3,4(s8) ; | | |
205 c0: 000c3800 sll a3,t0,0x0 ; | | |
206 c4: afc70008 sw a3,8(s8) ; | | |
207 c8: 00063000 sll a2,a2,0x0 ; | | |
208 cc: afc6000c sw a2,12(s8) ; | storing all register in args in local area on stack | |
209 d0: 00052800 sll a1,a1,0x0 ; | (using the set of pointlessly moved-to regs, above) | |
210 d4: afc50010 sw a1,16(s8) ; | | |
211 d8: 00042000 sll a0,a0,0x0 ; | | |
212 dc: afc40014 sw a0,20(s8) ; | | |
213 e0: 00031800 sll v1,v1,0x0 ; | | |
214 e4: afc30018 sw v1,24(s8) ; | | |
215 e8: 00021000 sll v0,v0,0x0 ; | | |
216 ec: afc2001c sw v0,28(s8) ; | | |
217 f0: 67bdff10 daddiu sp,sp,-240 ; alloca(220) - with padding to guarantee alignment | |
218 f4: 03a0102d move v0,sp ; | | |
219 f8: 6442000f daddiu v0,v0,15 ; | start of alloca()'d memory -> v1, by ... | |
220 fc: 0002113a dsrl v0,v0,0x4 ; | ... using v0 as helper to align to 8b | |
221 100: 00021138 dsll v0,v0,0x4 ; | | |
222 104: 0040182d move v1,v0 ; | | |
223 108: 2402004c li v0,76 ; 'L' -> v0, and ... | |
224 10c: a0620000 sb v0,0(v1) ; ... store in local area (of alloca()'d space) | |
225 110: 8fc40004 lw a0,4(s8) ; arg 0 | |
226 114: 8fc50008 lw a1,8(s8) ; arg 1 | |
227 118: 8fc6000c lw a2,12(s8) ; arg 2 | |
228 11c: 8fc70010 lw a3,16(s8) ; arg 3 | |
229 120: 8fc80014 lw a4,20(s8) ; arg 4 | |
230 124: 8fc30018 lw v1,24(s8) ; prep arg 5 (pointlessly) to move to a5 below | |
231 128: 8fc2001c lw v0,28(s8) ; prep arg 5 (pointlessly) to move to a5 below | |
232 12c: 0060482d move a5,v1 ; arg 5 | |
233 130: 0040502d move a6,v0 ; arg 6 | |
234 134: df820000 ld v0,0(gp) ; addr of callee ... | |
235 138: 0040c82d move t9,v0 ; ... -> t9 | |
236 13c: 0320f809 jalr t9 ; return address -> ra, and call | |
237 140: 00200825 move at,at ; branch delay slot (effectively nop) | |
238 144: 03c0e82d move sp,s8 ; | | |
239 148: dfbf0038 ld ra,56(sp) ; | | |
240 14c: dfbe0030 ld s8,48(sp) ; | | |
241 150: dfbc0028 ld gp,40(sp) ; | epilog | |
242 154: 67bd0040 daddiu sp,sp,64 ; | | |
243 158: 03e00008 jr ra ; | | |
244 15c: 00200825 move at,at ; | branch delay slot (effectively nop) | |
245 | |
246 0000000000000160 <main>: | |
247 160: 67bdffe0 daddiu sp,sp,-32 ; | | |
248 164: ffbf0018 sd ra,24(sp) ; | | |
249 168: ffbe0010 sd s8,16(sp) ; | prolog | |
250 16c: ffbc0008 sd gp,8(sp) ; | | |
251 170: 03a0f02d move s8,sp ; | | |
252 174: 3c1c0000 lui gp,0x0 ; @@@ unsure | |
253 178: 0399e02d daddu gp,gp,t9 ; @@@ unsure | |
254 17c: 679c0000 daddiu gp,gp,0 ; @@@ unsure | |
255 180: 0000202d move a0,zero ; arg 0 | |
256 184: 24050001 li a1,1 ; arg 1 | |
257 188: 24060002 li a2,2 ; arg 2 | |
258 18c: 24070003 li a3,3 ; arg 3 | |
259 190: 24080004 li a4,4 ; arg 4 | |
260 194: 24090005 li a5,5 ; arg 5 | |
261 198: 240a0006 li a6,6 ; arg 6 | |
262 19c: 240b0007 li a7,7 ; arg 7 | |
263 1a0: df820000 ld v0,0(gp) ; address of callee, to ... | |
264 1a4: 0040c82d move t9,v0 ; ... t9 | |
265 1a8: 0320f809 jalr t9 ; return address -> ra, and call | |
266 1ac: 00200825 move at,at ; branch delay slot (effectively nop) | |
267 1b0: 0000102d move v0,zero ; return value | |
268 1b4: 03c0e82d move sp,s8 ; | | |
269 1b8: dfbf0018 ld ra,24(sp) ; | | |
270 1bc: dfbe0010 ld s8,16(sp) ; | | |
271 1c0: dfbc0008 ld gp,8(sp) ; | epilog | |
272 1c4: 67bd0020 daddiu sp,sp,32 ; | | |
273 1c8: 03e00008 jr ra ; | | |
274 1cc: 00200825 move at,at ; | branch delay slot (effectively nop) | |
275 | |
276 | |
277 | |
278 ; ------------- var args with ints and floats to see spilling (which remains only a?-a7 regs), b/c doubles are passed via them and floats are promoted to doubles in (...) -----------> | |
279 | |
280 ; #include <stdlib.h> | |
281 ; #include <stdarg.h> | |
282 ; | |
283 ; void leaf_call(int b, int c, int d, int e, float f, float g, int h, int i, float j) | |
284 ; { | |
285 ; } | |
286 ; | |
287 ; void nonleaf_call(int a, ...) | |
288 ; { | |
289 ; int b, c, d, e, h, i; | |
290 ; float f, g, j; | |
291 ; va_list ap; | |
292 ; va_start(ap, a); | |
293 ; b = va_arg(ap, int); | |
294 ; c = va_arg(ap, int); | |
295 ; d = va_arg(ap, int); | |
296 ; e = va_arg(ap, int); | |
297 ; f = (float)va_arg(ap, double); | |
298 ; g = (float)va_arg(ap, double); | |
299 ; h = va_arg(ap, int); | |
300 ; i = va_arg(ap, int); | |
301 ; j = (float)va_arg(ap, double); | |
302 ; /* use some local data */ | |
303 ; *(char*)alloca(220) = 'L'; | |
304 ; leaf_call(b, c, d, e, f, g, h, i, j); | |
305 ; } | |
306 ; | |
307 ; int main() | |
308 ; { | |
309 ; nonleaf_call(0, 1, 2, 3, 4, 5.f, 6.f, 7, 8, 9.f); | |
310 ; return 0; | |
311 ; } | |
312 | |
313 | |
314 | |
315 ; output from freebsd-12.0_r333647-malta_mips64elhf w/ gcc 4.2.1 | |
316 | |
317 0000000000000000 <leaf_call>: | |
318 0: 67bdffd0 daddiu sp,sp,-48 | |
319 4: ffbe0028 sd s8,40(sp) | |
320 8: ffbc0020 sd gp,32(sp) | |
321 c: 03a0f02d move s8,sp | |
322 10: 3c1c0000 lui gp,0x0 | |
323 14: 0399e02d daddu gp,gp,t9 | |
324 18: 679c0000 daddiu gp,gp,0 | |
325 1c: 0080102d move v0,a0 | |
326 20: 00a0182d move v1,a1 | |
327 24: 00c0202d move a0,a2 | |
328 28: 00e0302d move a2,a3 | |
329 2c: afc80010 sw a4,16(s8) | |
330 30: afc90014 sw a5,20(s8) | |
331 34: 0140282d move a1,a6 | |
332 38: 0160382d move a3,a7 | |
333 3c: 00021000 sll v0,v0,0x0 | |
334 40: afc20000 sw v0,0(s8) | |
335 44: 00031000 sll v0,v1,0x0 | |
336 48: afc20004 sw v0,4(s8) | |
337 4c: 00041000 sll v0,a0,0x0 | |
338 50: afc20008 sw v0,8(s8) | |
339 54: 00061000 sll v0,a2,0x0 | |
340 58: afc2000c sw v0,12(s8) | |
341 5c: 00051000 sll v0,a1,0x0 | |
342 60: afc20018 sw v0,24(s8) | |
343 64: 00071000 sll v0,a3,0x0 | |
344 68: afc2001c sw v0,28(s8) | |
345 6c: 03c0e82d move sp,s8 | |
346 70: dfbe0028 ld s8,40(sp) | |
347 74: dfbc0020 ld gp,32(sp) | |
348 78: 03e00008 jr ra | |
349 7c: 67bd0030 daddiu sp,sp,48 | |
350 | |
351 0000000000000080 <nonleaf_call>: | |
352 80: 67bdff50 daddiu sp,sp,-176 | |
353 84: ffbf0060 sd ra,96(sp) | |
354 88: ffbe0058 sd s8,88(sp) | |
355 8c: ffbc0050 sd gp,80(sp) | |
356 90: 03a0f02d move s8,sp | |
357 94: 3c1c0000 lui gp,0x0 | |
358 98: 0399e02d daddu gp,gp,t9 | |
359 9c: 679c0000 daddiu gp,gp,0 | |
360 a0: ffc50078 sd a1,120(s8) | |
361 a4: ffc60080 sd a2,128(s8) | |
362 a8: ffc70088 sd a3,136(s8) | |
363 ac: ffc80090 sd a4,144(s8) | |
364 b0: ffc90098 sd a5,152(s8) | |
365 b4: ffca00a0 sd a6,160(s8) | |
366 b8: ffcb00a8 sd a7,168(s8) | |
367 bc: 0080102d move v0,a0 | |
368 c0: 00021000 sll v0,v0,0x0 | |
369 c4: afc20040 sw v0,64(s8) | |
370 c8: 67c200b0 daddiu v0,s8,176 | |
371 cc: 6442ffc8 daddiu v0,v0,-56 | |
372 d0: ffc20038 sd v0,56(s8) | |
373 d4: dfc30038 ld v1,56(s8) | |
374 d8: 64620008 daddiu v0,v1,8 | |
375 dc: ffc20038 sd v0,56(s8) | |
376 e0: 0060102d move v0,v1 | |
377 e4: 8c420000 lw v0,0(v0) | |
378 e8: afc20030 sw v0,48(s8) | |
379 ec: dfc30038 ld v1,56(s8) | |
380 f0: 64620008 daddiu v0,v1,8 | |
381 f4: ffc20038 sd v0,56(s8) | |
382 f8: 0060102d move v0,v1 | |
383 fc: 8c420000 lw v0,0(v0) | |
384 100: afc2002c sw v0,44(s8) | |
385 104: dfc30038 ld v1,56(s8) | |
386 108: 64620008 daddiu v0,v1,8 | |
387 10c: ffc20038 sd v0,56(s8) | |
388 110: 0060102d move v0,v1 | |
389 114: 8c420000 lw v0,0(v0) | |
390 118: afc20028 sw v0,40(s8) | |
391 11c: dfc30038 ld v1,56(s8) | |
392 120: 64620008 daddiu v0,v1,8 | |
393 124: ffc20038 sd v0,56(s8) | |
394 128: 0060102d move v0,v1 | |
395 12c: 8c420000 lw v0,0(v0) | |
396 130: afc20024 sw v0,36(s8) | |
397 134: dfc30038 ld v1,56(s8) | |
398 138: 64620008 daddiu v0,v1,8 | |
399 13c: ffc20038 sd v0,56(s8) | |
400 140: 0060102d move v0,v1 | |
401 144: dc420000 ld v0,0(v0) | |
402 148: 0040202d move a0,v0 | |
403 14c: df990000 ld t9,0(gp) | |
404 150: 0320f809 jalr t9 | |
405 154: 00000000 nop | |
406 158: afc20018 sw v0,24(s8) | |
407 15c: dfc30038 ld v1,56(s8) | |
408 160: 64620008 daddiu v0,v1,8 | |
409 164: ffc20038 sd v0,56(s8) | |
410 168: 0060102d move v0,v1 | |
411 16c: dc420000 ld v0,0(v0) | |
412 170: 0040202d move a0,v0 | |
413 174: df990000 ld t9,0(gp) | |
414 178: 0320f809 jalr t9 | |
415 17c: 00000000 nop | |
416 180: afc20014 sw v0,20(s8) | |
417 184: dfc30038 ld v1,56(s8) | |
418 188: 64620008 daddiu v0,v1,8 | |
419 18c: ffc20038 sd v0,56(s8) | |
420 190: 0060102d move v0,v1 | |
421 194: 8c420000 lw v0,0(v0) | |
422 198: afc20020 sw v0,32(s8) | |
423 19c: dfc30038 ld v1,56(s8) | |
424 1a0: 64620008 daddiu v0,v1,8 | |
425 1a4: ffc20038 sd v0,56(s8) | |
426 1a8: 0060102d move v0,v1 | |
427 1ac: 8c420000 lw v0,0(v0) | |
428 1b0: afc2001c sw v0,28(s8) | |
429 1b4: dfc30038 ld v1,56(s8) | |
430 1b8: 64620008 daddiu v0,v1,8 | |
431 1bc: ffc20038 sd v0,56(s8) | |
432 1c0: 0060102d move v0,v1 | |
433 1c4: dc420000 ld v0,0(v0) | |
434 1c8: 0040202d move a0,v0 | |
435 1cc: df990000 ld t9,0(gp) | |
436 1d0: 0320f809 jalr t9 | |
437 1d4: 00000000 nop | |
438 1d8: afc20010 sw v0,16(s8) | |
439 1dc: 67bdff10 daddiu sp,sp,-240 | |
440 1e0: 67a20010 daddiu v0,sp,16 | |
441 1e4: ffc20048 sd v0,72(s8) | |
442 1e8: dfc30048 ld v1,72(s8) | |
443 1ec: 64620007 daddiu v0,v1,7 | |
444 1f0: 000210fa dsrl v0,v0,0x3 | |
445 1f4: 000210f8 dsll v0,v0,0x3 | |
446 1f8: ffc20048 sd v0,72(s8) | |
447 1fc: dfc30048 ld v1,72(s8) | |
448 200: 2402004c li v0,76 | |
449 204: a0620000 sb v0,0(v1) | |
450 208: 8fc30030 lw v1,48(s8) | |
451 20c: 8fc5002c lw a1,44(s8) | |
452 210: 8fc60028 lw a2,40(s8) | |
453 214: 8fc70024 lw a3,36(s8) | |
454 218: 8fca0020 lw a6,32(s8) | |
455 21c: 8fcb001c lw a7,28(s8) | |
456 220: 8fc20010 lw v0,16(s8) | |
457 224: afa20000 sw v0,0(sp) | |
458 228: 0060202d move a0,v1 | |
459 22c: 8fc80018 lw a4,24(s8) | |
460 230: 8fc90014 lw a5,20(s8) | |
461 234: df990000 ld t9,0(gp) | |
462 238: 0320f809 jalr t9 | |
463 23c: 00000000 nop | |
464 240: 03c0e82d move sp,s8 | |
465 244: dfbf0060 ld ra,96(sp) | |
466 248: dfbe0058 ld s8,88(sp) | |
467 24c: dfbc0050 ld gp,80(sp) | |
468 250: 03e00008 jr ra | |
469 254: 67bd00b0 daddiu sp,sp,176 | |
470 | |
471 0000000000000258 <main>: | |
472 258: 67bdffd0 daddiu sp,sp,-48 | |
473 25c: ffbf0020 sd ra,32(sp) | |
474 260: ffbe0018 sd s8,24(sp) | |
475 264: ffbc0010 sd gp,16(sp) | |
476 268: 03a0f02d move s8,sp | |
477 26c: 3c1c0000 lui gp,0x0 | |
478 270: 0399e02d daddu gp,gp,t9 | |
479 274: 679c0000 daddiu gp,gp,0 | |
480 278: df830000 ld v1,0(gp) | |
481 27c: dc630000 ld v1,0(v1) | |
482 280: df8a0000 ld a6,0(gp) | |
483 284: dd4a0000 ld a6,0(a6) | |
484 288: 24020008 li v0,8 | |
485 28c: ffa20000 sd v0,0(sp) | |
486 290: df820000 ld v0,0(gp) | |
487 294: dc420000 ld v0,0(v0) | |
488 298: ffa20008 sd v0,8(sp) | |
489 29c: 0000202d move a0,zero | |
490 2a0: 24050001 li a1,1 | |
491 2a4: 24060002 li a2,2 | |
492 2a8: 24070003 li a3,3 | |
493 2ac: 24080004 li a4,4 | |
494 2b0: 0060482d move a5,v1 | |
495 2b4: 240b0007 li a7,7 | |
496 2b8: df990000 ld t9,0(gp) | |
497 2bc: 0320f809 jalr t9 | |
498 2c0: 00000000 nop | |
499 2c4: 03c0e82d move sp,s8 | |
500 2c8: dfbf0020 ld ra,32(sp) | |
501 2cc: dfbe0018 ld s8,24(sp) | |
502 2d0: dfbc0010 ld gp,16(sp) | |
503 2d4: 03e00008 jr ra | |
504 2d8: 67bd0030 daddiu sp,sp,48 | |
505 2dc: 00000000 nop | |
506 | |
507 | |
508 | |
509 ; output from debian-sid_20150616-malta_mips64el_n64 w/ gcc 4.9.2 | |
510 | |
511 0000000000000000 <leaf_call>: | |
512 0: 67bdffd0 daddiu sp,sp,-48 | |
513 4: ffbe0028 sd s8,40(sp) | |
514 8: 03a0f02d move s8,sp | |
515 c: 0080482d move a5,a0 | |
516 10: 00a0402d move a4,a1 | |
517 14: 00c0282d move a1,a2 | |
518 18: 00e0202d move a0,a3 | |
519 1c: e7d00010 swc1 $f16,16(s8) | |
520 20: e7d10014 swc1 $f17,20(s8) | |
521 24: 0140182d move v1,a6 | |
522 28: 0160102d move v0,a7 | |
523 2c: 00093000 sll a2,a5,0x0 | |
524 30: afc60000 sw a2,0(s8) | |
525 34: 00083000 sll a2,a4,0x0 | |
526 38: afc60004 sw a2,4(s8) | |
527 3c: 00052800 sll a1,a1,0x0 | |
528 40: afc50008 sw a1,8(s8) | |
529 44: 00042000 sll a0,a0,0x0 | |
530 48: afc4000c sw a0,12(s8) | |
531 4c: 00031800 sll v1,v1,0x0 | |
532 50: afc30018 sw v1,24(s8) | |
533 54: 00021000 sll v0,v0,0x0 | |
534 58: afc2001c sw v0,28(s8) | |
535 5c: 03c0e82d move sp,s8 | |
536 60: dfbe0028 ld s8,40(sp) | |
537 64: 67bd0030 daddiu sp,sp,48 | |
538 68: 03e00008 jr ra | |
539 6c: 00200825 move at,at | |
540 | |
541 0000000000000070 <nonleaf_call>: | |
542 70: 67bdff50 daddiu sp,sp,-176 ; | leaving 64b extra space adjacent to prev frame's param area for spilling | |
543 74: ffbf0068 sd ra,104(sp) ; | | |
544 78: ffbe0060 sd s8,96(sp) ; | prolog | |
545 7c: ffbc0058 sd gp,88(sp) ; | | |
546 80: 03a0f02d move s8,sp ; | | |
547 84: 3c1c0000 lui gp,0x0 ; @@@ unsure | |
548 88: 0399e02d daddu gp,gp,t9 ; @@@ unsure | |
549 8c: 679c0000 daddiu gp,gp,0 ; @@@ unsure | |
550 90: ffc50078 sd a1,120(s8) ; | | |
551 94: ffc60080 sd a2,128(s8) ; | | |
552 98: ffc70088 sd a3,136(s8) ; | | |
553 9c: ffc80090 sd a4,144(s8) ; | in args 1,2,3,4,5,6,7 -> spill area in current frame (adjacent to prev frame's param area) | |
554 a0: ffc90098 sd a5,152(s8) ; | | |
555 a4: ffca00a0 sd a6,160(s8) ; | | |
556 a8: ffcb00a8 sd a7,168(s8) ; / | |
557 ac: 0080102d move v0,a0 ; \ | |
558 b0: 00021000 sll v0,v0,0x0 ; | | |
559 b4: afc20040 sw v0,64(s8) ; | | |
560 b8: 67c200b0 daddiu v0,s8,176 ; | | |
561 bc: 6442ffc8 daddiu v0,v0,-56 ; | | |
562 c0: ffc20038 sd v0,56(s8) ; | | |
563 c4: dfc20038 ld v0,56(s8) ; | | |
564 c8: 64430008 daddiu v1,v0,8 ; | | |
565 cc: ffc30038 sd v1,56(s8) ; | | |
566 d0: 8c420000 lw v0,0(v0) ; | | |
567 d4: afc20010 sw v0,16(s8) ; | | |
568 d8: dfc20038 ld v0,56(s8) ; | | |
569 dc: 64430008 daddiu v1,v0,8 ; | | |
570 e0: ffc30038 sd v1,56(s8) ; | | |
571 e4: 8c420000 lw v0,0(v0) ; | | |
572 e8: afc20014 sw v0,20(s8) ; | | |
573 ec: dfc20038 ld v0,56(s8) ; | | |
574 f0: 64430008 daddiu v1,v0,8 ; | | |
575 f4: ffc30038 sd v1,56(s8) ; | | |
576 f8: 8c420000 lw v0,0(v0) ; | | |
577 fc: afc20018 sw v0,24(s8) ; | | |
578 100: dfc20038 ld v0,56(s8) ; | | |
579 104: 64430008 daddiu v1,v0,8 ; | | |
580 108: ffc30038 sd v1,56(s8) ; | | |
581 10c: 8c420000 lw v0,0(v0) ; | | |
582 110: afc2001c sw v0,28(s8) ; | | |
583 114: dfc20038 ld v0,56(s8) ; | | |
584 118: 64430008 daddiu v1,v0,8 ; | | |
585 11c: ffc30038 sd v1,56(s8) ; | | |
586 120: dc420000 ld v0,0(v0) ; | | |
587 124: 44a20000 dmtc1 v0,$f0 ; | vararg stuff: pointer to beginning of spill area (constantly | |
588 128: 46200020 cvt.s.d $f0,$f0 ; | stored and reloaded) to iterate over all params which are stored | |
589 12c: 44020000 mfc1 v0,$f0 ; | to a local space on stack, which they are refetched from, below | |
590 130: afc20020 sw v0,32(s8) ; | (see similar mips32 examples for detailed analysis) | |
591 134: dfc20038 ld v0,56(s8) ; | | |
592 138: 64430008 daddiu v1,v0,8 ; | | |
593 13c: ffc30038 sd v1,56(s8) ; | | |
594 140: dc420000 ld v0,0(v0) ; | | |
595 144: 44a20000 dmtc1 v0,$f0 ; | | |
596 148: 46200020 cvt.s.d $f0,$f0 ; | | |
597 14c: 44020000 mfc1 v0,$f0 ; | | |
598 150: afc20024 sw v0,36(s8) ; | | |
599 154: dfc20038 ld v0,56(s8) ; | | |
600 158: 64430008 daddiu v1,v0,8 ; | | |
601 15c: ffc30038 sd v1,56(s8) ; | | |
602 160: 8c420000 lw v0,0(v0) ; | | |
603 164: afc20028 sw v0,40(s8) ; | | |
604 168: dfc20038 ld v0,56(s8) ; | | |
605 16c: 64430008 daddiu v1,v0,8 ; | | |
606 170: ffc30038 sd v1,56(s8) ; | | |
607 174: 8c420000 lw v0,0(v0) ; | | |
608 178: afc2002c sw v0,44(s8) ; | | |
609 17c: dfc20038 ld v0,56(s8) ; | | |
610 180: 64430008 daddiu v1,v0,8 ; | | |
611 184: ffc30038 sd v1,56(s8) ; | | |
612 188: dc420000 ld v0,0(v0) ; | | |
613 18c: 44a20000 dmtc1 v0,$f0 ; | | |
614 190: 46200020 cvt.s.d $f0,$f0 ; | | |
615 194: 44020000 mfc1 v0,$f0 ; | | |
616 198: afc20030 sw v0,48(s8) ; | | |
617 19c: 67bdff10 daddiu sp,sp,-240 ; alloca(220) - with padding to guarantee alignment | |
618 1a0: 67a20010 daddiu v0,sp,16 ; | | |
619 1a4: 6442000f daddiu v0,v0,15 ; | | |
620 1a8: 0002113a dsrl v0,v0,0x4 ; | start of alloca()'d memory -> v1, by ... | |
621 1ac: 00021138 dsll v0,v0,0x4 ; | ... using v0 as helper to align to 16b | |
622 1b0: 0040182d move v1,v0 ; | | |
623 1b4: 2402004c li v0,76 ; 'L' -> v0, and ... | |
624 1b8: a0620000 sb v0,0(v1) ; ... store in local area (of alloca()'d space) | |
625 1bc: 8fc40010 lw a0,16(s8) ; arg 0 | |
626 1c0: 8fc50014 lw a1,20(s8) ; arg 1 | |
627 1c4: 8fc60018 lw a2,24(s8) ; arg 2 | |
628 1c8: 8fc7001c lw a3,28(s8) ; arg 3 | |
629 1cc: 8fc80028 lw a4,40(s8) ; prepare arg 6 (using a4 only as temp reg), to move to a6 below | |
630 1d0: 8fc3002c lw v1,44(s8) ; prepare arg 7 (pointlessly) to move to a7 below | |
631 1d4: 8fc20030 lw v0,48(s8) ; arg 8, and ... | |
632 1d8: afa20000 sw v0,0(sp) ; ... "pushed" onto stack | |
633 1dc: c7d00020 lwc1 $f16,32(s8) ; arg 4 (so skipping f12-f15) | |
634 1e0: c7d10024 lwc1 $f17,36(s8) ; arg 5 (so skipping f12-f15) | |
635 1e4: 0100502d move a6,a4 ; arg 6 (from a4 used as temp reg, pointlessly) | |
636 1e8: 0060582d move a7,v1 ; arg 7 | |
637 1ec: df820000 ld v0,0(gp) ; address of callee, to ... | |
638 1f0: 0040c82d move t9,v0 ; ... t9 | |
639 1f4: 0320f809 jalr t9 ; return address -> ra, and call | |
640 1f8: 00200825 move at,at ; branch delay slot (effectively nop) | |
641 1fc: 03c0e82d move sp,s8 ; | | |
642 200: dfbf0068 ld ra,104(sp) ; | | |
643 204: dfbe0060 ld s8,96(sp) ; | | |
644 208: dfbc0058 ld gp,88(sp) ; | epilog | |
645 20c: 67bd00b0 daddiu sp,sp,176 ; | | |
646 210: 03e00008 jr ra ; | | |
647 214: 00200825 move at,at ; | branch delay slot (effectively nop) | |
648 | |
649 0000000000000218 <main>: | |
650 218: 67bdffd0 daddiu sp,sp,-48 ; | | |
651 21c: ffbf0028 sd ra,40(sp) ; | | |
652 220: ffbe0020 sd s8,32(sp) ; | prolog | |
653 224: ffbc0018 sd gp,24(sp) ; | | |
654 228: 03a0f02d move s8,sp ; | | |
655 22c: 3c1c0000 lui gp,0x0 ; unsure@@@ | |
656 230: 0399e02d daddu gp,gp,t9 ; unsure@@@ | |
657 234: 679c0000 daddiu gp,gp,0 ; unsure@@@ | |
658 238: df820000 ld v0,0(gp) ; arg 6 (float promoted to double), from static data (0 b/c objdmp is from .o, not final linked exec), ... | |
659 23c: d4410000 ldc1 $f1,0(v0) ; ... to f1 | |
660 240: df820000 ld v0,0(gp) ; arg 5 (float promoted to double), from static data (0 b/c objdmp is from .o, not final linked exec), ... | |
661 244: d4400000 ldc1 $f0,0(v0) ; ... to f0 | |
662 248: 24020008 li v0,8 ; arg 8, ... | |
663 24c: ffa20000 sd v0,0(sp) ; ... "pushed" onto stack | |
664 250: df820000 ld v0,0(gp) ; arg 9 (float promoted to double), from static data (0 b/c objdmp is from .o, not final linked exec), ... | |
665 254: dc420000 ld v0,0(v0) ; ... via v0 ... | |
666 258: ffa20008 sd v0,8(sp) ; ... "pushed" onto stack | |
667 25c: 0000202d move a0,zero ; arg 0 | |
668 260: 24050001 li a1,1 ; arg 1 | |
669 264: 24060002 li a2,2 ; arg 2 | |
670 268: 24070003 li a3,3 ; arg 3 | |
671 26c: 24080004 li a4,4 ; arg 4 | |
672 270: 44290800 dmfc1 a5,$f1 ; arg 5 (note: passed in a5 b/c vararg) | |
673 274: 442a0000 dmfc1 a6,$f0 ; arg 6 (note: passed in a6 b/c vararg) | |
674 278: 240b0007 li a7,7 ; arg 7 | |
675 27c: df820000 ld v0,0(gp) ; address of callee, to ... | |
676 280: 0040c82d move t9,v0 ; ... t9 | |
677 284: 0320f809 jalr t9 ; return address -> ra, and call | |
678 288: 00200825 move at,at ; branch delay slot (effectively nop) | |
679 28c: 03c0e82d move sp,s8 ; | | |
680 290: dfbf0028 ld ra,40(sp) ; | | |
681 294: dfbe0020 ld s8,32(sp) ; | | |
682 298: dfbc0018 ld gp,24(sp) ; | | |
683 29c: 67bd0030 daddiu sp,sp,48 ; | epilog | |
684 2a0: 03e00008 jr ra ; | | |
685 2a4: 00200825 move at,at ; | branch delay slot (effectively nop) | |
686 2a8: 00200825 move at,at ; | ? @@@ | |
687 2ac: 00200825 move at,at ; | ? @@@ | |
688 | |
689 ; vim: ft=asm | |
690 |