public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Inline ASM problem
@ 2000-01-07 16:49 F.R.M.Barnes
  2000-04-01  0:00 ` F.R.M.Barnes
  0 siblings, 1 reply; 2+ messages in thread
From: F.R.M.Barnes @ 2000-01-07 16:49 UTC (permalink / raw)
  To: help-gcc

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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Inline ASM problem
  2000-01-07 16:49 Inline ASM problem F.R.M.Barnes
@ 2000-04-01  0:00 ` F.R.M.Barnes
  0 siblings, 0 replies; 2+ messages in thread
From: F.R.M.Barnes @ 2000-04-01  0:00 UTC (permalink / raw)
  To: help-gcc

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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-04-01  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-07 16:49 Inline ASM problem F.R.M.Barnes
2000-04-01  0:00 ` F.R.M.Barnes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).