Kernel - MMU usage fixes
authorJohn Hodge <[email protected]>
Tue, 11 Oct 2011 09:00:43 +0000 (17:00 +0800)
committerJohn Hodge <[email protected]>
Tue, 11 Oct 2011 09:00:43 +0000 (17:00 +0800)
Kernel/debug.c
Kernel/syscalls.c
Kernel/threads.c
Kernel/vfs/mmap.c

index e799f00..379f676 100644 (file)
@@ -213,7 +213,7 @@ void Panic(const char *Fmt, ...)
 
        Threads_Dump();
 
-       for(;;) HALT();
+       for(;;) ;
 }
 
 void Debug_SetKTerminal(const char *File)
index e304b40..742b082 100644 (file)
@@ -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;
index a81736b..f586f68 100644 (file)
@@ -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
index 7b4d103..e3e6d94 100644 (file)
@@ -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]);
                        }

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