From 8ed2da7e1d43b4aba384946ad5b9779071d2a40f Mon Sep 17 00:00:00 2001 From: John Hodge Date: Tue, 4 Oct 2011 11:59:54 +0800 Subject: [PATCH] Kernel - Cleaning up unneeded messages --- Kernel/arch/x86/mm_phys.c | 4 +- Kernel/binary.c | 11 ++++- Kernel/debug.c | 4 +- Kernel/drv/pci.c | 88 +-------------------------------------- Kernel/syscalls.c | 6 +-- Kernel/system.c | 21 ++++++---- 6 files changed, 31 insertions(+), 103 deletions(-) diff --git a/Kernel/arch/x86/mm_phys.c b/Kernel/arch/x86/mm_phys.c index cd4187e5..07318362 100644 --- a/Kernel/arch/x86/mm_phys.c +++ b/Kernel/arch/x86/mm_phys.c @@ -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 ); diff --git a/Kernel/binary.c b/Kernel/binary.c index fdb4dbae..8b7e7448 100644 --- a/Kernel/binary.c +++ b/Kernel/binary.c @@ -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); diff --git a/Kernel/debug.c b/Kernel/debug.c index e0c7af87..1718d209 100644 --- a/Kernel/debug.c +++ b/Kernel/debug.c @@ -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, ...) diff --git a/Kernel/drv/pci.c b/Kernel/drv/pci.c index 2e107a79..f75b5acb 100644 --- a/Kernel/drv/pci.c +++ b/Kernel/drv/pci.c @@ -373,7 +373,8 @@ void PCI_ConfigWrite(tPCIDev ID, int Offset, int Size, Uint32 Value) dev = &gPCI_Devices[ID]; - dword = PCI_CfgReadDWord(dev->bus, dev->slot, dev->fcn, Offset/4); + if(Size != 4) + dword = PCI_CfgReadDWord(dev->bus, dev->slot, dev->fcn, Offset/4); switch(Size) { case 1: @@ -418,91 +419,6 @@ Uint32 PCI_GetBAR(tPCIDev id, int BARNum) return gPCI_Devices[id].ConfigCache[4+BARNum]; } -#if 0 -/** - * \brief Assign a port to a BAR - */ -Uint16 PCI_AssignPort(tPCIDev ID, int bar, int Count) -{ - #if 1 - Uint16 rv; - tPCIDevice *dev; - - if(id < 0 || id >= giPCI_DeviceCount) return 0; - if(bar < 0 || bar >= 6) return 0; - dev = &gPCI_Devices[id]; - - rv = PCI_CfgReadDWord( dev->bus, dev->slot, dev->fcn, 0x10+bar*4 ); - if(rv & 1) return rv & ~1; - return 0; - #else - Uint16 portVals; - int gran=0; - int i, j; - tPCIDevice *dev; - - //LogF("PCI_AssignPort: (id=%i,bar=%i,count=%i)\n", id, bar, count); - - if(id < 0 || id >= giPCI_DeviceCount) return 0; - if(bar < 0 || bar > 5) return 0; - - dev = &gPCI_Devices[id]; - - PCI_CfgWriteDWord( dev->bus, dev->slot, dev->fcn, 0x10+bar*4, -1 ); - portVals = PCI_CfgReadDWord( dev->bus, dev->slot, dev->fcn, 0x10+bar*4 ); - dev->ConfigCache[4+bar] = portVals; - //LogF(" PCI_AssignPort: portVals = 0x%x\n", portVals); - - // Check for IO port - if( !(portVals & 1) ) return 0; - - // Mask out final bit - portVals &= ~1; - - // Get Granuality - #if ARCHDIR_IS_x86 || ARCHDIR_IS_x86_64 - __asm__ __volatile__ ("bsf %%eax, %%ecx" : "=c" (gran) : "a" (portVals) ); - gran = 1 << gran; - #else - { - for(gran = 1; gran && !(portVals & gran); gran <<= 1); - } - #endif - //LogF(" PCI_AssignPort: gran = 0x%x\n", gran); - - // Find free space - portVals = 0; - for( i = 0; i < 1<<16; i += gran ) - { - for( j = 0; j < count; j ++ ) - { - if( gaPCI_PortBitmap[ (i+j)>>5 ] & 1 << ((i+j)&0x1F) ) - break; - } - if(j == count) { - portVals = i; - break; - } - } - - if(portVals) - { - for( j = 0; j < count; j ++ ) - { - if( gaPCI_PortBitmap[ (portVals+j)>>5 ] |= 1 << ((portVals+j)&0x1F) ) - break; - } - PCI_CfgWriteDWord( dev->bus, dev->slot, dev->fcn, 0x10+bar*4, portVals|1 ); - dev->ConfigCache[4+bar] = portVals|1; - } - - // Return - //LogF("PCI_AssignPort: RETURN 0x%x\n", portVals); - return portVals; - #endif -} -#endif - /** * \brief Get device information for a slot/function */ diff --git a/Kernel/syscalls.c b/Kernel/syscalls.c index 00f031fe..e304b40e 100644 --- a/Kernel/syscalls.c +++ b/Kernel/syscalls.c @@ -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 diff --git a/Kernel/system.c b/Kernel/system.c index f346d69c..986734cd 100644 --- a/Kernel/system.c +++ b/Kernel/system.c @@ -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); -- 2.20.1