boot: use multiboot2 symbol table

This commit is contained in:
Mark
2020-09-20 13:49:18 +03:00
parent 1dea3c9e43
commit 02136a28b5
3 changed files with 29 additions and 11 deletions
+11 -1
View File
@@ -16,7 +16,7 @@ static size_t g_strtab_size = 0;
static struct hash g_symtab_hash;
// Multiboot2-loaded sections are misaligned for some reason
void ksym_set_multiboot2(struct multiboot_tag_elf_sections *tag) {
static void ksym_set_multiboot2(struct multiboot_tag_elf_sections *tag) {
kinfo("Loading kernel symbols\n");
kinfo("%u section headers:\n", tag->num);
size_t string_section_offset = tag->shndx * tag->entsize;
@@ -61,6 +61,16 @@ void ksym_set_multiboot2(struct multiboot_tag_elf_sections *tag) {
}
}
void ksym_set(struct elf_sections *sections) {
switch (sections->kind) {
case KSYM_TABLE_MULTIBOOT2:
ksym_set_multiboot2(sections->tables.multiboot2);
break;
default:
__builtin_unreachable();
}
}
void ksym_set_tables(uintptr_t s0, uintptr_t s1, size_t z0, size_t z1) {
Elf64_Sym *sym;
Elf64_Word type, bind;