From: John Hodge Date: Sun, 3 Jul 2011 03:21:01 +0000 (+0800) Subject: Kernel - Absently cleaning up (minor presentation changes) X-Git-Tag: rel0.10~49 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=f79073d5ab322eef0813f7b05af0d31174d2c9d6;p=tpg%2Facess2.git Kernel - Absently cleaning up (minor presentation changes) --- diff --git a/Kernel/arch/x86/mm_virt.c b/Kernel/arch/x86/mm_virt.c index 8c59ea0f..62ae08eb 100644 --- a/Kernel/arch/x86/mm_virt.c +++ b/Kernel/arch/x86/mm_virt.c @@ -185,8 +185,7 @@ void MM_PageFault(tVAddr Addr, Uint ErrorCode, tRegs *Regs) //ENTER("xAddr bErrorCode", Addr, ErrorCode); // -- Check for COW -- - if( gaPageDir [Addr>>22] & PF_PRESENT - && gaPageTable[Addr>>12] & PF_PRESENT + if( gaPageDir [Addr>>22] & PF_PRESENT && gaPageTable[Addr>>12] & PF_PRESENT && gaPageTable[Addr>>12] & PF_COW ) { tPAddr paddr; @@ -205,7 +204,6 @@ void MM_PageFault(tVAddr Addr, Uint ErrorCode, tRegs *Regs) } INVLPG( Addr & ~0xFFF ); - //LEAVE('-') return; } @@ -356,19 +354,16 @@ tPAddr MM_Allocate(tVAddr VAddr) { // Allocate directory paddr = MM_AllocPhys(); - //LOG("paddr = 0x%llx (new table)", paddr); if( paddr == 0 ) { Warning("MM_Allocate - Out of Memory (Called by %p)", __builtin_return_address(0)); //LEAVE('i',0); return 0; } - // Map + // Map and mark as user (if needed) gaPageDir[ VAddr >> 22 ] = paddr | 3; - // Mark as user if(VAddr < MM_USER_MAX) gaPageDir[ VAddr >> 22 ] |= PF_USER; INVLPG( &gaPageDir[ VAddr >> 22 ] ); - //LOG("Clearing new table"); memsetd( &gaPageTable[ (VAddr >> 12) & ~0x3FF ], 0, 1024 ); } // Check if the page is already allocated @@ -502,7 +497,6 @@ tVAddr MM_ClearUser(void) { Uint i, j; - // Copy Directories for( i = 0; i < (MM_USER_MAX>>22); i ++ ) { // Check if directory is not allocated @@ -511,7 +505,7 @@ tVAddr MM_ClearUser(void) continue; } - + // Deallocate tables for( j = 0; j < 1024; j ++ ) { if( gaPageTable[i*1024+j] & 1 ) @@ -519,6 +513,7 @@ tVAddr MM_ClearUser(void) gaPageTable[i*1024+j] = 0; } + // Deallocate directory MM_DerefPhys( gaPageDir[i] & ~0xFFF ); gaPageDir[i] = 0; INVLPG( &gaPageTable[i*1024] ); diff --git a/Kernel/debug.c b/Kernel/debug.c index 7915b869..3e5ac0a9 100644 --- a/Kernel/debug.c +++ b/Kernel/debug.c @@ -389,18 +389,20 @@ void Debug_HexDump(const char *Header, const void *Data, Uint Length) Uint pos = 0; LogF("%014lli ", now()); Debug_Puts(1, Header); - LogF(" (Hexdump of %p)\r\n", Data); + LogF(" (Hexdump of %p)\n", Data); #define CH(n) ((' '<=cdat[(n)]&&cdat[(n)]<0x7F) ? cdat[(n)] : '.') while(Length >= 16) { - Log("%04x: %02x %02x %02x %02x %02x %02x %02x %02x" + LogF("%014lli Log: %04x:" " %02x %02x %02x %02x %02x %02x %02x %02x" - " %c%c%c%c%c%c%c%c %c%c%c%c%c%c%c%c", + " %02x %02x %02x %02x %02x %02x %02x %02x" + " %c%c%c%c%c%c%c%c %c%c%c%c%c%c%c%c\n", + now(), pos, - cdat[0], cdat[1], cdat[2], cdat[3], cdat[4], cdat[5], cdat[6], cdat[7], - cdat[8], cdat[9], cdat[10], cdat[11], cdat[12], cdat[13], cdat[14], cdat[15], + cdat[ 0], cdat[ 1], cdat[ 2], cdat[ 3], cdat[ 4], cdat[ 5], cdat[ 6], cdat[ 7], + cdat[ 8], cdat[ 9], cdat[10], cdat[11], cdat[12], cdat[13], cdat[14], cdat[15], CH(0), CH(1), CH(2), CH(3), CH(4), CH(5), CH(6), CH(7), CH(8), CH(9), CH(10), CH(11), CH(12), CH(13), CH(14), CH(15) ); @@ -423,10 +425,9 @@ void Debug_HexDump(const char *Header, const void *Data, Uint Length) if( i == 8 ) LogF(" "); LogF("%c", CH(i)); } - } - Debug_Putchar('\r'); - Debug_Putchar('\n'); + Debug_Putchar('\n'); + } } // --- EXPORTS --- diff --git a/Kernel/threads.c b/Kernel/threads.c index bee332b5..3ebc4dc6 100644 --- a/Kernel/threads.c +++ b/Kernel/threads.c @@ -953,8 +953,6 @@ void Threads_Fault(int Num) { tThread *thread = Proc_GetCurThread(); - Log_Log("Threads", "Threads_Fault: thread = %p", thread); - if(!thread) return ; Log_Log("Threads", "Threads_Fault: thread->FaultHandler = %p", thread->FaultHandler);