IP-NIOS Altera, IP-NIOS Datasheet - Page 170

no-image

IP-NIOS

Manufacturer Part Number
IP-NIOS
Description
IP NIOS II MEGACORE
Manufacturer
Altera
Type
Licenser
Datasheets

Specifications of IP-NIOS

Processor Type
RISC 32-Bit
Lead Free Status / RoHS Status
Not applicable / Not applicable
Features
-
Package / Case
-
Mounting Type
-
Voltage
-
Speed
-
7–6
Figure 7–3. Stack Frame Using Variable Arguments
Nios II Processor Reference Handbook
Function Prologues
Stack pointer
Higher addresses
Lower addresses
In order for varargs to work, functions that take variable arguments allocate 16 extra
bytes of storage on the stack. They copy to the stack the first 16 bytes of their
arguments from registers r4 through r7 as shown in
Stack Frame for a Function with Structures Passed By Value
Functions that take struct value arguments still have their first 16 bytes of arguments
arriving in registers r4 through r7, just like other functions.
If part of a structure is passed using registers, the function might need to copy the
register contents back to the stack. This operation is similar to that required in the
variable arguments case as shown in
The Nios II C/C++ compiler generates function prologues that allocate the stack
frame of a function for storage of stack temporaries and outgoing arguments. In
addition, each prologue is responsible for saving the state of the calling function. This
entails saving certain registers on the stack. These registers, the callee-saved registers,
are listed in
callee-saved register only if the function uses the register.
Given the function prologue algorithm, when doing a back trace, a debugger can
disassemble instructions and reconstruct the processor state of the calling function.
Just prior to calling b()
In function a()
arguments
Outgoing
stack
Table 7–2 on page
Frame pointer
Stack pointer
7–2. A function prologue is required to save a
Just after executing prologue
Return address
In function b()
Figure
Saved frame
Other saved
temporaries
arguments
Copy of r7
Copy of r6
Copy of r5
Copy of r4
arguments
Incoming
Space for
Space for
registers
outgoing
pointer
stack
stack
stack
7–3.
Allocated and freed by a()
Allocated and freed by b()
(i.e. the current function)
(i.e. the calling function)
Figure
Chapter 7: Application Binary Interface
December 2010 Altera Corporation
7–3.
Stacks

Related parts for IP-NIOS