![Intel NIOS II Owner Reference Manual Download Page 150](http://html1.mh-extra.com/html/intel/nios-ii/nios-ii_owner-reference-manual_2071826150.webp)
7.4.3.1. Stack Frame for a Function With alloca()
The Nios II stack frame implementation provides support for the
alloca()
function,
defined in the Berkeley Software Distribution (BSD) extension to C, and implemented
by the gcc compiler. The space allocated by
alloca()
replaces the outgoing
arguments and the outgoing arguments get new space allocated at the bottom of the
frame.
Note:
The Nios II C/C++ compiler maintains a frame pointer for any function that calls
alloca()
, even if
-fomit-frame-pointer
is spec if ed
Figure 14.
Stack Frame after Calling alloca()
higher addresses
lower addresses
space for
outgoing
stack
arguments
sp
sp
space for
outgoing
stack
arguments
memory
allocated
by
alloca()
)(
a
c
o
ll
a
g
n
il
l
a
c
r
e
tf
A
e
r
o
f
e
B
7.4.3.2. Stack Frame for a Function with Variable Arguments
Functions that take variable arguments (
varargs
) still have their first 16 bytes of
arguments arriving in registers
r4
through
r7
, just like other functions.
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 below.
7. Application Binary Interface
NII-PRG | 2018.04.18
Nios II Processor Reference Guide
150