Add the ability to copy memory to non resident process.

Use/Test this by loading the user space elf from the kernel process
before it starts rather than as a part of the first thread.

This simplifies thread start a fair bit.
This commit is contained in:
Drew Galbraith 2023-05-30 01:27:47 -07:00
parent f6609983d2
commit b9b45c5e45
9 changed files with 55 additions and 38 deletions

View file

@ -22,14 +22,13 @@ SharedPtr<Process> Process::RootProcess() {
return proc;
}
Process::Process(uint64_t elf_ptr) : id_(gNextId++), state_(RUNNING) {
Process::Process() : id_(gNextId++), state_(RUNNING) {
cr3_ = phys_mem::AllocatePage();
InitializePml4(cr3_);
CreateThread(elf_ptr);
}
void Process::CreateThread(uint64_t elf_ptr) {
Thread* thread = new Thread(this, next_thread_id_++, elf_ptr);
void Process::CreateThread(uint64_t entry) {
Thread* thread = new Thread(this, next_thread_id_++, entry);
threads_.PushBack(thread);
gScheduler->Enqueue(thread);
}