L24 movl 1eax finishing code terminate return value 1

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: ith register %ebp serving as the frame pointer, and register %esp serving as the stack pointer. The stack pointer can move while the procedure is executing, and hence most information is accessed relative to the frame pointer. 3.7. PROCEDURES 133 Stack Bottom +4n+4 Passed Arg. n • • • +8 Frame Pointer %ebp +4 -4 Passed Arg. 1 Return Address Saved %ebp Saved Registers Increasing Address Locals and Temporaries Stack Pointer %esp Argument Build Area Stack Top Figure 3.16: Stack Frame Structure. The stack is used for passing arguments, for storing return information, for saving registers, and for local storage. • • • Caller’s Frame Current Frame 134 CHAPTER 3. MACHINE-LEVEL REPRESENTATION OF C PROGRAMS Suppose procedure P (the caller) calls procedure Q (the callee). The arguments to Q are contained within the stack frame for P. In addition, when P calls Q, the return address within P where the program should resume execution when it returns from Q is pushed on the stack, forming the end of P’s stack frame. The st...
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