diff --git a/kernel/src/sys/exec.cpp b/kernel/src/sys/exec.cpp index db19fbce..6eeeb6e3 100644 --- a/kernel/src/sys/exec.cpp +++ b/kernel/src/sys/exec.cpp @@ -72,14 +72,14 @@ void sys_exec(Context* context, const char* pathname) // At this point, pretty much nothing can fail. - ELFLoader::release_elf_image(Scheduler::current_task()->image); - - MemoryManager::release_pages((void*)task->allocated_stack, TASK_PAGES_IN_STACK); + VMM::switch_back_to_kernel_address_space(); task->address_space.destroy(); task->address_space = AddressSpace::create(); VMM::switch_to_user_address_space(task->address_space); + VMM::apply_address_space(); + VMM::enter_syscall_context(); ELFImage* image = ELFLoader::load_elf_from_vfs(program); ASSERT(image); // If check_elf_image succeeded, load_elf_from_vfs MUST succeed, unless something has gone terribly diff --git a/kernel/src/thread/Scheduler.cpp b/kernel/src/thread/Scheduler.cpp index 9e4855cd..ee6fb844 100644 --- a/kernel/src/thread/Scheduler.cpp +++ b/kernel/src/thread/Scheduler.cpp @@ -55,7 +55,6 @@ void Scheduler::init() // the other registers will be saved next task switch frequency = 1000 / PIT::frequency(); - kdbgln("frequency: %ld", frequency); } void Scheduler::add_kernel_task(void (*task)(void))