Cleaning up and attempting to fix these darn heisenbugs
authorJohn Hodge <[email protected]>
Sat, 19 Jun 2010 12:56:54 +0000 (20:56 +0800)
committerJohn Hodge <[email protected]>
Sat, 19 Jun 2010 12:56:54 +0000 (20:56 +0800)
Kernel/arch/x86_64/proc.c
Kernel/heap.c
Kernel/vfs/acls.c
Usermode/Applications/login_src/main.c

index 4d50210..934bee9 100644 (file)
@@ -349,7 +349,6 @@ void Proc_Start(void)
 tThread *Proc_GetCurThread(void)
 {
        #if USE_MP
-       //return gaCPUs[ gaAPIC_to_CPU[gpMP_LocalAPIC->ID.Val&0xFF] ].Current;
        return gaCPUs[ GetCPUNum() ].Current;
        #else
        return gCurrentThread;
index 8d1db7d..1863f56 100644 (file)
@@ -136,6 +136,8 @@ void *malloc(size_t Bytes)
        // Get required size
        Bytes = (Bytes + sizeof(tHeapHead) + sizeof(tHeapFoot) + BLOCK_SIZE-1) & ~(BLOCK_SIZE-1);
        
+       //if(glHeap)
+       //      Debug("glHeap = %i", glHeap);
        // Lock Heap
        LOCK(&glHeap);
        
@@ -147,11 +149,11 @@ void *malloc(size_t Bytes)
        {
                // Alignment Check
                if( head->Size & (BLOCK_SIZE-1) ) {
+                       RELEASE(&glHeap);       // Release spinlock
                        #if WARNINGS
                        Log_Warning("Heap", "Size of heap address %p is invalid not aligned (0x%x)", head, head->Size);
                        Heap_Dump();
                        #endif
-                       RELEASE(&glHeap);
                        return NULL;
                }
                
@@ -159,11 +161,11 @@ void *malloc(size_t Bytes)
                if(head->Magic == MAGIC_USED)   continue;
                // Error check
                if(head->Magic != MAGIC_FREE)   {
+                       RELEASE(&glHeap);       // Release spinlock
                        #if WARNINGS
                        Log_Warning("Heap", "Magic of heap address %p is invalid (0x%x)", head, head->Magic);
                        Heap_Dump();
                        #endif
-                       RELEASE(&glHeap);       // Release spinlock
                        return NULL;
                }
                
@@ -177,7 +179,6 @@ void *malloc(size_t Bytes)
                        #if DEBUG_TRACE
                        Log("[Heap   ] Malloc'd %p (%i bytes), returning to %p", head->Data, head->Size,  __builtin_return_address(0));
                        #endif
-                       RELEASE(&glHeap);
                        return head->Data;
                }
                
@@ -207,10 +208,10 @@ void *malloc(size_t Bytes)
                // Check size
                if(best->Size == Bytes) {
                        best->Magic = MAGIC_USED;       // Mark block as used
+                       RELEASE(&glHeap);       // Release spinlock
                        #if DEBUG_TRACE
                        Log("[Heap   ] Malloc'd %p (%i bytes), returning to %p", best->Data, best->Size, __builtin_return_address(0));
                        #endif
-                       RELEASE(&glHeap);       // Release spinlock
                        return best->Data;
                }
        }
index 4a65be6..1c1b6cf 100644 (file)
@@ -27,7 +27,7 @@ int VFS_CheckACL(tVFS_Node *Node, Uint Permissions)
        
        // Root only file?, fast return
        if( Node->NumACLs == 0 ) {
-               Log("VFS_CheckACL - %p inaccesable, NumACLs = 0", Node);
+               Log("VFS_CheckACL - %p inaccesable, NumACLs = 0, uid=%i", Node, uid);
                return 0;
        }
        
index 456974f..353c90a 100644 (file)
@@ -18,9 +18,10 @@ int main(int argc, char *argv[])
         int    status = 0;
        tUserInfo       *uinfo;
        
+       printf("\x1B[2J");      // Clear Screen
+
        for(;;)
        {
-               printf("\x1B[2J");      // Clear Screen
                // Validate User
                for(;;)
                {

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