exec is still doing some weird stuff, totally corrupting the page tables

This commit is contained in:
apio 2022-10-13 22:20:24 +02:00
parent 5d41b4b113
commit 0c7c249935
2 changed files with 3 additions and 4 deletions

View File

@ -72,14 +72,14 @@ void sys_exec(Context* context, const char* pathname)
// At this point, pretty much nothing can fail. // At this point, pretty much nothing can fail.
ELFLoader::release_elf_image(Scheduler::current_task()->image); VMM::switch_back_to_kernel_address_space();
MemoryManager::release_pages((void*)task->allocated_stack, TASK_PAGES_IN_STACK);
task->address_space.destroy(); task->address_space.destroy();
task->address_space = AddressSpace::create(); task->address_space = AddressSpace::create();
VMM::switch_to_user_address_space(task->address_space); 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); 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 ASSERT(image); // If check_elf_image succeeded, load_elf_from_vfs MUST succeed, unless something has gone terribly

View File

@ -55,7 +55,6 @@ void Scheduler::init()
// the other registers will be saved next task switch // the other registers will be saved next task switch
frequency = 1000 / PIT::frequency(); frequency = 1000 / PIT::frequency();
kdbgln("frequency: %ld", frequency);
} }
void Scheduler::add_kernel_task(void (*task)(void)) void Scheduler::add_kernel_task(void (*task)(void))