Intel i86W Manual page 153

Table of Contents

Advertisement

PROGRAMMING MODEL
A separate addressing temporary register (r31) is allocated to allow construction of
32-bit address temporaries. Assemblers may use
r31
by default to construct 32-bit
addresses from 16-bit literals.
If there are memory parameters, either because there are more parameters than will fit
in the registers or because there are structure parameters, they should be put in the
caller's stack frame properly aligned. Register r28 is set to point to this area in memory
by the caller.
8.1.2 Floating-Point Registers
Floating-point and 64-bit integer values in the floating-point registers must use
f8-f15
when passed by value. The leftmost such parameter is passed in
f8-f9;
the rest in succes-
sively higher-numbered registers. Single-precision parameters use one register, double-
precision parameters use two properly aligned registers. A single-precision floating-point
value can be converted to double-precision with the
fmov.sd
jx, fy pseudoinstruction.
Parameters beyond
f15
are passed in memory on the stack. The last (i.e. rightmost)
parameter is at the highest stack address (i.e is pushed first assuming a grow-down
stack). The same registers used to pass the first parameter are used for the return value
when the return value is a floating-point value or 64-bit integer. A subroutine may need
to save the first parameter to make room for the return value.
8.1.3 Passing Mixed Integer and Floating-Point Parameters in Registers
Integer and floating-point parameter registers are allocated independently. If parameter
N (N is less than or equal to 12) is an integral parameter, then it is placed in integer
register 16
+
N, with no effect on the floating-point register usage. If parameter M is the
first floating-point parameter, then it is placed in the register pair fB and f9 if it is double
precision, or in register fB if it is single precision. If parameter M
+
1 is the second
floating-point parameter, then it is placed in register pair flO and fl1 if it is double
precision, regardless of the type of the first floating-point parameter. If parameter M
+
1
is single precision, then it is placed in register f9 if the first floating-point parameter is
single precision, or in register flO if the first floating-point parameter is double precision.
NOTE
The conventions in Sections B.1.1 through B.1.3 remain tentative.
8.1.4 Variable Length Parameter Lists
Parameter passing in registers can handle a variable number of parameters. The C pro-
gramming language uses a special method to access variable-count parameters. The
stdarg.h
and
varargs.h
files define several functions to get at these parameters in a way
that is independent of stack growth direction and of whether parameters are passed in
8-3

Advertisement

Table of Contents
loading

Table of Contents