Example D-2 Aligned Ebp-Based Stack Frames - Intel ARCHITECTURE IA-32 Reference Manual

Architecture optimization
Table of Contents

Advertisement

Example D-2 Aligned ebp-based Stack Frames

void _stdcall foo (int k)
{
int j;
foo:
push
mov
sub
and
add
after add
jmp
foo.aligned:
push
after push
mov
common:
push
used for
push
after push
mov
and store
mov
mov
sub
push
after push
ebx
ebx, esp
esp, 0x00000008
esp, 0xfffffff0
esp, 0x00000008
common
ebx
ebx, esp
ebp
ebp
ebp, [ebx + 4]
[esp + 4], ebp
ebp, esp
esp, 28
edx
Stack Alignment
// esp is (8 mod 16)
// esp is (8 mod 16)
// this slot will be
// duplicate return pt
// esp is (0 mod 16)
// (rtn,ebx,ebp,ebp)
// fetch return pointer
// relative to ebp
// (rtn,ebx,rtn,ebp)
// ebp is (0 mod 16)
// esp is (4 mod 16)
//see Note A
// esp is (0 mod 16)
D
continued
D-7

Advertisement

Table of Contents
loading

Table of Contents