Add a kernel ELF module and load it in a new process.

Don't yet jump to userspace.
This commit is contained in:
Drew Galbraith 2023-05-29 00:32:54 -07:00
parent f86bbe6ea9
commit aefb4f082b
22 changed files with 223 additions and 16 deletions

View file

@ -25,14 +25,14 @@ Process* Process::RootProcess() {
return proc;
}
Process::Process() : id_(gNextId++) {
Process::Process(uint64_t elf_ptr) : id_(gNextId++) {
cr3_ = phys_mem::AllocatePage();
InitializePml4(cr3_);
CreateThread();
CreateThread(elf_ptr);
}
void Process::CreateThread() {
Thread* thread = new Thread(this, next_thread_id_++);
void Process::CreateThread(uint64_t elf_ptr) {
Thread* thread = new Thread(this, next_thread_id_++, elf_ptr);
ThreadEntry* tentry = new ThreadEntry{
.thread = thread,
.next = nullptr,