From: John Hodge Date: Tue, 11 Oct 2011 09:00:43 +0000 (+0800) Subject: Kernel - MMU usage fixes X-Git-Tag: rel0.12~10 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=7b02384163a5b84698bb3311e869250c4717fac9;p=tpg%2Facess2.git Kernel - MMU usage fixes --- diff --git a/Kernel/debug.c b/Kernel/debug.c index e799f00f..379f6767 100644 --- a/Kernel/debug.c +++ b/Kernel/debug.c @@ -213,7 +213,7 @@ void Panic(const char *Fmt, ...) Threads_Dump(); - for(;;) HALT(); + for(;;) ; } void Debug_SetKTerminal(const char *File) diff --git a/Kernel/syscalls.c b/Kernel/syscalls.c index e304b40e..742b082a 100644 --- a/Kernel/syscalls.c +++ b/Kernel/syscalls.c @@ -68,6 +68,7 @@ void SyscallHandler(tSyscallRegs *Regs) case SYS_CLONE: // Call clone system call ret = Proc_Clone(Regs->Arg1); + Log("Proc_Clone returned %i", ret); // Change user stack if a new stack address is passed if(ret == 0 && Regs->Arg2) Regs->StackPointer = Regs->Arg2; diff --git a/Kernel/threads.c b/Kernel/threads.c index a81736b1..f586f68a 100644 --- a/Kernel/threads.c +++ b/Kernel/threads.c @@ -124,6 +124,7 @@ void Threads_Init(void) Log_Debug("Threads", "Offsets of tThread"); Log_Debug("Threads", ".Priority = %i", offsetof(tThread, Priority)); + Log_Debug("Threads", ".KernelStack = %i", offsetof(tThread, KernelStack)); // Create Initial Task #if SCHEDULER_TYPE == SCHED_RR_PRI @@ -999,7 +1000,7 @@ void Threads_SegFault(tVAddr Addr) tThread *cur = Proc_GetCurThread(); cur->bInstrTrace = 0; Log_Warning("Threads", "Thread #%i committed a segfault at address %p", cur->TID, Addr); - MM_DumpTables(0, KERNEL_BASE); + MM_DumpTables(0, USER_MAX); Threads_Fault( 1 ); //Threads_Exit( 0, -1 ); } @@ -1292,7 +1293,7 @@ tThread *Threads_GetNextToRun(int CPU, tThread *Last) } // If we fall onto the same queue again, special handling is // needed - if( Last && i == Last->Priority ) { + if( Last && Last->Status == THREAD_STAT_ACTIVE && i == Last->Priority ) { tThread *savedThread = thread; // Find the next unscheduled thread in the list diff --git a/Kernel/vfs/mmap.c b/Kernel/vfs/mmap.c index 7b4d103b..e3e6d948 100644 --- a/Kernel/vfs/mmap.c +++ b/Kernel/vfs/mmap.c @@ -130,6 +130,7 @@ void *VFS_MMap(void *DestHint, size_t Length, int Protection, int Flags, int FD, else { MM_Map( mapping_dest, pb->PhysAddrs[pagenum - pb->BaseOffset] ); + MM_RefPhys( pb->PhysAddrs[pagenum - pb->BaseOffset] ); LOG("Cached map %X to %p (%P)", pagenum*PAGE_SIZE, mapping_dest, pb->PhysAddrs[pagenum - pb->BaseOffset]); }