This preview shows page 1. Sign up to view the full content.
Unformatted text preview: space can be deallocated by incrementing the stack pointer. 3.7.2 Transferring Control
The instructions supporting procedure calls and returns are as follows: Instruction call Label call *Operand leave ret Description Procedure Call Procedure Call Prepare stack for return Return from call The call instruction has a target indicating the address of the instruction where the called procedure starts. Like jumps, a call can either be direct or indirect. In assembly code, the target of a direct call is given as a label, while the target of an indirect call is given by a * followed by an operand speciﬁer having the same syntax as is used for the operands of the movl instruction (Figure 3.3). The effect of a call instruction is to push a return address on the stack and jump to the start of the called procedure. The return address is the address of the instruction immediately following the call in the program, so that execution will resume at this location when the called procedure returns. The ret instruction pops an address off the stack and jumps to this location. The proper use of t...
View Full Document
This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.
- Spring '10
- The American