Add a kernel ELF module and load it in a new process.
Don't yet jump to userspace.
This commit is contained in:
parent
f86bbe6ea9
commit
aefb4f082b
22 changed files with 223 additions and 16 deletions
30
zion/loader/init_loader.cpp
Normal file
30
zion/loader/init_loader.cpp
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#include "loader/init_loader.h"
|
||||
|
||||
#include "boot/boot_info.h"
|
||||
#include "debug/debug.h"
|
||||
#include "loader/elf_loader.h"
|
||||
#include "scheduler/process.h"
|
||||
#include "scheduler/scheduler.h"
|
||||
|
||||
namespace {
|
||||
|
||||
const limine_file& GetInitProgram() {
|
||||
const limine_module_response& resp = boot::GetModules();
|
||||
dbgln("Dumping modules");
|
||||
for (uint64_t i = 0; i < resp.module_count; i++) {
|
||||
const limine_file& file = *resp.modules[i];
|
||||
dbgln("%s,%m,%x", file.path, file.address, file.size);
|
||||
// TODO eventually compare this file path.
|
||||
return file;
|
||||
}
|
||||
panic("No init program found");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void LoadInitProgram() {
|
||||
const limine_file& init_prog = GetInitProgram();
|
||||
|
||||
sched::InsertProcess(
|
||||
new Process(reinterpret_cast<uint64_t>(init_prog.address)));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue