esp calling sequence. caller parameters (in reverse order) esp calling sequence

19
ESP Calling sequence

Upload: rylan-bourns

Post on 01-Apr-2015

227 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ESP Calling sequence. caller Parameters (in reverse order) ESP Calling sequence

ESP

Calling sequence

Page 2: ESP Calling sequence. caller Parameters (in reverse order) ESP Calling sequence

caller Parameters (in reverse order)ESP

Calling sequence

Page 3: ESP Calling sequence. caller Parameters (in reverse order) ESP Calling sequence

caller Parameters (in reverse order)

ESP

Calling sequence

Return address (next instruction)

Page 4: ESP Calling sequence. caller Parameters (in reverse order) ESP Calling sequence

caller

calleenew EBP

parameters

old EBPESP

Calling sequence

Return address (next instruction)

Page 5: ESP Calling sequence. caller Parameters (in reverse order) ESP Calling sequence

caller

callee

saved registers

parameters

old EBPnew EBP

ESP

Calling sequence

Return address (next instruction)

Page 6: ESP Calling sequence. caller Parameters (in reverse order) ESP Calling sequence

caller

saved registers

parameters

old EBP

local variables

calleenew EBP

ESP

Calling sequence

Return address (next instruction)

Page 7: ESP Calling sequence. caller Parameters (in reverse order) ESP Calling sequence

caller

saved registers

parameters

old EBP

local variables

temporary storage

calleenew EBP

ESP

Stack frame of current subprogram

Calling sequence

Return address (next instruction)

Page 8: ESP Calling sequence. caller Parameters (in reverse order) ESP Calling sequence

caller

saved registers

parameters

old EBP

local variables

temporary storage

Working

calleenew EBP

ESP

Return address (next instruction)

Stack frame of current subprogram

Page 9: ESP Calling sequence. caller Parameters (in reverse order) ESP Calling sequence

caller

saved registers

parameters

old EBP

local variables

temporary storage

Working

calleenew EBP

ESP

Return address (next instruction)

Stack frame of current subprogram

Page 10: ESP Calling sequence. caller Parameters (in reverse order) ESP Calling sequence

caller

saved registers

parameters

old EBP

local variables

temporary storage

Working

calleenew EBP

ESP

Stack frame of current subprogram

Return address (next instruction)

Page 11: ESP Calling sequence. caller Parameters (in reverse order) ESP Calling sequence

caller

saved registers

parameters

old EBP

local variables

temporary storage

Working

calleenew EBP

ESP

Stack frame of current subprogram

Return address (next instruction)

Page 12: ESP Calling sequence. caller Parameters (in reverse order) ESP Calling sequence

caller

saved registers

parameters

old EBPcalleenew EBP

ESP

Return sequence

return value (if any) stored in EAX

Return address (next instruction)

Page 13: ESP Calling sequence. caller Parameters (in reverse order) ESP Calling sequence

caller parameters

old EBPcalleenew EBP ESP

Return sequence

Registers restoredreturn value (if any) stored in EAX

Return address (next instruction)

Page 14: ESP Calling sequence. caller Parameters (in reverse order) ESP Calling sequence

caller parameters

ESP

Return sequence

Registers restored EBP restored

return value (if any) stored in EAX

Return address (next instruction)

Page 15: ESP Calling sequence. caller Parameters (in reverse order) ESP Calling sequence

caller parametersESP

return value (if any) stored in EAXcontrol back to caller – at return address

Page 16: ESP Calling sequence. caller Parameters (in reverse order) ESP Calling sequence

callerESP

Return sequence

return value (if any) stored in EAX

Page 17: ESP Calling sequence. caller Parameters (in reverse order) ESP Calling sequence

caller

ESP

Working

Page 18: ESP Calling sequence. caller Parameters (in reverse order) ESP Calling sequence

caller

ESP

Working

Page 19: ESP Calling sequence. caller Parameters (in reverse order) ESP Calling sequence

callerESP

Working