comparison doc/disas_examples/x86.thiscall.disas @ 615:516d72e98253

- more thiscall disas examples
author Tassilo Philipp
date Sat, 01 Oct 2022 16:14:00 +0200
parents
children
comparison
equal deleted inserted replaced
614:b74d7a249642 615:516d72e98253
1 ; ---------- simple C++ thiscall ---------->
2 ;
3 ; class C {
4 ; public:
5 ; float m(int i) const { return float(i + 123); }
6 ; };
7 ;
8 ; extern "C" {
9 ; float f()
10 ; {
11 ; C c;
12 ; return c.m(27);
13 ; }
14 ; }
15
16
17
18 ; output from openbsd-4.0-x86 w/ gcc 3.3.5 (propolice)
19
20 00000000 <f>:
21 0: 55 push %ebp ; |
22 1: 89 e5 mov %esp,%ebp ; | prolog
23 3: 83 ec 08 sub $0x8,%esp ; /
24 6: 83 ec 08 sub $0x8,%esp ;
25 9: 6a 1b push $0x1b ; arg 1
26 b: 8d 45 ff lea 0xffffffff(%ebp),%eax ; |
27 e: 50 push %eax ; | arg 0 (this ptr)
28 f: e8 fc ff ff ff call 10 <f+0x10> ; call C::m()
29 14: 83 c4 10 add $0x10,%esp ;
30 17: c9 leave ;
31 18: c3 ret ;
32
33 00000000 <_ZNK1C1mEi>:
34 0: 55 push %ebp ;
35 1: 89 e5 mov %esp,%ebp ;
36 3: 8b 45 0c mov 0xc(%ebp),%eax ; |
37 6: 83 c0 7b add $0x7b,%eax ; | in arg + 123, pushed onto stack
38 9: 50 push %eax ; |
39 a: db 04 24 fildl (%esp) ; float cast and put return value in fp0
40 d: 8d 64 24 04 lea 0x4(%esp),%esp ;
41 11: c9 leave ;
42 12: c3 ret ;
43
44
45
46 ; output from minix-3.1.8-x86 w/ gcc 4.4.3
47
48 00000000 <__ZNK1C1mEi>:
49 0: 55 push %ebp ;
50 1: 89 e5 mov %esp,%ebp ;
51 3: 83 ec 18 sub $0x18,%esp ;
52 6: 8b 45 0c mov 0xc(%ebp),%eax ; |
53 9: 83 c0 7b add $0x7b,%eax ; | in arg + 123, pushed onto stack
54 c: 89 04 24 mov %eax,(%esp) ; |
55 f: e8 ec ff ff ff call 0 <__ZNK1C1mEi> ; ? unsure
56 14: c9 leave ;
57 15: c3 ret ; note: float returned via eax
58
59 00000016 <_f>:
60 16: 55 push %ebp ;
61 17: 89 e5 mov %esp,%ebp ;
62 19: 83 ec 28 sub $0x28,%esp ;
63 1c: c7 44 24 04 1b 00 00 00 movl $0x1b,0x4(%esp) ; arg 1 via stack
64 24: 8d 45 f7 lea 0xfffffff7(%ebp),%eax ; |
65 27: 89 04 24 mov %eax,(%esp) ; | arg 0 (this ptr)
66 2a: e8 d1 ff ff ff call 0 <__ZNK1C1mEi> ; call C::m()
67 2f: c9 leave ;
68 30: c3 ret ;
69
70
71
72 ; vim: ft=asm
73