This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
i386, asm and forbidden spilled registers...
- To: egcs at cygnus dot com
- Subject: i386, asm and forbidden spilled registers...
- From: Krister Walfridsson <cato at df dot lth dot se>
- Date: Fri, 30 Oct 1998 23:38:55 +0100 (MET)
I tried to compile the NetBSD i386 kernel with a egcs built from todays
source. Egcs complains on most asm statements, but I don't understand
why...
For example, the following code gives the error
foo.c:7: Invalid `asm' statement:
foo.c:7: fixed or forbidden register 2 (cx) was spilled for class CREG.
static __inline void
insb(int port, void *addr, int cnt)
{
__asm __volatile("cld\n\trepne\n\tinsb" :
:
"d" (port), "D" (addr), "c" (cnt) :
"%edi", "%ecx", "memory");
}
void
foo(void)
{
insb(0,0,0);
}
Are there some kind of documentation somewhere how to write correct asm
statements? I didn't find anything relevant in the gcc info files...
/Krister