Subject: Re: cerror.S ignores error number returned
To: Jaromir Dolecek <jdolecek@NetBSD.org>
From: Srinivasa Kanduru <ksraghavan@yahoo.com>
List: port-i386
Date: 11/28/2003 13:13:06
All the system calls put the errno number in $eax before calling cerror. The
prologues and epilogues doesn't do anything with it. Now when _errno address is
returned, the value of errno is to be stored in it. At the entry the value of
%eax is pushed onto the stack, and when the _errno address is returned, the
error number is to be stored in the variable, but currently it doesn't seem to
be doing I think. The pop %ecx will retrieve the err value from the stack and
the mov will store it in errno I think.



Regards,
Srini.


--- Jaromir Dolecek <jdolecek@NetBSD.org> wrote:
> Srinivasa Kanduru wrote:
> > diff -u cerror.S*
> > --- cerror.S    Tue Nov 25 11:17:15 2003
> > +++ cerror.S.orig       Tue Nov 25 10:38:42 2003
> > @@ -53,12 +53,10 @@
> >         PIC_PROLOGUE
> >         call    PIC_PLT(_C_LABEL(__errno))
> >         PIC_EPILOGUE
> > -       popl    %ecx
> >  #else
> >         call    _C_LABEL(__errno)
> > -       popl    %ecx
> >  #endif /* PIC */
> > -       movl    %ecx,(%eax)
> > +       popl    (%eax)
> >         movl    $-1,%eax
> >         movl    $-1,%edx
> >         ret
> 
> AFAICS this only optimizes the codepath (avoiding one movl),
> but doesn't change any behaviour. Is that correct?
> 
> Jaromir 
> -- 
> Jaromir Dolecek <jdolecek@NetBSD.org>            http://www.NetBSD.cz/
> -=- We should be mindful of the potential goal, but as the Buddhist -=-
> -=- masters say, ``You may notice during meditation that you        -=-
> -=- sometimes levitate or glow.   Do not let this distract you.''   -=-


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/