aarch64: Load kernel symbol table

This commit is contained in:
K. Lange 2022-02-06 21:23:35 +09:00
parent 1ddaaab501
commit 9f03252e3a

View File

@ -23,6 +23,7 @@
#include <kernel/signal.h> #include <kernel/signal.h>
#include <kernel/misc.h> #include <kernel/misc.h>
#include <kernel/ptrace.h> #include <kernel/ptrace.h>
#include <kernel/ksym.h>
#include <sys/ptrace.h> #include <sys/ptrace.h>
@ -432,6 +433,16 @@ void aarch64_processor_data(void) {
asm volatile ("mrs %0, MIDR_EL1" : "=r"(this_core->midr)); asm volatile ("mrs %0, MIDR_EL1" : "=r"(this_core->midr));
} }
static void symbols_install(void) {
ksym_install();
kernel_symbol_t * k = (kernel_symbol_t *)&kernel_symbols_start;
while ((uintptr_t)k < (uintptr_t)&kernel_symbols_end) {
ksym_bind(k->name, (void*)k->addr);
k = (kernel_symbol_t *)((uintptr_t)k + sizeof *k + strlen(k->name) + 1);
}
}
/** /**
* Main kernel C entrypoint for qemu's -machine virt * Main kernel C entrypoint for qemu's -machine virt
@ -496,6 +507,8 @@ int kmain(uintptr_t dtb_base, uintptr_t phys_base) {
/* Set up all the other arch-specific stuff here */ /* Set up all the other arch-specific stuff here */
fpu_enable(); fpu_enable();
symbols_install();
generic_startup(); generic_startup();
/* Initialize the framebuffer and fbterm here */ /* Initialize the framebuffer and fbterm here */