leaveq / Stack unveraendert?

11/13/2015 23:55 algernong#1
Hi,

laut meiner Aufgabenstellung soll die Instruktion leaveq ein "popq %%ebp" (bzw. rbp auf 64 Bit Systemen?) beinhalten.

Allerdings veraendert die Instruktion meinen Stack Pointer gar nicht:
Code:
=> 0x40095f <yield+213>:	nop
   0x400960 <yield+214>:	leaveq 
   0x400961 <yield+215>:	retq   
(gdb) x/4xw $sp
0x604000:	0x00400c2a	0x00000000	0x00004711	0x00000000
(gdb) stepi
0x0000000000400960	123	}
1: x/3i $pc
=> 0x400960 <yield+214>:	leaveq 
   0x400961 <yield+215>:	retq   
   0x400962 <startThread>:	push   %rbp
(gdb) stepi
0x0000000000400961	123	}
1: x/3i $pc
=> 0x400961 <yield+215>:	retq   
   0x400962 <startThread>:	push   %rbp
   0x400963 <startThread+1>:	mov    %rsp,%rbp
(gdb) x/4xw $sp
0x604000:	0x00400c2a	0x00000000	0x00004711	0x00000000
rsp ist also vor der Instruktion auf 0x60400 und danach noch immer. Also wird gar nichts vom Stack geholt?!

Was genau macht leaveq dann, wenn nicht das alte Stack Frame wieder herstellen?

Edit: Ahh, ich bin dumm. Natuerlich bleibt der SP gleich, wenn der BP auf die selbe Adresse zeigt. :x