Kernel - Cleaning up unneeded messages
authorJohn Hodge <[email protected]>
Tue, 4 Oct 2011 03:59:54 +0000 (11:59 +0800)
committerJohn Hodge <[email protected]>
Tue, 4 Oct 2011 03:59:54 +0000 (11:59 +0800)
Kernel/arch/x86/mm_phys.c
Kernel/binary.c
Kernel/debug.c
Kernel/drv/pci.c
Kernel/syscalls.c
Kernel/system.c

index cd4187e..0731836 100644 (file)
@@ -420,10 +420,10 @@ void MM_RefPhys(tPAddr PAddr)
                {
                         int    i, base;
                        tVAddr  addr = ((tVAddr)&gaPageReferences[PAddr]) & ~0xFFF;
-                       Log_Debug("PMem", "MM_RefPhys: Allocating info for %X", PAddr);
+//                     Log_Debug("PMem", "MM_RefPhys: Allocating info for %X", PAddr);
                        Mutex_Release( &glPhysAlloc );
                        if( MM_Allocate( addr ) == 0 ) {
-                               Log_KernelPanic("PMem", "MM_RefPhys: Out of physical memory");
+                               Log_KernelPanic("PMem", "MM_RefPhys: Out of physical memory allocating info for %X", PAddr*PAGE_SIZE);
                        }
                        Mutex_Acquire( &glPhysAlloc );
                        
index fdb4dba..8b7e744 100644 (file)
@@ -414,7 +414,7 @@ tBinary *Binary_DoLoad(tMount MountID, tInode Inode, const char *Path)
 {
        tBinary *pBinary;
         int    fp;
-       Uint    ident;
+       Uint32  ident;
        tBinaryType     *bt = gRegBinTypes;
        
        ENTER("iMountID XInode sPath", MountID, Inode, Path);
@@ -426,19 +426,26 @@ tBinary *Binary_DoLoad(tMount MountID, tInode Inode, const char *Path)
                LEAVE('n');
                return NULL;
        }
+
+       LOG("fp = 0x%x", fp);
        
        // Read File Type
        VFS_Read(fp, 4, &ident);
        VFS_Seek(fp, 0, SEEK_SET);
 
+       LOG("ident = 0x%x", ident);
+
        // Determine the type   
        for(; bt; bt = bt->Next)
        {
-               if( (ident & bt->Mask) != (Uint)bt->Ident )
+               if( (ident & bt->Mask) != (Uint32)bt->Ident )
                        continue;
+               LOG("bt = %p (%s)", bt, bt->Name);
                pBinary = bt->Load(fp);
                break;
        }
+
+       LOG("pBinary = %p", pBinary);
        
        // Close File
        VFS_Close(fp);
index e0c7af8..1718d20 100644 (file)
@@ -228,9 +228,9 @@ void Debug_SetKTerminal(const char *File)
                VFS_Close(tmp);
        }
        tmp = VFS_Open(File, VFS_OPENFLAG_WRITE);
-       Log_Log("Debug", "Opened '%s' as 0x%x", File, tmp);
+//     Log_Log("Debug", "Opened '%s' as 0x%x", File, tmp);
        giDebug_KTerm = tmp;
-       Log_Log("Debug", "Returning to %p", __builtin_return_address(0));
+//     Log_Log("Debug", "Returning to %p", __builtin_return_address(0));
 }
 
 void Debug_Enter(const char *FuncName, const char *ArgTypes, ...)
index 2e107a7..f75b5ac 100644 (file)
@@ -373,7 +373,8 @@ void PCI_ConfigWrite(tPCIDev ID, int Offset, int Size, Uint32 Value)
        \r
        dev = &gPCI_Devices[ID];\r
 \r
-       dword = PCI_CfgReadDWord(dev->bus, dev->slot, dev->fcn, Offset/4);\r
+       if(Size != 4)\r
+               dword = PCI_CfgReadDWord(dev->bus, dev->slot, dev->fcn, Offset/4);\r
        switch(Size)\r
        {\r
        case 1:\r
@@ -418,91 +419,6 @@ Uint32 PCI_GetBAR(tPCIDev id, int BARNum)
        return gPCI_Devices[id].ConfigCache[4+BARNum];\r
 }\r
 \r
-#if 0\r
-/**\r
- * \brief Assign a port to a BAR\r
- */\r
-Uint16 PCI_AssignPort(tPCIDev ID, int bar, int Count)\r
-{\r
-       #if 1\r
-       Uint16  rv;\r
-       tPCIDevice      *dev;\r
-       \r
-       if(id < 0 || id >= giPCI_DeviceCount)   return 0;\r
-       if(bar < 0 || bar >= 6) return 0;\r
-       dev = &gPCI_Devices[id];\r
-       \r
-       rv = PCI_CfgReadDWord( dev->bus, dev->slot, dev->fcn, 0x10+bar*4 );\r
-       if(rv & 1)      return rv & ~1;\r
-       return 0;\r
-       #else\r
-       Uint16  portVals;\r
-        int    gran=0;\r
-        int    i, j;\r
-       tPCIDevice      *dev;\r
-       \r
-       //LogF("PCI_AssignPort: (id=%i,bar=%i,count=%i)\n", id, bar, count);\r
-       \r
-       if(id < 0 || id >= giPCI_DeviceCount)   return 0;\r
-       if(bar < 0 || bar > 5)  return 0;\r
-       \r
-       dev = &gPCI_Devices[id];\r
-       \r
-       PCI_CfgWriteDWord( dev->bus, dev->slot, dev->fcn, 0x10+bar*4, -1 );\r
-       portVals = PCI_CfgReadDWord( dev->bus, dev->slot, dev->fcn, 0x10+bar*4 );\r
-       dev->ConfigCache[4+bar] = portVals;\r
-       //LogF(" PCI_AssignPort: portVals = 0x%x\n", portVals);\r
-       \r
-       // Check for IO port\r
-       if( !(portVals & 1) )   return 0;\r
-       \r
-       // Mask out final bit\r
-       portVals &= ~1;\r
-       \r
-       // Get Granuality\r
-       #if ARCHDIR_IS_x86 || ARCHDIR_IS_x86_64\r
-       __asm__ __volatile__ ("bsf %%eax, %%ecx" : "=c" (gran) : "a" (portVals) );\r
-       gran = 1 << gran;\r
-       #else\r
-       {\r
-               for(gran = 1; gran && !(portVals & gran); gran <<= 1);\r
-       }\r
-       #endif\r
-       //LogF(" PCI_AssignPort: gran = 0x%x\n", gran);\r
-       \r
-       // Find free space\r
-       portVals = 0;\r
-       for( i = 0; i < 1<<16; i += gran )\r
-       {\r
-               for( j = 0; j < count; j ++ )\r
-               {\r
-                       if( gaPCI_PortBitmap[ (i+j)>>5 ] & 1 << ((i+j)&0x1F) )\r
-                               break;\r
-               }\r
-               if(j == count) {\r
-                       portVals = i;\r
-                       break;\r
-               }\r
-       }\r
-       \r
-       if(portVals)\r
-       {\r
-               for( j = 0; j < count; j ++ )\r
-               {\r
-                       if( gaPCI_PortBitmap[ (portVals+j)>>5 ] |= 1 << ((portVals+j)&0x1F) )\r
-                               break;\r
-               }\r
-               PCI_CfgWriteDWord( dev->bus, dev->slot, dev->fcn, 0x10+bar*4, portVals|1 );\r
-               dev->ConfigCache[4+bar] = portVals|1;\r
-       }\r
-       \r
-       // Return\r
-       //LogF("PCI_AssignPort: RETURN 0x%x\n", portVals);\r
-       return portVals;\r
-       #endif\r
-}\r
-#endif\r
-\r
 /**\r
  * \brief Get device information for a slot/function\r
  */\r
index 00f031f..e304b40 100644 (file)
@@ -350,10 +350,10 @@ void SyscallHandler(tSyscallRegs *Regs)
        if( callNum != SYS_READ && callNum != SYS_WRITE ) {
        # endif
        LOG("err = %i", err);
-       if(Regs->Num != SYS_EXECVE)
-               LEAVE('x', ret);
-       else
+       if( callNum == SYS_EXECVE )
                LOG("Actual %i", ret);
+       else
+               LEAVE('x', ret);
        # if DEBUG < 2
        }
        # endif
index f346d69..986734c 100644 (file)
@@ -164,7 +164,7 @@ void System_ExecuteCommandLine(void)
         int    i;
        for( i = 0; i < argc; i++ )
        {
-               Log("argv[%i] = '%s'", i, argv[i]);
+               LOG("argv[%i] = '%s'", i, argv[i]);
                switch(argv[i][0])
                {
                // --- VFS ---
@@ -317,17 +317,20 @@ void System_ExecuteScript(void)
        tConfigFile     *file;
        tConfigLine     *line;
        
+       ENTER("");
+
        // Open Script
        fp = VFS_Open(gsConfigScript, VFS_OPENFLAG_READ);
        if(fp == -1) {
                Log_Warning("Config", "Passed script '%s' does not exist", gsConfigScript);
+               LEAVE('-');
                return;
        }
        
        // Get length
        VFS_Seek(fp, 0, SEEK_END);
        fLen = VFS_Tell(fp);
-       Log_Debug("System", "VFS_Tell(%i) = %i", fp, fLen);
+       LOG("VFS_Tell(0x%x) = %i", fp, fLen);
        VFS_Seek(fp, 0, SEEK_SET);
        // Read into memory buffer
        fData = malloc(fLen+1);
@@ -350,7 +353,7 @@ void System_ExecuteScript(void)
                // Prescan and eliminate variables
                for( j = 1; j < line->nParts; j++ )
                {
-                       Log_Debug("Config", "Arg #%i is '%s'", j, line->Parts[j]);
+                       LOG("Arg #%i is '%s'", j, line->Parts[j]);
                        bReplaced[j] = 0;
                        if( line->Parts[j][0] != '$' )  continue;
                        if( line->Parts[j][1] == '?' ) {
@@ -361,7 +364,7 @@ void System_ExecuteScript(void)
                                if( val < 0 || val > N_VARIABLES )      continue;
                                val = variables[ val ];
                        }
-                       Log_Debug("Config", "Replaced arg %i ('%s') with 0x%x", j, line->Parts[j], val);
+                       LOG("Replaced arg %i ('%s') with 0x%x", j, line->Parts[j], val);
                        line->Parts[j] = malloc( BITS/8+2+1 );
                        sprintf(line->Parts[j], "0x%x", val);
                        bReplaced[j] = 1;
@@ -408,7 +411,7 @@ void System_ExecuteScript(void)
                                else {
                                        args[k] = (char *)line->Parts[k+1];
                                }
-                               Log_Debug("Config", "args[%i] = %p", k, args[k]);
+                               LOG("args[%i] = %p", k, args[k]);
                        }
                        switch( (enum eConfigCommands) caConfigCommands[j].Index )
                        {
@@ -438,7 +441,7 @@ void System_ExecuteScript(void)
                                result = VFS_IOCtl( (Uint)args[0], (Uint)args[1], (void *)args[2] );
                                break;
                        }
-                       Log_Debug("Config", "result = %i", result);
+                       LOG("Config", "result = %i", result);
                        break;
                }
                if( j < NUM_CONFIG_COMMANDS )   continue;
@@ -541,6 +544,8 @@ void System_ExecuteScript(void)
        // Free data
        free( file );
        free( fData );
+       
+       LEAVE('-');
 }
 
 /**
@@ -550,7 +555,7 @@ void System_ExecuteScript(void)
  * \return ::tConfigFile structure that represents the original contents
  *         of \a FileData
  */
-tConfigFile    *System_Int_ParseFile(char *FileData)
+tConfigFile *System_Int_ParseFile(char *FileData)
 {
        char    *ptr;
        char    *start;
@@ -688,7 +693,7 @@ tConfigFile *System_Int_ParseFile(char *FileData)
        if( i < ret->nLines ) {
                ret->Lines[i].nParts = 0;
                ret->Lines[i].Parts = NULL;
-               Log_Log("System", "Cleaning up final empty line");
+               LOG("Cleaning up final empty line");
        }
        
        LEAVE('p', ret);

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