381 basic principles for data type and integer

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: his instruction is to have prepared the stack so that the stack pointer points to the place where the preceding call instruction stored its return address. The leave instruction can be used to prepare the stack for returning. It is equivalent to the following code sequence: 3.7. PROCEDURES 1 2 135 Set stack pointer to beginning of frame Restore saved %ebp and set stack ptr to end of caller’s frame movl %ebp, %esp popl %ebp Alternatively, this preparation can be performed by an explicit sequence of move and pop operations. Register %eax is used for returning the value of any function that returns an integer or pointer. Practice Problem 3.14: The following code fragment occurs often in the compiled version of library routines: 1 2 3 call next next: popl %eax A. To what value does register %eax get set? B. Explain why there is no matching ret instruction to this call. C. What useful purpose does this code fragment serve? 3.7.3 Register Usage Conventions The set of program registers acts as a single reso...
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.

Ask a homework question - tutors are online