This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: getcontext() on ppc32 destroys saved parameter 1 in caller's frame
On Mon, Aug 30, 2004 at 02:01:27PM -0500, Steve Munroe wrote:
> Jakub Bogusz <qboosh@pld-linux.org> wrote on 08/29/2004 12:25:25 PM:
> > GLIBC_2.3.4 getcontext() on ppc32 changes the value of the first
> > parameter passed to caller's function.
[...]
> > It's caused by the first instruction of __getcontext()
> > (sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S:29):
> >
> > ENTRY(__getcontext)
> > stw r3,_FRAME_PARM_SAVE1(r1)
> >
> > __getcontext doesn't have its own stack frame, so it uses caller's
> > stack frame, thus destroying it...
> >
> > The same applies to GLIBC_2.3.4 swapcontext(), but it may be less/not(?)
> > harmful as successful swapcontext() never returns.
> >
>
> Actually the problem is a little different. The PPC32 ABI is different
> from the PPC64 ABI in that it does not allocate space for the first
> 8-parms on in the stack frame. So the attempt to save r3 into the parm
> save area (there is none in this frame) is storing over the variable "a".
> So for PPC32 need to use negative offsets before pushing the small frame
> that getcontext uses. Also getcontext should be returning 0 (in r3) to
> indicate success.
>
> Have you opened a buzilla for this?
No; I can, if really needed. In the shortage of time it was easier/faster
to just send an e-mail...
--
Jakub Bogusz http://cyber.cs.net.pl/~qboosh/
PLD Team http://www.pld-linux.org/