Subject: Re: x86 assembly again
To: Frank van der Linden <fvdl@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: port-i386
Date: 03/16/2005 12:21:12
On Wed, Mar 16, 2005 at 05:16:36AM +0100, Frank van der Linden wrote:
> On Wed, Mar 16, 2005 at 01:47:16AM +0100, Manuel Bouyer wrote:
> > again, I'd like some sanity checks on my assembly though.
> > I think in this piece of code:
> > IDTVEC(spllower)
> > #if defined(DDB) || defined(GPROF)
> >         pushl   %ebp
> >         movl    %esp,%ebp
> >         MCOUNT_ASM
> > #endif /* defined(DDB) || defined(GPROF) */
> >         pushl   %ebx
> >         pushl   %esi
> >         pushl   %edi
> >         pushl   %ecx
> > #if defined(DDB) || defined(GPROF)
> >         movl    8(%ebp),%ebx
> > #else /* defined(DDB) || defined(GPROF) */
> >         movl    16(%esp),%ebx
> > #endif /* defined(DDB) || defined(GPROF) */
> > 
> > the movl 16(%esp),%ebx is broken, it should be 20. However the
> > DDB | GPROF case is right, as we saved %esp in %ebp before pushing more
> > registers.
> 
> That's right. It seems that you added the pushl %ecx (that's not in
> the code currently in the tree),

This is in the xen spl.S; %ecx is also saved because it's used later.

> so you need to add 4 to the %esp offset.
> The %ebp offset remains unchanged, since it's not affected by the extra
> pushl.

OK, thanks. I'll commit this.

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--