Posted: Sun Apr 27, 2008 4:14 am Post subject: Call and Ret in assembly
Do calls process all the instructions at the specifed location until they hit a ret and THEN go back to where it was first "Called"? Or does it just perform the single instruction and then bounce back?
When the call instruction is executed, the address of the instruction immediately follwing the call (known as return address) is pushed onto the stack and execution jumps to the function received as an argument (copies address of the procedure into EIP). When RET is reached, the return address is taken from the stack and execution jumps there instead (top of stack popped into EIP).
Joined: 24 Jun 2004 Posts: 733 Location: location location
Posted: Sun Apr 27, 2008 5:40 am Post subject: Re: Call and Ret in assembly
ernie wrote:
Do calls process all the instructions at the specifed location until they hit a ret and THEN go back to where it was first "Called"? Or does it just perform the single instruction and then bounce back?
yes it processes all the intructions at the specified location until a return is hit,
then like slugsnack says it returns to the next instruction after the call, _________________
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum