Subject: Re: x86 assembly again
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Frank van der Linden <fvdl@netbsd.org>
List: port-i386
Date: 03/16/2005 05:16:36
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), so you need to add 4 to the %esp offset.
The %ebp offset remains unchanged, since it's not affected by the extra
pushl.

- Frank