This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] libffi on XScale (BE)


On Tue, 2004-10-26 at 19:21, Quaritsch Markus wrote:
> On Tue, Oct 26, 2004 at 05:04:16PM +0100, Richard Earnshaw wrote:
> 
> > I think I've figured out most of what you are trying to do now, and as a
> > result I think your approach is wrong.
> 
> but it works ;-)
> 

That doesn't make it right... 

And anyway, your patch would break other cases, such as values smaller
than a word.

> > --- sysv.S.orig 2004-10-21 09:35:22.000000000 +0200
> > +++ sysv.S      2004-10-21 10:59:17.204423684 +0200
> > @@ -88,10 +88,17 @@
> >         mov   sp, fp
> >  
> >         # Load a3 with the pointer to storage for the return value
> > -       ldr   a3, [sp, #24]
> > +# @@@ quam
> > +       ldr  a3, [sp, #36]
> >  
> > 
> > This bit doesn't make sense at all.  There are only 32 bytes in the
> > stack frame for this call, so you can't peek outside it.
> 
> But when you look at the code-snipped below, you can see, thet the
> pointer for the ecif-struct is at sp + 32, 

It is not.

Look at the comment at the start of ffi_call_SYSV.  That describes the
arguments passed to the function.   Once you work through the stack
manipulations in the code you find that there are precisely 6 additional
words on the stack at the point in question, so the total stack frame
for the function is 32 bytes (hence the largest offset you can use in an
ldr is +28).  Anything larger than that is poking around into the
caller's stack frame, but you can't rely on that being the same for ever
(the compiler is free to lay its own frames out as it wishes).


> I'm sure, you have a better solution because this are my first
> experiences with the XScale (especially asm on this platform) and
> libffi (got to know it last week).

I'm looking into it.  But don't hold your breath.

R.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]