This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ack frame for Q starts with the saved value of the frame pointer (i.e., %ebp). followed by copies of any other saved register values. Procedure Q also uses the stack for any local variables that cannot be stored in registers. This can occur for the following reasons: ¯ ¯ ¯ There are not enough registers to hold all of the local data. Some of the local variables are arrays or structures and hence must be accessed by array or structure references. The address operator ‘&’ is applied to one of the local variables, and hence we must be able to generate an address for it. Finally, Q will use the stack frame for storing arguments to any procedures it calls. As described earlier, the stack grows toward lower addresses and the stack pointer %esp points to the top element of the stack. Data can be stored on and retrieved from the stack using the pushl and popl instructions. Space for data with no speciﬁed initial value can be allocated on the stack by simply decrementing the stack pointer by an appropriate amount. Similarly,...
View Full Document
- Spring '10
- The American