x86_64 build working with new compiler
[tpg/acess2.git] / KernelLand / Kernel / arch / x86_64 / lib.c
index b35db69..977cffd 100644 (file)
@@ -146,6 +146,18 @@ void SHORTREL(struct sShortSpinlock *Lock)
        #endif
 }
 
+void __AtomicTestSetLoop(Uint *Ptr, Uint Value)
+{
+       __ASM__(
+               "1:\n\t"
+               "xor %%eax, %%eax;\n\t"
+               "lock cmpxchg %0, (%1);\n\t"    // if( Ptr==0 ) { ZF=1; Ptr=Value } else { ZF=0; _=Ptr }
+               "jnz 1b;\n\t"
+               :: "r"(Value), "r"(Ptr)
+               : "eax" // EAX clobbered
+               );
+}
+
 // === DEBUG IO ===
 #if USE_GDB_STUB
 void initGdbSerial(void)

UCC git Repository :: git.ucc.asn.au