Mercurial > pub > dyncall > dyncall
annotate doc/disas_examples/x86.stdcall.disas @ 498:fd9ba3a6d348
- corrections in tool usage in lastly added disas_examples
author | Tassilo Philipp |
---|---|
date | Wed, 23 Mar 2022 15:33:09 +0100 |
parents | cb19b2fe2422 |
children | fc614cb865c6 |
rev | line source |
---|---|
471 | 1 ; #include <stdlib.h> |
2 ; | |
3 ; void __stdcall leaf_call(int b, int c, int d, int e, int f, int g, int h) | |
4 ; { | |
5 ; } | |
6 ; | |
7 ; void __stdcall 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 godbolt compiler explorer w/ msvc 19.14 (w/ /GS- for simplicity) | |
23 | |
24 _leaf_call@28 PROC | |
25 push ebp | |
26 mov ebp, esp | |
27 pop ebp | |
28 ret 28 | |
29 _leaf_call@28 ENDP | |
30 | |
31 _b$ = 12 | |
32 _c$ = 16 | |
33 _d$ = 20 | |
34 _e$ = 24 | |
35 _f$ = 28 | |
36 _g$ = 32 | |
37 _h$ = 36 | |
38 _nonleaf_call@32 PROC | |
39 push ebp | |
40 mov ebp, esp | |
41 push 220 | |
42 call _alloca | |
43 add esp, 4 | |
44 mov BYTE PTR [eax], 76 | |
45 mov eax, DWORD PTR _h$[ebp] | |
46 push eax | |
47 mov ecx, DWORD PTR _g$[ebp] | |
48 push ecx | |
49 mov edx, DWORD PTR _f$[ebp] | |
50 push edx | |
51 mov eax, DWORD PTR _e$[ebp] | |
52 push eax | |
53 mov ecx, DWORD PTR _d$[ebp] | |
54 push ecx | |
55 mov edx, DWORD PTR _c$[ebp] | |
56 push edx | |
57 mov eax, DWORD PTR _b$[ebp] | |
58 push eax | |
59 call _leaf_call@28 | |
60 pop ebp | |
61 ret 32 | |
62 _nonleaf_call@32 ENDP | |
63 | |
64 _main PROC | |
65 push ebp | |
66 mov ebp, esp | |
67 push 7 | |
68 push 6 | |
69 push 5 | |
70 push 4 | |
71 push 3 | |
72 push 2 | |
73 push 1 | |
74 push 0 | |
75 call _nonleaf_call@32 | |
76 xor eax, eax | |
77 pop ebp | |
78 ret 0 | |
79 _main ENDP | |
80 | |
81 | |
82 | |
83 ; ---------- structs by value, struct in first call on reg arg boundary ----------> | |
84 ; | |
85 ; struct A { int x; short y; char z; long long t; }; | |
86 ; | |
87 ; struct A __stdcall leaf_call(struct A a, short b, long long c, char d, int e, int f, int g, long long h) | |
88 ; { | |
89 ; a.x += 1; | |
90 ; return a; | |
91 ; } | |
92 ; | |
93 ; int main() | |
94 ; { | |
95 ; struct A a = {9, 99, 23, 12LL}; | |
96 ; leaf_call(a, 1, 2, 3, 4, 5, 6, 7LL); | |
97 ; return 0; | |
98 ; } | |
99 | |
100 | |
101 | |
102 ; output from godbolt compiler explorer w/ msvc 19.14 (w/ /GS- for simplicity) | |
103 | |
104 $T1 = 8 | |
105 _a$ = 12 | |
106 _leaf_call@52 PROC | |
107 push ebp ; | prolog | |
108 mov ebp, esp ; / | |
109 mov eax, DWORD PTR _a$[ebp] ; \ | |
110 add eax, 1 ; | get struct's x (from stack args), add 1 and write back | |
111 mov DWORD PTR _a$[ebp], eax ; / | |
112 mov ecx, DWORD PTR $T1[ebp] ; get ptr to retval struct passed as hidden arg (+8 to skip retval and saved ebp) | |
113 mov edx, DWORD PTR _a$[ebp] ; | | |
114 mov DWORD PTR [ecx], edx ; | | |
115 mov eax, DWORD PTR _a$[ebp+4] ; | | |
116 mov DWORD PTR [ecx+4], eax ; | copy modified (b/c of x+=1) struct arg to space of retval | |
117 mov edx, DWORD PTR _a$[ebp+8] ; | | |
118 mov DWORD PTR [ecx+8], edx ; | | |
119 mov eax, DWORD PTR _a$[ebp+12] ; | | |
120 mov DWORD PTR [ecx+12], eax ; | | |
121 mov eax, DWORD PTR $T1[ebp] ; return value (= ptr to struct that was passed-in as hidden arg) | |
122 pop ebp ; | | |
123 ret 56 ; | epilog (56 = stack cleanup of stdcall) | |
124 _leaf_call@52 ENDP | |
125 | |
126 $T1 = -32 | |
127 _a$ = -16 | |
128 _main PROC | |
129 push ebp ; | | |
130 mov ebp, esp ; | prolog | |
131 sub esp, 32 ; / 32 = 16b local area for struct + 16b space used for retval struct | |
132 mov DWORD PTR _a$[ebp], 9 ; \ int x | |
133 mov eax, 99 ; | | | |
134 mov WORD PTR _a$[ebp+4], ax ; | struct values (local area) | short y | |
135 mov BYTE PTR _a$[ebp+6], 23 ; | char z | |
136 mov DWORD PTR _a$[ebp+8], 12 ; | | | |
137 mov DWORD PTR _a$[ebp+12], 0 ; / | long long t | |
138 push 0 ; \ | |
139 push 7 ; | arg 7 | |
140 push 6 ; arg 6 | |
141 push 5 ; arg 5 | |
142 push 4 ; arg 4 | |
143 push 3 ; arg 3 | |
144 push 0 ; | | |
145 push 2 ; arg 2 | |
146 push 1 ; arg 1 | |
147 sub esp, 16 ; | | |
148 mov ecx, esp ; | | |
149 mov edx, DWORD PTR _a$[ebp] ; | | |
150 mov DWORD PTR [ecx], edx ; | | |
151 mov eax, DWORD PTR _a$[ebp+4] ; | | |
152 mov DWORD PTR [ecx+4], eax ; | arg 0 (struct), "pushed" onto stack (fetched from local area) | |
153 mov edx, DWORD PTR _a$[ebp+8] ; | | |
154 mov DWORD PTR [ecx+8], edx ; | | |
155 mov eax, DWORD PTR _a$[ebp+12] ; | | |
156 mov DWORD PTR [ecx+12], eax ; / | |
157 lea ecx, DWORD PTR $T1[ebp] ; \ ptr to space used for struct retval (pushed as hidden first arg) | |
158 push ecx ; | | |
159 call _leaf_call@52 ; push return address and call | |
160 ; (note: cdecl would clean up stack, here) | |
161 xor eax, eax ; return value | |
162 mov esp, ebp ; | | |
163 pop ebp ; | epilog | |
164 ret 0 ; | | |
165 _main ENDP | |
166 | |
167 | |
168 | |
497
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
169 ; ---------- C++ trivial and non-trivial aggrs passed to C funcs ----------> |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
170 ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
171 ; struct Trivial { int a; }; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
172 ; struct NonTrivial { |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
173 ; int a; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
174 ; __attribute__((stdcall)) NonTrivial() : a(0) {} |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
175 ; __attribute__((stdcall)) NonTrivial(const NonTrivial& rhs) : a(rhs.a) { } |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
176 ; }; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
177 ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
178 ; extern "C" { |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
179 ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
180 ; void __attribute__((stdcall)) f1(struct Trivial s) { } |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
181 ; void __attribute__((stdcall)) f2(struct NonTrivial s) { } |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
182 ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
183 ; void __attribute__((stdcall)) f() |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
184 ; { |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
185 ; struct Trivial t; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
186 ; struct NonTrivial n; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
187 ; int a=1; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
188 ; a += 123; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
189 ; f1(t); |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
190 ; a -= 123; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
191 ; f2(n); |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
192 ; a -= 12; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
193 ; } |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
194 ; } |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
195 |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
196 |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
197 |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
198 ; output from alpine_linux-3.11.3-x86 w/ gcc 9.2.0 |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
199 |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
200 00001215 <f1>: |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
201 1215: 55 push %ebp |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
202 1216: 89 e5 mov %esp,%ebp |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
203 1218: e8 f0 ff ff ff call 120d <__x86.get_pc_thunk.ax> |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
204 121d: 05 af 2d 00 00 add $0x2daf,%eax |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
205 1222: 90 nop |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
206 1223: 5d pop %ebp |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
207 1224: c2 04 00 ret $0x4 |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
208 |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
209 00001227 <f2>: |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
210 1227: 55 push %ebp |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
211 1228: 89 e5 mov %esp,%ebp |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
212 122a: e8 de ff ff ff call 120d <__x86.get_pc_thunk.ax> |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
213 122f: 05 9d 2d 00 00 add $0x2d9d,%eax |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
214 1234: 90 nop |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
215 1235: 5d pop %ebp |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
216 1236: c2 04 00 ret $0x4 |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
217 |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
218 00001239 <f>: |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
219 1239: 55 push %ebp ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
220 123a: 89 e5 mov %esp,%ebp ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
221 123c: 83 ec 28 sub $0x28,%esp ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
222 123f: e8 c9 ff ff ff call 120d <__x86.get_pc_thunk.ax> ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
223 1244: 05 88 2d 00 00 add $0x2d88,%eax ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
224 1249: 65 a1 14 00 00 00 mov %gs:0x14,%eax ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
225 124f: 89 45 f4 mov %eax,-0xc(%ebp) ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
226 1252: 31 c0 xor %eax,%eax ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
227 1254: 83 ec 0c sub $0xc,%esp ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
228 1257: 8d 45 e8 lea -0x18(%ebp),%eax ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
229 125a: 50 push %eax ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
230 125b: e8 6e 00 00 00 call 12ce <_ZN10NonTrivialC1Ev> ; NonTrivial::NonTrivial() / ctor |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
231 1260: 83 c4 0c add $0xc,%esp ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
232 1263: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
233 126a: 83 45 f0 7b addl $0x7b,-0x10(%ebp) ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
234 126e: 83 ec 0c sub $0xc,%esp ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
235 1271: ff 75 e4 pushl -0x1c(%ebp) ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
236 1274: e8 9c ff ff ff call 1215 <f1> ; call f1(struct Trivial) |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
237 1279: 83 c4 0c add $0xc,%esp ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
238 127c: 83 6d f0 7b subl $0x7b,-0x10(%ebp) ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
239 1280: 83 ec 08 sub $0x8,%esp ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
240 1283: 8d 45 e8 lea -0x18(%ebp),%eax ; | | ptr to n |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
241 1286: 50 push %eax ; | / |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
242 1287: 8d 45 ec lea -0x14(%ebp),%eax ; | \ |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
243 128a: 50 push %eax ; | copy n | ptr to dest of copy of n |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
244 128b: e8 5a 00 00 00 call 12ea <_ZN10NonTrivialC1ERKS_> ; | NonTrivial::NonTrivial(const NonTrivial&) / copy ctor |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
245 1290: 83 c4 08 add $0x8,%esp ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
246 1293: 83 ec 0c sub $0xc,%esp ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
247 1296: 8d 45 ec lea -0x14(%ebp),%eax ; | |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
248 1299: 50 push %eax ; | f2 arg 0 (ptr to copy of struct NonTrivial), via ptr as non-trivial |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
249 129a: e8 88 ff ff ff call 1227 <f2> ; call f2(struct NonTrivial) |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
250 129f: 83 c4 0c add $0xc,%esp ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
251 12a2: 83 6d f0 0c subl $0xc,-0x10(%ebp) ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
252 12a6: 90 nop ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
253 12a7: 8b 45 f4 mov -0xc(%ebp),%eax ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
254 12aa: 65 33 05 14 00 00 00 xor %gs:0x14,%eax ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
255 12b1: 74 05 je 12b8 <f+0x7f> ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
256 12b3: e8 4e 00 00 00 call 1306 <__stack_chk_fail_local> ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
257 12b8: c9 leave ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
258 12b9: c3 ret ; |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
259 |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
260 ; ... snip, removed code of ctor and copy ctor ... |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
261 |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
262 |
cb19b2fe2422
- more disas examples to check behaviour of passing C++ non-trivial aggregates by value; they all behave the same, calling the copy ctor first, passing a pointer then
Tassilo Philipp
parents:
471
diff
changeset
|
263 |
471 | 264 ; vim: ft=asm |
265 |