grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Failed to build grub2


From: Bean
Subject: Re: Failed to build grub2
Date: Wed, 26 Dec 2007 19:13:22 +0800

On Dec 26, 2007 3:17 PM, Robert Millan <address@hidden> wrote:
> On Tue, Dec 25, 2007 at 07:37:04PM +0800, Bean wrote:
> >
> > I use the 32-bit address to save space, maybe your compiler doesn't
> > support it. anyway, you can try the following transformation:
> >
> > leal  0x200 + data_start - data_next(%ebx,%eax), %eax
> >
> > ->
> >
> > addl %ebx, %eax
> > addl $(0x200 + data_start - data_next), %eax
> >
> > -----------
> >
> > leal  (%esi, %eax), %esi
> > leal  (%edi, %eax), %edi
> >
> > ->
> >
> > addl %eax, %esi
> > addl %eax, %edi
>
> I think it has more to do with the op being "leal" instead of "leaw" than
> with the addressing argument having 3 members.

It's a trick to do fast arithmetic using the 32-bit address mode, for example,

leal    10 (%ebx, %eax, 4) , %ecx

means

%ecx = %ebx + %eax * 4 + 10

But some assembler might not allow to use 32-bit address in 16-bit
mode, so you can follow the slow path, for example,

movl   %eax, %ecx
shll    $2, %ecx
addl   %ebx, %ecx
addl   $10, %ecx

The two code segment will get the same result, but the second one
doesn't use 32-bit address , so it wouldn't trigger an error.

-- 
Bean




reply via email to

[Prev in Thread] Current Thread [Next in Thread]