public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "F.R.M.Barnes" <frmb2@ukc.ac.uk>
To: help-gcc@gnu.org
Subject: Inline ASM problem
Date: Fri, 07 Jan 2000 16:49:00 -0000	[thread overview]
Message-ID: <855lo8$fnh$1@spruce.ukc.ac.uk> (raw)

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/

WARNING: multiple messages have this Message-ID
From: "F.R.M.Barnes" <frmb2@ukc.ac.uk>
To: help-gcc@gnu.org
Subject: Inline ASM problem
Date: Sat, 01 Apr 2000 00:00:00 -0000	[thread overview]
Message-ID: <855lo8$fnh$1@spruce.ukc.ac.uk> (raw)
Message-ID: <20000401000000.89ROb_9mQqNNy-Gt8UlvSo5YecB3ExgrRZybu-psyic@z> (raw)

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/

             reply	other threads:[~2000-01-07 16:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-07 16:49 F.R.M.Barnes [this message]
2000-04-01  0:00 ` F.R.M.Barnes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='855lo8$fnh$1@spruce.ukc.ac.uk' \
    --to=frmb2@ukc.ac.uk \
    --cc=help-gcc@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).