Apparently, it just works now.
This commit is contained in:
parent
97a8a4a4a2
commit
e43777bd31
@ -47,7 +47,7 @@ void VMM::exit_syscall_context()
|
||||
|
||||
void VMM::apply_address_space()
|
||||
{
|
||||
asm volatile("mov %0, %%cr3" : : "r"(current_pml4));
|
||||
write_cr3(current_pml4);
|
||||
}
|
||||
|
||||
bool VMM::is_using_kernel_address_space()
|
||||
|
@ -95,6 +95,7 @@ ELFImage* ELFLoader::load_elf_from_vfs(VFS::Node* node)
|
||||
pages, MAP_READ_WRITE) +
|
||||
(phdr.p_vaddr % PAGE_SIZE));
|
||||
|
||||
if (VMM::is_using_kernel_address_space()) { VMM::switch_to_previous_user_address_space(); }
|
||||
VMM::apply_address_space();
|
||||
|
||||
VFS::read(node, phdr.p_offset, phdr.p_filesz, (char*)buffer);
|
||||
|
@ -12,12 +12,12 @@
|
||||
#include "sys/elf/ELFLoader.h"
|
||||
#include "thread/Scheduler.h"
|
||||
|
||||
void sys_exec(Context* context, const char*)
|
||||
void sys_exec(Context* context, const char* pathname)
|
||||
{
|
||||
context->rax = -ENOSYS; // FIXME: Make exec() work under separate address spaces.
|
||||
return;
|
||||
/*context->rax = -ENOSYS; // FIXME: Make exec() work under separate address spaces.
|
||||
return;*/
|
||||
|
||||
/*char* kpathname = Syscall::strdup_from_user(pathname);
|
||||
char* kpathname = Syscall::strdup_from_user(pathname);
|
||||
if (!kpathname)
|
||||
{
|
||||
context->rax = -EFAULT;
|
||||
@ -75,10 +75,7 @@ void sys_exec(Context* context, const char*)
|
||||
|
||||
// At this point, pretty much nothing can fail.
|
||||
|
||||
VMM::switch_back_to_kernel_address_space();
|
||||
VMM::apply_address_space();
|
||||
|
||||
task->address_space.reset();
|
||||
// task->address_space.reset();
|
||||
|
||||
// VMM::switch_to_user_address_space(task->address_space);
|
||||
|
||||
@ -99,5 +96,5 @@ void sys_exec(Context* context, const char*)
|
||||
|
||||
kfree(kpathname);
|
||||
|
||||
return;*/
|
||||
return;
|
||||
}
|
@ -57,7 +57,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))
|
||||
|
Loading…
Reference in New Issue
Block a user