Only dump bootloader modules once.

This commit is contained in:
Drew Galbraith 2023-06-06 15:04:34 -07:00
parent a092a57483
commit e2aad55a8a
1 changed files with 11 additions and 3 deletions

View File

@ -23,12 +23,19 @@ bool streq(const char* a, const char* b) {
}
}
const limine_file& GetInitProgram(const char* path) {
void DumpModules() {
const limine_module_response& resp = boot::GetModules();
dbgln("[boot] Dumping bootloader 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);
}
}
const limine_file& GetInitProgram(const char* path) {
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);
if (streq(file.path, path)) return file;
}
panic("Program not found: %s", path);
@ -37,6 +44,7 @@ const limine_file& GetInitProgram(const char* path) {
} // namespace
void LoadInitProgram() {
DumpModules();
const limine_file& init_prog = GetInitProgram("/sys/test");
const limine_file& prog2 = GetInitProgram("/sys/test2");