[Top] [All Lists]

Question about parameters passed on stack

To: Pro64 Contrib <pro64-contrib@xxxxxxxxxxx>
Subject: Question about parameters passed on stack
From: "Benedict R. Gaster" <benedict.gaster@xxxxxx>
Date: Mon, 20 Aug 2001 11:30:54 +0100
Organization: STMicroelectronics
Sender: owner-pro64-contrib@xxxxxxxxxxx

hopefully this message will get through before the list is finally

although almost all of the ABI specifics have now been resolved for our
port there is one issue that i would like to ask the list about.

the problem is best described with an example.

to help with the description of  the problem assume some function, foo,
with prototype:

int foo(int a, int b, int c, int d, int e, int f, int g, int h, int i,
int j)

according to our ABI parameters---not worrying, at this point, about
varargs--- less than 8-bytes are passed in registers r2, ..., r9 (i.e.,
a, ..., h will be in registers on entry to foo) with the remaining ones
(i.e., i and j in this case) are pushed on to the stack before transfer
of control. if we assume that compilation is done at -O0, then
parameters passed in registers are stored on to the stack during the
function prologue. on complition of the function prologue the
stack-frame should look like the following, according to our ABI
(assuming little endian):

+ upper 32bits of  j   +
+  lower 32bits of  j  +
+ -------------------+
+ upper 32bits of  i   +
+  lower 32bits of  i  +
+ -------------------+ SP on entry to foo (8-byte aligned)
+ 32 bits of a            +
+       ...                    +
+  32 bits of h           +
+--------------------+  8-byte aligned
+ vars local to foo     +
+--------------------+ SP after prologue (8-byte aligned)

now the heart of our problem is the observation that parameters passed
on the stack, as part of the callers frame, are always aligned to an
8-byte boundary.

i've have checked that our implementation of  the function
Get_Input_Parameter_Location is returning the correct offset and so it
must be somewhere during code generation, using the mtype to normalize
the offset, that the chage is taking place!

thanks for any help on this.


<Prev in Thread] Current Thread [Next in Thread>