Code: Select all
typedef unsigned char SpinLock;
INLINE void lockSpinlock(SpinLock *sp)
{
register SpinLock tmp = 1;
do
{
__asm__ __volatile__("xchgb %0,%1"
: "=r"(tmp), "=m"(*sp)
: "0"(tmp), "1"(*sp));
} while ( tmp );
}
INLINE void unlockSpinlock(SpinLock *sp)
{
register SpinLock tmp = 0;
__asm__ __volatile__("xchgb %0,%1"
: "=r"(tmp), "=m"(*sp)
: "0"(tmp), "1"(*sp));
}
Code: Select all
#define INLINE static __inline__ __attribute__((__always_inline__))
Code: Select all
static SpinLock freePageMutex = 0;
lockSpinlock(&freePageMutex);
unlockSpinlock(&freePageMutex);
can anyone tell me whats wrong here?
if anyone can fix it for me i would be very greatfull cos im really having bad luck with my kernel at the min and i dont think i can actually fix this.