IB Chapter 4/System Briefing
M -
In assembly code, the invocation of MyRouti ne{) would look something like:
push ecx, DWORD PTR _value$[ebp]
push ecx
leaecx, DWORD PTR _buffer$[ebp]
push ecx
cal1 _MyRoutine
addesp, 8
In the absence of stack frame checks, the prologue of MyRoutine() will save
the existing stack frame pointer, set its value to the currcnt top of the stack,
and then allocate storage on the stack for local variables.
push ebp
movebp, esp
subesp, 12
What we end up with is a stack frame as depicted in Figure 4.11.
High Memory
+ 12
A
Low Memory
+8
A
▼
-8
T
12
byte
byie
byte
byte
byte
byte
by te
byte
byte
byte
byte
byte
> value
> str
Weip
by le
by te
byte
byte
V
byte
byte
byte
by te
byte
byte
byte
byte
>
byte
byte
byte
byte
�EBP
EBP (set to ESP)
y localBuft'er
> localValue
Figure 4,1
Part I