Advancing SP on a call

2010-03-10 Thread Frank Isamov
We have a problem with arguments passing in memory.

The caller puts the arguments in memory relative to the sp:
add sp, 4 // allocate space for the argument. stack grows up
store r1, (sp-4)  // store  the argument on the stack
call xxx// call the function.

In xxx the result code looks like:
load (sp-4), r1   // load the argument from the stack.

The problem is that the 'call' instruction pushes the return address
to the stack and
increments the sp by 4 so when the callee tries to access the memory
it does not get
to the correct location.

How can I tell GCC that that the callee should load from the original
offset + 4?

Thanks.


Re: Advancing SP on a call

2010-03-10 Thread Richard Henderson
On 03/10/2010 09:02 AM, Frank Isamov wrote:
 How can I tell GCC that that the callee should load from the
 original offset + 4?

You'll want to set FIRST_PARM_OFFSET and INCOMING_FRAME_SP_OFFSET.


r~