On Tue, Aug 15, 2000 at 04:44:37PM -0700, Richard Hecker wrote:
> I ran into a compiler error that I do not recognize.  Instead of
> spinning my wheels further with this, I was hoping someone familiar
> with Intel assembly language on this list could shed some light on
> what is happening here.  As can be seen from the comments, it is
> an ancient line that was lifted from the kernel.  For this reason
> I am including the output from gcc -v.
> 
> gcc -o 6x86_reg 6x86_reg.c
> 6x86_reg.c: In function `delay':
> 6x86_reg.c:86: Invalid `asm' statement:
> 6x86_reg.c:86: fixed or forbidden register 0 (ax) was spilled for class
> AREG.
> 
> --- routine in the C source file ---
> /* the original bogomips code from the Linux kernel */
> static __inline__ void delay(int loops)
> {
>   __asm__(".align 2,0x90\n1:\tdecl %0\n\tjns 1b": :"a" (loops):"ax");
> }

I am not an assembly guru on any architecture, but here's what I think this
means.  Please be warned that these could be the ravings of a deranged
lunatic.

The AX register is an old 16-bit register from 8086 days.  When you're
running in 32-bit mode, as all Linux systems do, the register should be
accessed by its 32-bit name, EAX.

I think at some point gcc (or gas) used to automatically convert such
misreferences.  There's a whole slew of register names on the IA32 from the
old 16-bit days that have a 32-bit version with the "E" prepended.

(I think, in some contexts, you can actually use the 16-bit register names
to fetch the low-order 16 bits out of the actual 32-bit register.)

Hopefully someone who has actual knowledge will be able to answer your
question.  Maybe Randolph Chung, who works for Intel?  :)

-- 
G. Branden Robinson             |    A committee is a life form with six or
Debian GNU/Linux                |    more legs and no brain.
[EMAIL PROTECTED]              |    -- Robert Heinlein
http://www.debian.org/~branden/ |

Attachment: pgpSuAivy5wCg.pgp
Description: PGP signature

Reply via email to