X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Farch%2Fx86%2Flib.c;h=f862afd2441872d6bc5242db49b408ade8bec629;hb=9edb6f7c288a93d9f9ce3f7233b577a601471071;hp=1b1a0c3fb95f313a8a7d00d4f7192270c4f38666;hpb=ca2cf2eb7207fb9c76e6d060e885d2e9e09762ec;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/arch/x86/lib.c b/KernelLand/Kernel/arch/x86/lib.c index 1b1a0c3f..f862afd2 100644 --- a/KernelLand/Kernel/arch/x86/lib.c +++ b/KernelLand/Kernel/arch/x86/lib.c @@ -85,7 +85,11 @@ void SHORTLOCK(struct sShortSpinlock *Lock) __ASM__ ("pushf;\n\tpop %0" : "=r"(IF)); IF &= 0x200; // AND out all but the interrupt flag - ASSERT( !CPU_HAS_LOCK(Lock) ); + if( CPU_HAS_LOCK(Lock) ) + { + Panic("Double lock of %p, %p req, %p has", Lock, __builtin_return_address(0), Lock->LockedBy); + for(;;); + } #if TRACE_LOCKS if( TRACE_LOCK_COND ) @@ -100,6 +104,7 @@ void SHORTLOCK(struct sShortSpinlock *Lock) // Wait for another CPU to release __AtomicTestSetLoop( (Uint*)&Lock->Lock, cpu ); Lock->IF = IF; + Lock->LockedBy = __builtin_return_address(0); #if TRACE_LOCKS if( TRACE_LOCK_COND ) @@ -346,6 +351,10 @@ DEF_DIVMOD(64); Uint64 DivMod64U(Uint64 Num, Uint64 Div, Uint64 *Rem) { + if( Div == 16 ) { + if(Rem) *Rem = Num & 15; + return Num >> 4; + } if( Div < 0x100000000ULL && Num < 0xFFFFFFFF * Div ) { Uint32 rem, ret_32; __asm__ __volatile__(