This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

What so special about i386's bx?


Hi,  (please cc me - I'm off the list)

When compiling this code: (x86, linux)
-----------------
int
_llseek (unsigned int fd, unsigned long offset_high, unsigned
offset_low,
         loff_t* result, unsigned int origin)
{
        long __res;

__asm__ __volatile__ ("int $0x80"
        : "=a" (__res)
        : "0" (__NR__llseek),
          "b" ((long)(fd)),
          "c" ((long)(offset_high)),
          "d" ((long)(offset_low)),
          "S" ((long)(result)),
          "D" ((long)(origin))
);

__syscall_return(int,__res);
}
------------------
gcc gives this error message:

llseek.c:86: Invalid `asm' statement:
llseek.c:86: fixed or forbidden register 3 (bx) was spilled for class
BREG.

If I comment out the "b" ((long)(fd)) line, it compiles without
complaint.
Or, if I change the "b" to some other register, it also compiles.  It's
only bx it complains about.

What does "spilled" mean?  AFAIK, bx won't get clobbered by the "int
0x80"
- I assume it's refering to the fact that bx will have to be overwritten
with "fd".  Correct?

Any ideas on what the problem is?

Andrew Clausen


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]