IPR-NIOS Altera, IPR-NIOS Datasheet - Page 172

no-image

IPR-NIOS

Manufacturer Part Number
IPR-NIOS
Description
IP NIOS II MEGACORE RENEW
Manufacturer
Altera
Type
MegaCorer
Datasheet

Specifications of IPR-NIOS

License
Renewal License
Lead Free Status / RoHS Status
Not applicable / Not applicable
7–8
Nios II Processor Reference Handbook
Arguments
Return Values
The first 16 bytes to a function are passed in registers r4 through r7. The arguments
are passed as if a structure containing the types of the arguments were constructed,
and the first 16 bytes of the structure are located in r4 through r7.
A simple example:
The equivalent structure representing the arguments is:
The first 16 bytes of the struct are assigned to r4 through r7. Therefore r4 is assigned
the value of a and r5 the value of b.
The first 16 bytes to a function taking variable arguments are passed the same way as
a function not taking variable arguments. The called function must clean up the stack
as necessary to support the variable arguments. Refer to
with Variable Arguments” on page
Return values of types up to 8 bytes are returned in r2 and r3. For return values
greater than 8 bytes, the caller must allocate memory for the result and must pass the
address of the result memory as a hidden zero argument.
The hidden zero argument is best explained through an example.
Example 7–2. Returned struct
/* b() computes a structure-type result and returns it */
STRUCT b(int i, int j)
{
}
void a(...)
{
}
In
and r3.
Example
int function (int a, int b);
struct { int a; int b; };
...
return result;
...
value = b(i, j);
7–2, if the result type is no larger than 8 bytes, b() returns its result in r2
7–5.
Chapter 7: Application Binary Interface
“Stack Frame for a Function
December 2010 Altera Corporation
Arguments and Return Values

Related parts for IPR-NIOS