Skip to content
Snippets Groups Projects
Commit 7b023841 authored by John Hodge's avatar John Hodge
Browse files

Kernel - MMU usage fixes

parent f086aa01
Branches
Tags
No related merge requests found
......@@ -213,7 +213,7 @@ void Panic(const char *Fmt, ...)
Threads_Dump();
for(;;) HALT();
for(;;) ;
}
void Debug_SetKTerminal(const char *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;
......
......@@ -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
......
......@@ -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]);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment