From: "Peter Petrakis" <voodoo@alphadriven.org>
To: "'Axp-List" <axp-list@redhat.com>
Subject: GCC inline ASM is 'evil'
Date: Tue, 12 Nov 2002 19:04:00 -0500 [thread overview]
Message-ID: <ODEEIIAMNNHHFAMGOBAPMEAMCFAA.voodoo@alphadriven.org> (raw)
Hi Guys,
There are some inline ASM bits I'm wrestling with in the EBSDK port which
I just cant seem to figure out. Now I've read the gcc docs and looked at
examples
in the kernel and I still can't seem to get it right. I'm hoping someone here
could
shed some light on my errors.
#define INLINE static
#define ASM asm
//#include <c_asm.h>
#endif
#ifndef _WIN32
#pragma inline (atomic_inc)
#endif
INLINE int atomic_inc(int source,volatile int *dest)
{
unsigned int temp=0,ret;
asm ("mb;");
while (temp==0)
{
// ret= ASM("ldl_l %v0,(%a0);", dest);
asm ( "ldl_l %0,(%16)": "=r" (ret): "p"(dest) );
temp= ASM("addl %a0,1,%v0;\
stl_c %v0,(%a1) ;",ret,dest);
}
ASM ("mb;");
return ret;
}
The ASM line that is commented out is DU inline ASM, which actually makes sense.
On the next line is my attempt :). I 'seem' to have my operands correctly
constrained, as best as I can figure. The error I get is.
../h/interlock.h:67: invalid `asm': operand number out of range
What does that mean??? I've tried so many different combinations that even if I
made the compiler error go away I wouldn't trust the code. What am I doing wrong
here? Thanks in advance.
Peter
--
www.linuxalpha.org www.alphadriven.org
Peter Petrakis Warrior/Engineer voodoo@alphadriven.org
"<BLAM!!> Who the hell are you!? Name's Ash <click clock> Housewares..."
next reply other threads:[~2002-11-13 0:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-13 0:04 Peter Petrakis [this message]
2002-11-13 0:32 ` GCC inline ASM is 'evil' Falk Hueffner
2002-11-14 6:51 ` Richard Henderson
2002-11-14 6:50 ` Richard Henderson
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox