Mercurial > pub > dyncall > dyncall
annotate doc/disas_examples/ppc64.elfabi.disas @ 425:2d9f1cb06352
- dynload: corrected comparison of size of optional PE header info to what is pointed to (ptr arithmetic was incorrect, only broke ReactOS builds and runtime, though)
| author | Tassilo Philipp |
|---|---|
| date | Fri, 17 Dec 2021 18:50:58 +0100 |
| parents | 74c056b597b7 |
| children | ead041d93e36 |
| rev | line source |
|---|---|
|
327
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
1 ; #include <stdlib.h> |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
2 ; |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
3 ; void leaf_call(int b, int c, int d, int e, int f, int g, int h) |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
4 ; { |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
5 ; } |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
6 ; |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
7 ; void nonleaf_call(int a, int b, int c, int d, int e, int f, int g, int h) |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
8 ; { |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
9 ; /* use some local data */ |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
10 ; *(char*)alloca(220) = 'L'; |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
11 ; leaf_call(b, c, d, e, f, g, h); |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
12 ; } |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
13 ; |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
14 ; int main() |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
15 ; { |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
16 ; nonleaf_call(0, 1, 2, 3, 4, 5, 6, 7); |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
17 ; return 0; |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
18 ; } |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
19 |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
20 |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
21 |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
22 ; output from freebsd-11.0-ppc64 w/ gcc 4.2.1 |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
23 |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
24 0000000000000000 <.leaf_call>: |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
25 0: fb e1 ff f8 std r31,-8(r1) |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
26 4: f8 21 ff c1 stdu r1,-64(r1) |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
27 8: 7c 3f 0b 78 mr r31,r1 |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
28 c: 7c 60 1b 78 mr r0,r3 |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
29 10: 7c 8b 23 78 mr r11,r4 |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
30 14: 7c aa 2b 78 mr r10,r5 |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
31 18: 90 1f 00 70 stw r0,112(r31) |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
32 1c: 91 7f 00 78 stw r11,120(r31) |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
33 20: 91 5f 00 80 stw r10,128(r31) |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
34 24: 90 df 00 88 stw r6,136(r31) |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
35 28: 90 ff 00 90 stw r7,144(r31) |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
36 2c: 91 1f 00 98 stw r8,152(r31) |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
37 30: 91 3f 00 a0 stw r9,160(r31) |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
38 34: e8 21 00 00 ld r1,0(r1) |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
39 38: eb e1 ff f8 ld r31,-8(r1) |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
40 3c: 4e 80 00 20 blr |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
41 ... |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
42 48: 80 01 00 01 lwz r0,1(r1) |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
43 |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
44 000000000000004c <.nonleaf_call>: |
| 331 | 45 4c: 7c 08 02 a6 mflr r0 ; | |
| 46 50: fb e1 ff f8 std r31,-8(r1) ; | | |
| 47 54: f8 01 00 10 std r0,16(r1) ; | prolog | |
| 48 58: f8 21 ff 71 stdu r1,-144(r1) ; | | |
| 49 5c: 7c 3f 0b 78 mr r31,r1 ; use gpr31 as sort of frame pointer, below | |
| 50 60: 7c 60 1b 78 mr r0,r3 ; in arg 0 -> gpr0 | |
| 51 64: 7c 8b 23 78 mr r11,r4 ; in arg 1 -> gpr11 | |
| 52 68: 90 1f 00 c0 stw r0,192(r31) ; | | |
| 53 6c: 91 7f 00 c8 stw r11,200(r31) ; | | |
| 54 70: 90 bf 00 d0 stw r5,208(r31) ; | | |
| 55 74: 90 df 00 d8 stw r6,216(r31) ; | | |
| 56 78: 90 ff 00 e0 stw r7,224(r31) ; | all in args -> spill area in prev frame (jump over own frame (144) + linkage area of prev frame (48) = 192) | |
| 57 7c: 91 1f 00 e8 stw r8,232(r31) ; | | |
| 58 80: 91 3f 00 f0 stw r9,240(r31) ; | | |
| 59 84: 91 5f 00 f8 stw r10,248(r31) ; | | |
| 60 88: e8 01 00 00 ld r0,0(r1) ; fetch back-chain ptr (parent frame's sp) from stack of top by prolog -> gpr0, and ... | |
| 61 8c: f8 01 ff 11 stdu r0,-240(r1) ; ... update it further up the stack for alloca(220) - with padding to guarantee alignment | |
| 62 90: 39 21 00 70 addi r9,r1,112 ; | | |
| 63 94: f9 3f 00 70 std r9,112(r31) ; | | |
| 64 98: e9 3f 00 70 ld r9,112(r31) ; | | |
| 65 9c: 38 09 00 0f addi r0,r9,15 ; | start of alloca()'d memory -> gpr9, by ... | |
| 66 a0: 78 00 e1 02 rldicl r0,r0,60,4 ; | ... using gpr0 as helper to align to 16b, leaving at least 112b at top of stack | |
| 67 a4: 78 00 26 e4 rldicr r0,r0,4,59 ; | | |
| 68 a8: f8 1f 00 70 std r0,112(r31) ; | | |
| 69 ac: e9 3f 00 70 ld r9,112(r31) ; | | |
| 70 b0: 38 00 00 4c li r0,76 ; 'L' -> gpr0, and ... | |
| 71 b4: 98 09 00 00 stb r0,0(r9) ; ... store in local area (of alloca()'d space) | |
| 72 b8: 80 1f 00 c8 lwz r0,200(r31) ; prep arg 0 (from prev frame's spill area), ... | |
| 73 bc: 7c 08 07 b4 extsw r8,r0 ; ... -> gpr8 (w/ sign extension b/c int param in 64bit reg) | |
| 74 c0: 80 1f 00 d0 lwz r0,208(r31) ; prep arg 1 (from prev frame's spill area), ... | |
| 75 c4: 7c 07 07 b4 extsw r7,r0 ; ... -> gpr7 | |
| 76 c8: 80 1f 00 d8 lwz r0,216(r31) ; prep arg 2 (from prev frame's spill area), ... | |
| 77 cc: 7c 06 07 b4 extsw r6,r0 ; ... -> gpr6 | |
| 78 d0: 80 1f 00 e0 lwz r0,224(r31) ; prep arg 3 (from prev frame's spill area), ... | |
| 79 d4: 7c 09 07 b4 extsw r9,r0 ; ... -> gpr9 | |
| 80 d8: 80 1f 00 e8 lwz r0,232(r31) ; prep arg 4 (from prev frame's spill area), ... | |
| 81 dc: 7c 0b 07 b4 extsw r11,r0 ; ... -> gpr11 | |
| 82 e0: 80 1f 00 f0 lwz r0,240(r31) ; prep arg 5 (from prev frame's spill area), ... | |
| 83 e4: 7c 0a 07 b4 extsw r10,r0 ; ... -> gpr10 | |
| 84 e8: 80 1f 00 f8 lwz r0,248(r31) ; prep arg 6 (from prev frame's spill area), ... | |
| 85 ec: 7c 00 07 b4 extsw r0,r0 ; ... -> gpr0 | |
| 86 f0: 7d 03 43 78 mr r3,r8 ; arg 0 | |
| 87 f4: 7c e4 3b 78 mr r4,r7 ; arg 1 | |
| 88 f8: 7c c5 33 78 mr r5,r6 ; arg 2 | |
| 89 fc: 7d 26 4b 78 mr r6,r9 ; arg 3 | |
| 90 100: 7d 67 5b 78 mr r7,r11 ; arg 4 | |
| 91 104: 7d 48 53 78 mr r8,r10 ; arg 5 | |
| 92 108: 7c 09 03 78 mr r9,r0 ; arg 6 | |
| 93 10c: 48 00 00 01 bl 10c <.nonleaf_call+0xc0> ; call and put return address -> lr | |
| 94 110: e8 21 00 00 ld r1,0(r1) ; | | |
| 95 114: e8 01 00 10 ld r0,16(r1) ; | | |
| 96 118: 7c 08 03 a6 mtlr r0 ; | epilog | |
| 97 11c: eb e1 ff f8 ld r31,-8(r1) ; | | |
| 98 120: 4e 80 00 20 blr ; | | |
| 99 124: 00 00 00 00 .long 0x0 ; data | |
| 100 128: 00 00 00 01 .long 0x1 ; data | |
| 101 12c: 80 01 00 01 lwz r0,1(r1) ; unsure@@@. data? | |
|
327
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
102 |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
103 0000000000000130 <.main>: |
| 331 | 104 130: 7c 08 02 a6 mflr r0 ; | lr -> gpr0 |
| 105 134: fb e1 ff f8 std r31,-8(r1) ; | preseve gpr31 (as used in func as helper addr) | |
| 106 138: f8 01 00 10 std r0,16(r1) ; | prolog store lr | |
| 107 13c: f8 21 ff 81 stdu r1,-128(r1) ; | open frame | |
| 108 140: 7c 3f 0b 78 mr r31,r1 ; use gpr31 as sort of frame pointer, below | |
| 109 144: 38 60 00 00 li r3,0 ; arg 0 | |
| 110 148: 38 80 00 01 li r4,1 ; arg 1 | |
| 111 14c: 38 a0 00 02 li r5,2 ; arg 2 | |
| 112 150: 38 c0 00 03 li r6,3 ; arg 3 | |
| 113 154: 38 e0 00 04 li r7,4 ; arg 4 | |
| 114 158: 39 00 00 05 li r8,5 ; arg 5 | |
| 115 15c: 39 20 00 06 li r9,6 ; arg 6 | |
| 116 160: 39 40 00 07 li r10,7 ; arg 7 | |
| 117 164: 48 00 00 01 bl 164 <.main+0x34> ; call and put return address -> lr | |
| 118 168: 38 00 00 00 li r0,0 ; return value ... | |
| 119 16c: 7c 03 03 78 mr r3,r0 ; ... in gpr3 | |
| 120 170: e8 21 00 00 ld r1,0(r1) ; | | |
| 121 174: e8 01 00 10 ld r0,16(r1) ; | | |
| 122 178: 7c 08 03 a6 mtlr r0 ; | epilog | |
| 123 17c: eb e1 ff f8 ld r31,-8(r1) ; | | |
| 124 180: 4e 80 00 20 blr ; | | |
| 125 184: 00 00 00 00 .long 0x0 ; data | |
| 126 188: 00 00 00 01 .long 0x1 ; data | |
| 127 18c: 80 01 00 01 lwz r0,1(r1) ; unsure@@@. data? | |
| 128 | |
| 129 | |
| 130 | |
| 131 ; ------------- ints and floats, var args, struct return value (meaning implicit first param), more than 8 params (11, with implicit return value ptr) -----------> | |
| 132 | |
| 133 ; #include <stdlib.h> | |
| 134 ; #include <stdarg.h> | |
| 135 ; | |
| 136 ; void leaf_call(int b, float c, int d, float e, int f, float g, float h, int i, float j) | |
| 137 ; { | |
| 138 ; } | |
| 139 ; | |
| 140 ; struct aggr { int x; int y; int z; }; | |
| 141 ; | |
| 142 ; struct aggr nonleaf_call(int a, int b, float c, int d, float e, int f, ...) | |
| 143 ; { | |
| 144 ; va_list v; | |
| 145 ; int i; | |
| 146 ; float g, h, j; | |
| 147 ; struct aggr st = { b, d, f }; | |
| 148 ; va_start(v, f); | |
| 149 ; g = va_arg(v, float); | |
| 150 ; h = va_arg(v, float); | |
| 151 ; i = va_arg(v, int); | |
| 152 ; h = va_arg(v, float); | |
| 153 ; /* use some local data */ | |
| 154 ; *(char*)alloca(220) = 'L'; | |
| 155 ; leaf_call(b, c, d, e, f, g, h, i, j); | |
| 156 ; | |
| 157 ; return st; | |
| 158 ; } | |
| 159 ; | |
| 160 ; int main() | |
| 161 ; { | |
| 162 ; struct aggr st = nonleaf_call(0, 1, 2.f, 3, 4.f, 5, 6.f, 7.f, 8, 9.f); | |
| 163 ; return 0; | |
| 164 ; } | |
| 165 | |
| 166 | |
| 167 | |
| 168 ; output from freebsd-11.0-ppc64 w/ gcc 4.2.1 | |
| 169 | |
| 170 0000000000000000 <.leaf_call>: | |
| 171 0: fb e1 ff f8 std r31,-8(r1) | |
| 172 4: f8 21 ff c1 stdu r1,-64(r1) | |
| 173 8: 7c 3f 0b 78 mr r31,r1 | |
| 174 c: 7c 69 1b 78 mr r9,r3 | |
| 175 10: d0 3f 00 78 stfs f1,120(r31) | |
| 176 14: 7c ab 2b 78 mr r11,r5 | |
| 177 18: d0 5f 00 88 stfs f2,136(r31) | |
| 178 1c: 7c e8 3b 78 mr r8,r7 | |
| 179 20: d0 7f 00 98 stfs f3,152(r31) | |
| 180 24: d0 9f 00 a0 stfs f4,160(r31) | |
| 181 28: 7d 40 53 78 mr r0,r10 | |
| 182 2c: d0 bf 00 b0 stfs f5,176(r31) | |
| 183 30: 91 3f 00 70 stw r9,112(r31) | |
| 184 34: 91 7f 00 80 stw r11,128(r31) | |
| 185 38: 91 1f 00 90 stw r8,144(r31) | |
| 186 3c: 90 1f 00 a8 stw r0,168(r31) | |
| 187 40: e8 21 00 00 ld r1,0(r1) | |
| 188 44: eb e1 ff f8 ld r31,-8(r1) | |
| 189 48: 4e 80 00 20 blr | |
| 190 ... | |
| 191 54: 80 01 00 01 lwz r0,1(r1) | |
| 192 | |
| 193 0000000000000058 <.nonleaf_call>: | |
| 194 58: fb e1 ff f8 std r31,-8(r1) ; | | |
| 195 5c: f8 21 ff 91 stdu r1,-112(r1) ; | prolog | |
| 196 60: 7c 3f 0b 78 mr r31,r1 ; use gpr31 as sort of frame pointer, below | |
| 197 64: 7c 8b 23 78 mr r11,r4 ; in arg 1 (first explicit arg, b/c of struct return value ptr being arg0) -> r11 | |
| 198 68: 7c a8 2b 78 mr r8,r5 ; in arg 2 -> r8 (free reg, was skipped for float param) | |
| 199 6c: d0 3f 00 b8 stfs f1,184(r31) ; | in arg 3 (float) -> prev frame's spill area: 184 = 112 (frame) + 48 (prev frame's linkage area) + 8 (arg 0 = return value ptr) + 16 (first two explicit args) | |
| 200 70: d0 5f 00 c8 stfs f2,200(r31) ; | in arg 5 (float) -> prev frame's spill area | |
| 201 74: f9 5f 00 d8 std r10,216(r31) ; | in arg 7 (float, also held in gpr reg b/c vararg) -> prev frame's spill area | |
| 202 78: 7d 20 4b 78 mr r0,r9 ; | spilling in arg 6 in gpr0 (spilled below) | |
| 203 7c: 91 7f 00 a8 stw r11,168(r31) ; | in arg 1 (int) -> prev frame's spill area | |
| 204 80: 91 1f 00 b0 stw r8,176(r31) ; | in arg 2 (int) -> prev frame's spill area | |
| 205 84: 90 ff 00 c0 stw r7,192(r31) ; | in arg 4 (int) -> prev frame's spill area | |
| 206 88: 90 1f 00 d0 stw r0,208(r31) ; / in arg 6 (int) -> prev frame's spill area | |
| 207 8c: 80 1f 00 b0 lwz r0,176(r31) ; \ | |
| 208 90: 90 1f 00 48 stw r0,72(r31) ; | | |
| 209 94: 80 1f 00 c0 lwz r0,192(r31) ; | | |
| 210 98: 90 1f 00 4c stw r0,76(r31) ; | filling struct with 3 int input args | |
| 211 9c: 80 1f 00 d0 lwz r0,208(r31) ; | | |
| 212 a0: 90 1f 00 50 stw r0,80(r31) ; | | |
| 213 a4: 38 1f 00 d8 addi r0,r31,216 ; | |
| 214 a8: f8 1f 00 40 std r0,64(r31) ; . | |
| 215 ac: 7f e0 00 08 trap ; . | |
| 216 ... ; . | |
| 217 b8: 80 01 00 01 lwz r0,1(r1) ; | |
| 218 | |
| 219 00000000000000bc <.main>: | |
| 220 bc: 7c 08 02 a6 mflr r0 ; | lr -> gpr0 | |
| 221 c0: fb e1 ff f8 std r31,-8(r1) ; | preseve gpr31 (as used in func as helper addr) | |
| 222 c4: f8 01 00 10 std r0,16(r1) ; | prolog store lr | |
| 223 c8: f8 21 ff 41 stdu r1,-192(r1) ; | open frame | |
| 224 cc: 7c 3f 0b 78 mr r31,r1 ; use gpr31 as sort of frame pointer, below | |
| 225 d0: 39 61 00 30 addi r11,r1,48 ; ptr to param area -> r11 | |
| 226 d4: e9 22 00 00 ld r9,0(r2) ; prep arg 3 (=explicit arg 2, b/c of implicit return value pointer), ... | |
| 227 d8: c1 a9 00 00 lfs f13,0(r9) ; ... load from static data -> f13 | |
| 228 dc: e9 22 00 08 ld r9,8(r2) ; prep arg 5, ... | |
| 229 e0: c1 89 00 00 lfs f12,0(r9) ; ... load from static data -> f12 | |
| 230 e4: e9 22 00 10 ld r9,16(r2) ; prep arg 7, ... | |
| 231 e8: c8 09 00 00 lfd f0,0(r9) ; ... load from static data -> f0 | |
| 232 ec: d8 1f 00 a0 stfd f0,160(r31) ; | | |
| 233 f0: e8 1f 00 a0 ld r0,160(r31) ; | | |
| 234 f4: 7c 09 03 78 mr r9,r0 ; | also hold it in f11 (temporarily, before copying to fpr3 below) | |
| 235 f8: 7d 2a 4b 78 mr r10,r9 ; | and gpr10 (instead of skipping that int reg, for straightforward spilling) | |
| 236 fc: f8 1f 00 a0 std r0,160(r31) ; | (uses temp space to copy between fpr and gpr regs) | |
| 237 100: c8 1f 00 a0 lfd f0,160(r31) ; | | |
| 238 104: fd 60 00 90 fmr f11,f0 ; | | |
| 239 108: e9 22 00 18 ld r9,24(r2) ; prep arg 8, ... | |
| 240 10c: c8 09 00 00 lfd f0,0(r9) ; ... load from static data -> fpr0, and ... | |
| 241 110: d8 0b 00 40 stfd f0,64(r11) ; ... "pushed" onto stack (in param area past spill area) and ... | |
| 242 114: c9 4b 00 40 lfd f10,64(r11) ; ... also held in f10 (prep, see where it's used below) | |
| 243 118: 38 00 00 08 li r0,8 ; arg 9, ... | |
| 244 11c: f8 0b 00 48 std r0,72(r11) ; ... "pushed" onto stack | |
| 245 120: e9 22 00 20 ld r9,32(r2) ; arg 10 (float, promoted to double), ... | |
| 246 124: c8 09 00 00 lfd f0,0(r9) ; ... load from static data -> fpr0, and ... | |
| 247 128: d8 0b 00 50 stfd f0,80(r11) ; ... "pushed" onto stack | |
| 248 12c: c8 0b 00 50 lfd f0,80(r11) ; ... also held in f0 (prep, see where it's used below), in theory pointless reload of arg10 -> fpr0 | |
| 249 130: 38 1f 00 90 addi r0,r31,144 ; ptr to return value struct in local space -> gpr0 | |
| 250 134: 7c 03 03 78 mr r3,r0 ; arg 0 (this is the pointer to the struct return value) | |
| 251 138: 38 80 00 00 li r4,0 ; arg 1 | |
| 252 13c: 38 a0 00 01 li r5,1 ; arg 2 | |
| 253 140: fc 20 68 90 fmr f1,f13 ; arg 3 (float, in 1st double reg) | |
| 254 144: 38 e0 00 03 li r7,3 ; arg 4 (skipping gpr6 b/c of float arg) | |
| 255 148: fc 40 60 90 fmr f2,f12 ; arg 5 (float, in 2nd double reg) | |
| 256 14c: 39 20 00 05 li r9,5 ; arg 6 (skipping gpr8 b/c of float arg, vararg) | |
| 257 150: fc 60 58 90 fmr f3,f11 ; arg 7 (float, in 3rd double reg, promoted to double anyways b/c vararg) | |
| 258 154: fc 80 50 90 fmr f4,f10 ; arg 8 (float, in 4th double reg, promoted to double anyways b/c vararg) | |
| 259 158: fc a0 00 90 fmr f5,f0 ; arg 10 (float, in 5th double reg, promoted to double anyways b/c vararg) | |
| 260 15c: 48 00 00 01 bl 15c <.main+0xa0> ; call and put return address -> lr | |
| 261 160: 38 00 00 00 li r0,0 ; return value ... | |
| 262 164: 7c 03 03 78 mr r3,r0 ; ... in gpr3 | |
| 263 168: e8 21 00 00 ld r1,0(r1) ; | | |
| 264 16c: e8 01 00 10 ld r0,16(r1) ; | | |
| 265 170: 7c 08 03 a6 mtlr r0 ; | epilog | |
| 266 174: eb e1 ff f8 ld r31,-8(r1) ; | | |
| 267 178: 4e 80 00 20 blr ; | | |
| 268 17c: 00 00 00 00 .long 0x0 ; data | |
| 269 180: 00 00 00 01 .long 0x1 ; data | |
| 270 184: 80 01 00 01 lwz r0,1(r1) ; unsure@@@. data? | |
|
327
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
271 |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
272 ; vim: ft=asm |
|
c0390dc85a07
- doc: added disassembly examples for many platforms and calling conventions, for reference
Tassilo Philipp
parents:
diff
changeset
|
273 |
