X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Farch%2Fx86_64%2Flib.c;h=da9955c9d4dc02530402b157799293390456cd9d;hb=8a8a744341df513d00d2e60adf5e88636856e65b;hp=dcd6ec3a4b7badfe99cec25cbfa3e60c00ea429c;hpb=8405ea0115d6b242fb1fb5ad314de89974a8eaf8;p=tpg%2Facess2.git diff --git a/Kernel/arch/x86_64/lib.c b/Kernel/arch/x86_64/lib.c index dcd6ec3a..da9955c9 100644 --- a/Kernel/arch/x86_64/lib.c +++ b/Kernel/arch/x86_64/lib.c @@ -5,6 +5,7 @@ // === IMPORTS === extern int GetCPUNum(void); +extern void *Proc_GetCurThread(void); // === CODE === /** @@ -58,7 +59,7 @@ void SHORTLOCK(struct sShortSpinlock *Lock) #if LOCK_DISABLE_INTS // Save interrupt state and clear interrupts - __ASM__ ("pushf;\n\tpop %%eax\n\tcli" : "=a"(IF)); + __ASM__ ("pushf;\n\tpop %0" : "=r"(IF)); IF &= 0x200; // AND out all but the interrupt flag #endif @@ -85,16 +86,21 @@ void SHORTLOCK(struct sShortSpinlock *Lock) : "a"(0), "r"(cpu), "r"(&Lock->Lock) ); #elif STACKED_LOCKS == 2 - __ASM__("lock cmpxchgl %2, (%3)" + __ASM__("lock cmpxchgq %2, (%3)" : "=a"(v) : "a"(0), "r"(thread), "r"(&Lock->Lock) ); #else - __ASM__("xchgl %%eax, (%%edi)":"=a"(v):"a"(1),"D"(&Lock->Lock)); + __ASM__("xchgl %0, (%2)":"=a"(v):"a"(1),"D"(&Lock->Lock)); + #endif + + #if LOCK_DISABLE_INTS + if( v ) __ASM__("sti"); // Re-enable interrupts #endif } #if LOCK_DISABLE_INTS + __ASM__("cli"); Lock->IF = IF; #endif }