
Stack Alignment
D
D-8
// the goal is to make
esp and ebp
// (0 mod 16) here
j = k;
mov
edx, [ebx + 8]
// k is (0 mod 16) if
caller aligned
// its stack
mov
[ebp - 16], edx
// J is (0 mod 16)
foo(5);
add
esp, -4
// normal call sequence
to
//
unaligned
entry
mov [esp],5
call foo
// for stdcall, callee
// cleans up stack
foo.aligned(5);
add esp,-16
// aligned entry, this
should
// be a multiple of 16
mov [esp],5
call foo.aligned
add esp,12
// see
Note B
return j;
mov eax,[ebp-16]
pop edx
mov esp,ebp
pop ebp
mov esp,ebx
pop ebx
ret 4
}
Example D-2 Aligned ebp-based Stack Frames
(continued)
Содержание ARCHITECTURE IA-32
Страница 1: ...IA 32 Intel Architecture Optimization Reference Manual Order Number 248966 013US April 2006...
Страница 220: ...IA 32 Intel Architecture Optimization 3 40...
Страница 434: ...IA 32 Intel Architecture Optimization 9 20...
Страница 514: ...IA 32 Intel Architecture Optimization B 60...
Страница 536: ...IA 32 Intel Architecture Optimization C 22...
Страница 560: ...IA 32 Intel Architecture Optimization E 14...