comparison doc/disas_examples/x86.fastcall_borland.disas @ 327:c0390dc85a07

- doc: added disassembly examples for many platforms and calling conventions, for reference
author Tassilo Philipp
date Fri, 22 Nov 2019 23:08:59 +0100
parents
children b74d7a249642
comparison
equal deleted inserted replaced
326:09aaa2e774cd 327:c0390dc85a07
1 ; #pragma pack(push, 1)
2 ; struct TTest
3 ; {
4 ; __int32 i1;
5 ; __int32 i2;
6 ; };
7 ; #pragma pack(pop)
8 ;
9 ; TTest __fastcall DoTest()
10 ; {
11 ; TTest t;
12 ; t.i1 = 1;
13 ; t.i2 = 2;
14 ; return t;
15 ; }
16 ;
17 ; ...
18 ; TTest t = DoTest();
19
20 ; from http://codeverge.com/embarcadero.cppbuilder.cpp/does-fastcall-have-any-bearing-on/1043767
21
22
23 DoTest():
24 push ebp ; |
25 mov ebp,esp ; | prolog
26 add esp,-0x0c ; |
27 mov [ebp-0x04],eax ; pointer to hidden param in eax -> local area
28 mov [ebp-0x0c],0x00000001 ; val 1 -> local area
29 mov [ebp-0x08],0x00000002 ; val 2 -> local area
30 mov eax,[ebp-0x04] ; refetch eax (pointlessly)
31 mov edx,[ebp-0x0c] ; get val 1 in edx and ...
32 mov [eax],edx ; ... store at *eax
33 mov edx,[ebp-0x08] ; get val 2 in edx and ...
34 mov [eax+0x04],edx ; ... store at *(eax + 4)
35 mov eax, [ebp-0x04] ; return value
36 mov esp,ebp ; |
37 pop ebp ; | epilog
38 ret ; |
39
40 ; vim: ft=asm
41