annotate doc/disas_examples/x86.stdcall.disas @ 499:fc614cb865c6

- doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
author Tassilo Philipp
date Mon, 04 Apr 2022 15:50:52 +0200
parents cb19b2fe2422
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
471
Tassilo Philipp
parents:
diff changeset
1 ; #include <stdlib.h>
Tassilo Philipp
parents:
diff changeset
2 ;
Tassilo Philipp
parents:
diff changeset
3 ; void __stdcall leaf_call(int b, int c, int d, int e, int f, int g, int h)
Tassilo Philipp
parents:
diff changeset
4 ; {
Tassilo Philipp
parents:
diff changeset
5 ; }
Tassilo Philipp
parents:
diff changeset
6 ;
Tassilo Philipp
parents:
diff changeset
7 ; void __stdcall nonleaf_call(int a, int b, int c, int d, int e, int f, int g, int h)
Tassilo Philipp
parents:
diff changeset
8 ; {
Tassilo Philipp
parents:
diff changeset
9 ; /* use some local data */
Tassilo Philipp
parents:
diff changeset
10 ; *(char*)alloca(220) = 'L';
Tassilo Philipp
parents:
diff changeset
11 ; leaf_call(b, c, d, e, f, g, h);
Tassilo Philipp
parents:
diff changeset
12 ; }
Tassilo Philipp
parents:
diff changeset
13 ;
Tassilo Philipp
parents:
diff changeset
14 ; int main()
Tassilo Philipp
parents:
diff changeset
15 ; {
Tassilo Philipp
parents:
diff changeset
16 ; nonleaf_call(0, 1, 2, 3, 4, 5, 6, 7);
Tassilo Philipp
parents:
diff changeset
17 ; return 0;
Tassilo Philipp
parents:
diff changeset
18 ; }
Tassilo Philipp
parents:
diff changeset
19
Tassilo Philipp
parents:
diff changeset
20
Tassilo Philipp
parents:
diff changeset
21
Tassilo Philipp
parents:
diff changeset
22 ; output from godbolt compiler explorer w/ msvc 19.14 (w/ /GS- for simplicity)
Tassilo Philipp
parents:
diff changeset
23
Tassilo Philipp
parents:
diff changeset
24 _leaf_call@28 PROC
Tassilo Philipp
parents:
diff changeset
25 push ebp
Tassilo Philipp
parents:
diff changeset
26 mov ebp, esp
Tassilo Philipp
parents:
diff changeset
27 pop ebp
Tassilo Philipp
parents:
diff changeset
28 ret 28
Tassilo Philipp
parents:
diff changeset
29 _leaf_call@28 ENDP
Tassilo Philipp
parents:
diff changeset
30
Tassilo Philipp
parents:
diff changeset
31 _b$ = 12
Tassilo Philipp
parents:
diff changeset
32 _c$ = 16
Tassilo Philipp
parents:
diff changeset
33 _d$ = 20
Tassilo Philipp
parents:
diff changeset
34 _e$ = 24
Tassilo Philipp
parents:
diff changeset
35 _f$ = 28
Tassilo Philipp
parents:
diff changeset
36 _g$ = 32
Tassilo Philipp
parents:
diff changeset
37 _h$ = 36
Tassilo Philipp
parents:
diff changeset
38 _nonleaf_call@32 PROC
Tassilo Philipp
parents:
diff changeset
39 push ebp
Tassilo Philipp
parents:
diff changeset
40 mov ebp, esp
Tassilo Philipp
parents:
diff changeset
41 push 220
Tassilo Philipp
parents:
diff changeset
42 call _alloca
Tassilo Philipp
parents:
diff changeset
43 add esp, 4
Tassilo Philipp
parents:
diff changeset
44 mov BYTE PTR [eax], 76
Tassilo Philipp
parents:
diff changeset
45 mov eax, DWORD PTR _h$[ebp]
Tassilo Philipp
parents:
diff changeset
46 push eax
Tassilo Philipp
parents:
diff changeset
47 mov ecx, DWORD PTR _g$[ebp]
Tassilo Philipp
parents:
diff changeset
48 push ecx
Tassilo Philipp
parents:
diff changeset
49 mov edx, DWORD PTR _f$[ebp]
Tassilo Philipp
parents:
diff changeset
50 push edx
Tassilo Philipp
parents:
diff changeset
51 mov eax, DWORD PTR _e$[ebp]
Tassilo Philipp
parents:
diff changeset
52 push eax
Tassilo Philipp
parents:
diff changeset
53 mov ecx, DWORD PTR _d$[ebp]
Tassilo Philipp
parents:
diff changeset
54 push ecx
Tassilo Philipp
parents:
diff changeset
55 mov edx, DWORD PTR _c$[ebp]
Tassilo Philipp
parents:
diff changeset
56 push edx
Tassilo Philipp
parents:
diff changeset
57 mov eax, DWORD PTR _b$[ebp]
Tassilo Philipp
parents:
diff changeset
58 push eax
Tassilo Philipp
parents:
diff changeset
59 call _leaf_call@28
Tassilo Philipp
parents:
diff changeset
60 pop ebp
Tassilo Philipp
parents:
diff changeset
61 ret 32
Tassilo Philipp
parents:
diff changeset
62 _nonleaf_call@32 ENDP
Tassilo Philipp
parents:
diff changeset
63
Tassilo Philipp
parents:
diff changeset
64 _main PROC
Tassilo Philipp
parents:
diff changeset
65 push ebp
Tassilo Philipp
parents:
diff changeset
66 mov ebp, esp
Tassilo Philipp
parents:
diff changeset
67 push 7
Tassilo Philipp
parents:
diff changeset
68 push 6
Tassilo Philipp
parents:
diff changeset
69 push 5
Tassilo Philipp
parents:
diff changeset
70 push 4
Tassilo Philipp
parents:
diff changeset
71 push 3
Tassilo Philipp
parents:
diff changeset
72 push 2
Tassilo Philipp
parents:
diff changeset
73 push 1
Tassilo Philipp
parents:
diff changeset
74 push 0
Tassilo Philipp
parents:
diff changeset
75 call _nonleaf_call@32
Tassilo Philipp
parents:
diff changeset
76 xor eax, eax
Tassilo Philipp
parents:
diff changeset
77 pop ebp
Tassilo Philipp
parents:
diff changeset
78 ret 0
Tassilo Philipp
parents:
diff changeset
79 _main ENDP
Tassilo Philipp
parents:
diff changeset
80
Tassilo Philipp
parents:
diff changeset
81
Tassilo Philipp
parents:
diff changeset
82
Tassilo Philipp
parents:
diff changeset
83 ; ---------- structs by value, struct in first call on reg arg boundary ---------->
Tassilo Philipp
parents:
diff changeset
84 ;
Tassilo Philipp
parents:
diff changeset
85 ; struct A { int x; short y; char z; long long t; };
Tassilo Philipp
parents:
diff changeset
86 ;
Tassilo Philipp
parents:
diff changeset
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)
Tassilo Philipp
parents:
diff changeset
88 ; {
Tassilo Philipp
parents:
diff changeset
89 ; a.x += 1;
Tassilo Philipp
parents:
diff changeset
90 ; return a;
Tassilo Philipp
parents:
diff changeset
91 ; }
Tassilo Philipp
parents:
diff changeset
92 ;
Tassilo Philipp
parents:
diff changeset
93 ; int main()
Tassilo Philipp
parents:
diff changeset
94 ; {
Tassilo Philipp
parents:
diff changeset
95 ; struct A a = {9, 99, 23, 12LL};
Tassilo Philipp
parents:
diff changeset
96 ; leaf_call(a, 1, 2, 3, 4, 5, 6, 7LL);
Tassilo Philipp
parents:
diff changeset
97 ; return 0;
Tassilo Philipp
parents:
diff changeset
98 ; }
Tassilo Philipp
parents:
diff changeset
99
Tassilo Philipp
parents:
diff changeset
100
Tassilo Philipp
parents:
diff changeset
101
Tassilo Philipp
parents:
diff changeset
102 ; output from godbolt compiler explorer w/ msvc 19.14 (w/ /GS- for simplicity)
Tassilo Philipp
parents:
diff changeset
103
Tassilo Philipp
parents:
diff changeset
104 $T1 = 8
Tassilo Philipp
parents:
diff changeset
105 _a$ = 12
Tassilo Philipp
parents:
diff changeset
106 _leaf_call@52 PROC
Tassilo Philipp
parents:
diff changeset
107 push ebp ; | prolog
Tassilo Philipp
parents:
diff changeset
108 mov ebp, esp ; /
Tassilo Philipp
parents:
diff changeset
109 mov eax, DWORD PTR _a$[ebp] ; \
Tassilo Philipp
parents:
diff changeset
110 add eax, 1 ; | get struct's x (from stack args), add 1 and write back
Tassilo Philipp
parents:
diff changeset
111 mov DWORD PTR _a$[ebp], eax ; /
Tassilo Philipp
parents:
diff changeset
112 mov ecx, DWORD PTR $T1[ebp] ; get ptr to retval struct passed as hidden arg (+8 to skip retval and saved ebp)
Tassilo Philipp
parents:
diff changeset
113 mov edx, DWORD PTR _a$[ebp] ; |
Tassilo Philipp
parents:
diff changeset
114 mov DWORD PTR [ecx], edx ; |
Tassilo Philipp
parents:
diff changeset
115 mov eax, DWORD PTR _a$[ebp+4] ; |
Tassilo Philipp
parents:
diff changeset
116 mov DWORD PTR [ecx+4], eax ; | copy modified (b/c of x+=1) struct arg to space of retval
Tassilo Philipp
parents:
diff changeset
117 mov edx, DWORD PTR _a$[ebp+8] ; |
Tassilo Philipp
parents:
diff changeset
118 mov DWORD PTR [ecx+8], edx ; |
Tassilo Philipp
parents:
diff changeset
119 mov eax, DWORD PTR _a$[ebp+12] ; |
Tassilo Philipp
parents:
diff changeset
120 mov DWORD PTR [ecx+12], eax ; |
Tassilo Philipp
parents:
diff changeset
121 mov eax, DWORD PTR $T1[ebp] ; return value (= ptr to struct that was passed-in as hidden arg)
Tassilo Philipp
parents:
diff changeset
122 pop ebp ; |
Tassilo Philipp
parents:
diff changeset
123 ret 56 ; | epilog (56 = stack cleanup of stdcall)
Tassilo Philipp
parents:
diff changeset
124 _leaf_call@52 ENDP
Tassilo Philipp
parents:
diff changeset
125
Tassilo Philipp
parents:
diff changeset
126 $T1 = -32
Tassilo Philipp
parents:
diff changeset
127 _a$ = -16
Tassilo Philipp
parents:
diff changeset
128 _main PROC
Tassilo Philipp
parents:
diff changeset
129 push ebp ; |
Tassilo Philipp
parents:
diff changeset
130 mov ebp, esp ; | prolog
Tassilo Philipp
parents:
diff changeset
131 sub esp, 32 ; / 32 = 16b local area for struct + 16b space used for retval struct
Tassilo Philipp
parents:
diff changeset
132 mov DWORD PTR _a$[ebp], 9 ; \ int x
Tassilo Philipp
parents:
diff changeset
133 mov eax, 99 ; | |
Tassilo Philipp
parents:
diff changeset
134 mov WORD PTR _a$[ebp+4], ax ; | struct values (local area) | short y
Tassilo Philipp
parents:
diff changeset
135 mov BYTE PTR _a$[ebp+6], 23 ; | char z
Tassilo Philipp
parents:
diff changeset
136 mov DWORD PTR _a$[ebp+8], 12 ; | |
Tassilo Philipp
parents:
diff changeset
137 mov DWORD PTR _a$[ebp+12], 0 ; / | long long t
Tassilo Philipp
parents:
diff changeset
138 push 0 ; \
Tassilo Philipp
parents:
diff changeset
139 push 7 ; | arg 7
Tassilo Philipp
parents:
diff changeset
140 push 6 ; arg 6
Tassilo Philipp
parents:
diff changeset
141 push 5 ; arg 5
Tassilo Philipp
parents:
diff changeset
142 push 4 ; arg 4
Tassilo Philipp
parents:
diff changeset
143 push 3 ; arg 3
Tassilo Philipp
parents:
diff changeset
144 push 0 ; |
Tassilo Philipp
parents:
diff changeset
145 push 2 ; arg 2
Tassilo Philipp
parents:
diff changeset
146 push 1 ; arg 1
Tassilo Philipp
parents:
diff changeset
147 sub esp, 16 ; |
Tassilo Philipp
parents:
diff changeset
148 mov ecx, esp ; |
Tassilo Philipp
parents:
diff changeset
149 mov edx, DWORD PTR _a$[ebp] ; |
Tassilo Philipp
parents:
diff changeset
150 mov DWORD PTR [ecx], edx ; |
Tassilo Philipp
parents:
diff changeset
151 mov eax, DWORD PTR _a$[ebp+4] ; |
Tassilo Philipp
parents:
diff changeset
152 mov DWORD PTR [ecx+4], eax ; | arg 0 (struct), "pushed" onto stack (fetched from local area)
Tassilo Philipp
parents:
diff changeset
153 mov edx, DWORD PTR _a$[ebp+8] ; |
Tassilo Philipp
parents:
diff changeset
154 mov DWORD PTR [ecx+8], edx ; |
Tassilo Philipp
parents:
diff changeset
155 mov eax, DWORD PTR _a$[ebp+12] ; |
Tassilo Philipp
parents:
diff changeset
156 mov DWORD PTR [ecx+12], eax ; /
Tassilo Philipp
parents:
diff changeset
157 lea ecx, DWORD PTR $T1[ebp] ; \ ptr to space used for struct retval (pushed as hidden first arg)
Tassilo Philipp
parents:
diff changeset
158 push ecx ; |
Tassilo Philipp
parents:
diff changeset
159 call _leaf_call@52 ; push return address and call
Tassilo Philipp
parents:
diff changeset
160 ; (note: cdecl would clean up stack, here)
Tassilo Philipp
parents:
diff changeset
161 xor eax, eax ; return value
Tassilo Philipp
parents:
diff changeset
162 mov esp, ebp ; |
Tassilo Philipp
parents:
diff changeset
163 pop ebp ; | epilog
Tassilo Philipp
parents:
diff changeset
164 ret 0 ; |
Tassilo Philipp
parents:
diff changeset
165 _main ENDP
Tassilo Philipp
parents:
diff changeset
166
Tassilo Philipp
parents:
diff changeset
167
Tassilo Philipp
parents:
diff changeset
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
499
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
264 ; ---------- C++ trivial and non-trivial aggrs as return values ---------->
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
265 ;
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
266 ; struct Trivial { int a; };
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
267 ; struct NonTrivial {
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
268 ; int a;
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
269 ; __attribute__((stdcall)) NonTrivial() : a(0) {}
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
270 ; __attribute__((stdcall)) NonTrivial(const NonTrivial& rhs) : a(rhs.a) { }
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
271 ; };
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
272 ;
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
273 ; extern "C" {
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
274 ; struct Trivial __attribute__((stdcall)) f1() { return Trivial(); }
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
275 ; }
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
276 ;
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
277 ; struct NonTrivial __attribute__((stdcall)) f2() { return NonTrivial(); }
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
278 ;
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
279 ; extern "C" {
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
280 ; void __attribute__((stdcall)) f()
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
281 ; {
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
282 ; int a=1;
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
283 ; a += 123;
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
284 ; struct Trivial t = f1();
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
285 ; a -= 123;
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
286 ; struct NonTrivial n = f2();
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
287 ; a -= 12;
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
288 ; }
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
289 ; }
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
290
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
291
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
292
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
293 ; output from alpine_linux-3.11.3-x86 w/ gcc 9.2.0 (w/ -O0 --no-stack-protector for simplicity)
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
294
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
295 00001205 <f1>:
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
296 1205: 55 push %ebp ; | prolog
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
297 1206: 89 e5 mov %esp,%ebp ; |
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
298 1208: e8 f0 ff ff ff call 11fd <__x86.get_pc_thunk.ax> ;
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
299 120d: 05 c3 2d 00 00 add $0x2dc3,%eax ;
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
300 1212: 8b 45 08 mov 0x8(%ebp),%eax ; fetch ptr to retval space -> eax
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
301 1215: c7 00 00 00 00 00 movl $0x0,(%eax) ; write retval
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
302 121b: 8b 45 08 mov 0x8(%ebp),%eax ; re-fetch ptr to retval space -> eax, to return it in eax (a bit pointless)
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
303 121e: 5d pop %ebp ; |
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
304 121f: c2 04 00 ret $0x4 ; | epilog
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
305
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
306 00001222 <_Z2f2v>:
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
307 1222: 55 push %ebp
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
308 1223: 89 e5 mov %esp,%ebp
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
309 1225: 83 ec 08 sub $0x8,%esp
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
310 1228: e8 d0 ff ff ff call 11fd <__x86.get_pc_thunk.ax>
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
311 122d: 05 a3 2d 00 00 add $0x2da3,%eax
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
312 1232: 83 ec 0c sub $0xc,%esp
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
313 1235: ff 75 08 pushl 0x8(%ebp)
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
314 1238: e8 65 00 00 00 call 12a2 <_ZN10NonTrivialC1Ev>
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
315 123d: 83 c4 0c add $0xc,%esp
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
316 1240: 8b 45 08 mov 0x8(%ebp),%eax
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
317 1243: c9 leave
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
318 1244: c2 04 00 ret $0x4
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
319
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
320 00001247 <f>:
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
321 1247: 55 push %ebp ;
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
322 1248: 89 e5 mov %esp,%ebp ;
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
323 124a: 83 ec 18 sub $0x18,%esp ;
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
324 124d: e8 ab ff ff ff call 11fd <__x86.get_pc_thunk.ax> ;
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
325 1252: 05 7e 2d 00 00 add $0x2d7e,%eax ;
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
326 1257: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp) ; a = 1
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
327 125e: 83 45 f4 7b addl $0x7b,-0xc(%ebp) ; a += 123
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
328 1262: 8d 45 f0 lea -0x10(%ebp),%eax ; ptr to space (top of stack) to hold aggr retval -> eax ...
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
329 1265: 50 push %eax ; ... as hidden first arg
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
330 1266: e8 9a ff ff ff call 1205 <f1> ; call f1()
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
331 126b: 83 6d f4 7b subl $0x7b,-0xc(%ebp) ; a -= 123
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
332 126f: 8d 45 ec lea -0x14(%ebp),%eax ; ptr to space to hold aggr retval -> eax ...
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
333 1272: 83 ec 0c sub $0xc,%esp ; grow stack by 12
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
334 1275: 50 push %eax ; ... as hidden first arg
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
335 1276: e8 a7 ff ff ff call 1222 <_Z2f2v> ; call f2()
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
336 127b: 83 c4 0c add $0xc,%esp ; shrink stack back by 12
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
337 127e: 83 6d f4 0c subl $0xc,-0xc(%ebp) ; a -= 12
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
338 1282: 90 nop ;
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
339 1283: c9 leave ;
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
340 1284: c3 ret ;
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
341
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
342
fc614cb865c6 - doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
Tassilo Philipp
parents: 497
diff changeset
343
471
Tassilo Philipp
parents:
diff changeset
344 ; vim: ft=asm
Tassilo Philipp
parents:
diff changeset
345