At this point the stack frame will have the form

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: 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 specified initial value can be allocated on the stack by simply decrementing the stack pointer by an appropriate amount. Similarly,...
View Full Document

Ask a homework question - tutors are online