X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Farch%2Fx86%2Flib.c;h=3d951d462cb1ac49109d21082083cfd3f67e5a59;hb=310d4fe3f4d96ef804a27463bc43df9acb28757a;hp=2160805c4e81ee298712a01b7a699ecb2bbbbdfb;hpb=02cbaac1233be9c5228973a787431fa5e0aa178e;p=tpg%2Facess2.git diff --git a/Kernel/arch/x86/lib.c b/Kernel/arch/x86/lib.c index 2160805c..3d951d46 100644 --- a/Kernel/arch/x86/lib.c +++ b/Kernel/arch/x86/lib.c @@ -5,7 +5,11 @@ #include #include -#define TRACE_LOCKS 1 +#define TRACE_LOCKS 0 + +#if TRACE_LOCKS +extern struct sShortSpinlock glDebug_Lock; +#endif extern int GetCPUNum(void); @@ -107,7 +111,11 @@ void SHORTLOCK(struct sShortSpinlock *Lock) #endif #if TRACE_LOCKS - Log_Log("LOCK", "%p locked by %p\n", Lock, __builtin_return_address(0)); + if( Lock != &glDebug_Lock ) + { + //Log_Log("LOCK", "%p locked by %p", Lock, __builtin_return_address(0)); + LogF("Lock %p locked by %p\n", Lock, __builtin_return_address(0)); + } #endif } /** @@ -115,11 +123,7 @@ void SHORTLOCK(struct sShortSpinlock *Lock) * \param Lock Lock pointer */ void SHORTREL(struct sShortSpinlock *Lock) -{ - #if TRACE_LOCKS - Log_Log("LOCK", "%p released by %p\n", Lock, __builtin_return_address(0)); - #endif - +{ #if STACKED_LOCKS if( Lock->Depth ) { Lock->Depth --; @@ -127,6 +131,14 @@ void SHORTREL(struct sShortSpinlock *Lock) } #endif + #if TRACE_LOCKS + if( Lock != &glDebug_Lock ) + { + //Log_Log("LOCK", "%p released by %p", Lock, __builtin_return_address(0)); + LogF("Lock %p released by %p\n", Lock, __builtin_return_address(0)); + } + #endif + #if LOCK_DISABLE_INTS // Lock->IF can change anytime once Lock->Lock is zeroed if(Lock->IF) { @@ -270,6 +282,21 @@ Uint64 __udivdi3(Uint64 Num, Uint64 Den) if(Num < Den*2) return 1; if(Num == Den*2) return 2; + #if 1 + i = 0; // Shut up + P[0] = Num; + P[1] = Den; + __asm__ __volatile__ ( + "fildq %2\n\t" // Num + "fildq %1\n\t" // Den + "fdivp\n\t" + "fistpq %0" + : "=m" (q) + : "m" (P[0]), "m" (P[1]) + ); + + //Log("%llx / %llx = %llx\n", Num, Den, q); + #else // Restoring division, from wikipedia // http://en.wikipedia.org/wiki/Division_(digital) P[0] = Num; P[1] = 0; @@ -291,6 +318,7 @@ Uint64 __udivdi3(Uint64 Num, Uint64 Den) P[1] += Den; } } + #endif return q; }