Cleanup (debug statements removed)
[tpg/acess2.git] / Kernel / arch / x86 / lib.c
index 2160805..3d951d4 100644 (file)
@@ -5,7 +5,11 @@
 #include <acess.h>
 #include <threads.h>
 
-#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;
 }

UCC git Repository :: git.ucc.asn.au