MSC100ABIRM Motorola / Freescale Semiconductor, MSC100ABIRM Datasheet - Page 22

no-image

MSC100ABIRM

Manufacturer Part Number
MSC100ABIRM
Description
SC100 Application Binary Interface Reference Manual
Manufacturer
Motorola / Freescale Semiconductor
Datasheet
Low-Level Binary Interface
Fields within structures and unions begin on the next possible suitably-aligned boundary for their data
type. For non-bit fields, this is a suitable byte alignment. Bit fields begin at the next available bit offset
with the following exception: the first bit field after a non-bit field member will be allocated on the next
available byte boundary.
In Example 2-2, the offset of the field
size because of the alignment restrictions introduced by using the underlying
Example 2-2. 1-Byte Field Offset
struct s {
}
2.3 Function Calling Conventions
SC100 compilers must support a stack-based calling convention. Additional calling conventions may be
supported. Calling conventions can be mixed within a single application.
A pragma interface should be used to set the calling convention for a function to one that is different from
the stack-based calling convention. This change will affect both the calling sequence and prologue/epilog
of these functions, if a function body is present. This will allow both calling and being called by functions
compiled with different compilers.
2.3.1 Stack
The SP register serves as the stack pointer. SP will point to the first available location, with the stack
direction being towards higher addresses (i.e., a push will be implemented as “(sp)+”). The stack pointer
must be 8-byte aligned.
2.3.2 Stack-Based Calling Convention
The calling conventions described in the following paragraphs must be supported.
The first (left-most) function parameter, regardless of size, will be passed in d0 (if a numeric scalar) or in
r0 (if an address parameter). The second function parameter, regardless of size, will be passed in d1 (if a
numeric scalar) or in r1 (if an address parameter). The rest of the parameters will be pushed into the stack.
Parameters will be pushed on the stack using little-endianess (least significant bits in lower addresses).
Structures and union objects that can fit in a register are treated as numeric parameters and therefore are
candidates to be passed in a register.
Numeric return values will be returned in d0. Numeric address return values will be returned in r0.
Functions returning large structures (i.e., structures that do not fit in a single register) will receive and
return the returned structure address in r2. The caller allocates the space for the returned object.
Functions with a variable number of parameters will allocate all parameters on the stack.
All parameters of size smaller or equal to 4 bytes will be aligned in memory to a 4-byte boundary.
The following registers will be saved by the caller: d0-d5, d8-d15, r0-r5, n0-n3.
2-4
int bf: 5;
char c;
c
is 1 byte. The structure itself has 4-byte alignment and is 4 bytes in
Preliminary (April 2000)
SC100 Application Binary Interface
int
data type for the bit field.

Related parts for MSC100ABIRM