This is the mail archive of the gcc-help@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]

Inline ASM problem


Hi,

While waiting for RMS's book on gcc 2.95 to appear, I'm having
a small problem with inline ASM.  I have the following macro:

#define JmpBuf_Set(JMPBUF)\
({\
    int result;\
    int aresult;\
    JmpBuf* _the_jmp_buf = JMPBUF;\
    asm volatile ("fsave 36(%1)\n\t"\
                  "movl %%esp,(%1)\n\t"\
                  "movl %%ebp,4(%1)\n\t"\
                  "movl %%eax,12(%1)\n\t"\
                  "movl %%ebx,16(%1)\n\t"\
                  "movl %%ecx,20(%1)\n\t"\
                  "movl %%edx,24(%1)\n\t"\
                  "movl %%esi,28(%1)\n\t"\
                  "movl %%edi,32(%1)\n\t"\
                  "fwait\n\t"\
                  "movl $0f,8(%1)\n\t"\
                  "movl $0,%0\n\t"\
                  "0:" : "=&a" (aresult) :\
                  "r" (_the_jmp_buf) :\
                  "cc","memory"\
                  );\
    result = aresult;\
})


It worked with earlier versions of gcc, but doesn't want to
anymore.  gcc (2.95.2) barfs with:

SomeFile.c:20: Invalid `asm' statement:
SomeFile.c:20: fixed or forbidden register 0 (ax) was spilled for class AREG.

I've tried various variations on input/output operands with little
success.  The clobbered bit used to include "eax" as well, but was
removed to try and cure the problem (without success).

Any help much appreciated.

Thanks,
  Fred.

-- 
Fred Barnes, PhD research student, UKC.  http://teddy.xylene.com/
frmb2@ukc.ac.uk         http://www.cs.ukc.ac.uk/people/rpg/frmb2/

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