Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Apr 2002 13:26:16 -0400 (EDT)
From:      Kenneth Culver <culverk@alpha.yumyumyum.org>
To:        Andrew Gallatin <gallatin@cs.duke.edu>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: pushal & ebp
Message-ID:  <20020425132419.A45267-100000@alpha.yumyumyum.org>
In-Reply-To: <15560.14613.989930.797068@grasshopper.cs.duke.edu>

next in thread | previous in thread | raw e-mail | index | archive | help


On Thu, 25 Apr 2002, Andrew Gallatin wrote:

>
> Kenneth Culver writes:
>  > > I just looked at the NetBSD code & like linux, they use a macro which
>  > > individually pushes the registers onto the stack rather than using
>  > > pushal (which I assume is the same as what intel calls PUSHAD in their
>  > > x86 instruction set ref. manual).
>  > >
>  > > NetBSD stopped using pushal in 1994 in rev 1.85 of their
>  > > arch/i386/i386/locore.s in a commit helpfully documented
>  > > "Don't use pusha and popa."
>  > >
>  > > Does anybody know why the other OSes push the registers individually,
>  > > rather than using pushal?  Could our using pushal be causing Kenneth's
>  > > ebp to get lost, or is this just a red herring?
>  > >
>  > > Thanks,
>  > >
>  > > Drew
>  > >
>  > >
>  > >
>  > according to the intel docs, pushad (or what I'm assuming is pushal in our
>  > case) pushes eax, ecx, edx, ebx then pushes some temporary value (the
>  > original esp I think) then pushes ebp, esi, and edi:
>  >
>  > this is from the documentation for pushad
>  >
>  > IF OperandSize = 32 (* PUSHAD instruction *)
>  > THEN
>  > Temp  (ESP);
>  > Push(EAX);
>  > Push(ECX);
>  > Push(EDX);
>  > Push(EBX);
>  > Push(Temp);
>  > Push(EBP);
>  > Push(ESI);
>  > Push(EDI);
>  >
>  > so could this be the problem?
>  >
>  > Ken
>
> I don't think so.  The temp its pushing is the stack pointer.  If you
> look at the layout of the trap frame, then you'll see tf_isp comes
> between tf_ebp & tf_ebx.  I assume tf_isp is the stack pointer, so
> that should be OK..
>
> Drew
>
>
>
hrmm, well then it looks like pushal should be doing the right thing...
but I thought though that esp was the stack pointer... it's pushing the
original stack pointer onto isp, and then pushing ebp... I don't see why
this would screw anything up...

Ken


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020425132419.A45267-100000>