summaryrefslogtreecommitdiff
path: root/x86.h
diff options
context:
space:
mode:
Diffstat (limited to 'x86.h')
-rw-r--r--x86.h29
1 files changed, 5 insertions, 24 deletions
diff --git a/x86.h b/x86.h
index a1c66b5..1f2c881 100644
--- a/x86.h
+++ b/x86.h
@@ -96,35 +96,16 @@ write_eflags(uint eflags)
asm volatile("pushl %0; popfl" : : "r" (eflags));
}
-// XXX: Kill this if not used.
-static inline void
-cpuid(uint info, uint *eaxp, uint *ebxp, uint *ecxp, uint *edxp)
-{
- uint eax, ebx, ecx, edx;
-
- asm volatile("cpuid" :
- "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) :
- "a" (info));
- if(eaxp)
- *eaxp = eax;
- if(ebxp)
- *ebxp = ebx;
- if(ecxp)
- *ecxp = ecx;
- if(edxp)
- *edxp = edx;
-}
-
static inline uint
-cmpxchg(uint oldval, uint newval, volatile uint* lock_addr)
+xchg(volatile uint *addr, uint newval)
{
uint result;
// The + in "+m" denotes a read-modify-write operand.
- asm volatile("lock; cmpxchgl %2, %0" :
- "+m" (*lock_addr), "=a" (result) :
- "r"(newval), "1"(oldval) :
- "cc");
+ asm volatile("lock; xchgl %0, %1" :
+ "+m" (*addr), "=a" (result) :
+ "1" (newval) :
+ "cc");
return result;
}