Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* GCC inline ASM is 'evil'
@ 2002-11-13  0:04 Peter Petrakis
  2002-11-13  0:32 ` Falk Hueffner
  2002-11-14  6:50 ` Richard Henderson
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Petrakis @ 2002-11-13  0:04 UTC (permalink / raw)
  To: 'Axp-List

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..."




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

end of thread, other threads:[~2002-11-14  6:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-13  0:04 GCC inline ASM is 'evil' Peter Petrakis
2002-11-13  0:32 ` Falk Hueffner
2002-11-14  6:51   ` Richard Henderson
2002-11-14  6:50 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox