Hallo,
1 | void test(void) {
|
2 | int x = 0xAB, y = 0xBA;
|
3 | int * px = &x;
|
4 | }
|
gcc -c main main.c -Wall -std=c99
objdump -d main | grep -A 12 "<test>:"
1 | 08048406 <test>:
|
2 | 8048406: 55 push %ebp
|
3 | 8048407: 89 e5 mov %esp,%ebp
|
4 | 8048409: 83 ec 10 sub $0x10,%esp
|
5 | 804840c: c7 45 f4 ab 00 00 00 movl $0xab,-0xc(%ebp)
|
6 | 8048413: c7 45 fc ba 00 00 00 movl $0xba,-0x4(%ebp)
|
7 | 804841a: 8d 45 f4 lea -0xc(%ebp),%eax
|
8 | 804841d: 89 45 f8 mov %eax,-0x8(%ebp)
|
9 | 8048420: e8 dc ff ff ff call 8048401 <run>
|
10 | 8048425: e8 d7 ff ff ff call 8048401 <run>
|
11 | 804842a: c9 leave
|
12 | 804842b: c3 ret
|
-$0xC%(epb) zeigt doch auf x
wieso braucht man lea?
wieso geht folgendes nicht ...
mov %(ebp), %eax
sub $0xC, %eax