
234 CHAPTER 5 Program Design and Analysis
to an element in the frame by addressing relative to sp. When a new procedure is
called, the sp and fp are modified to push another frame onto the stack.
The ARM Procedure Call Standard (APCS) is a good illustration of a typi-
cal procedure linkage mechanism. Although the stack frames are in main memory,
understanding how registers are used is key to understanding the mechanism, as
explained below.
■ r0 ⫺ r3 are used to pass parameters into the procedure. r0 is also used to hold
the return value. If more than four parameters are required, the y are put on
the stack frame.
■ r4 ⫺ r7 hold register variables.
■ r