From 9f03252e3aba5c4bf99da636cb54284f4ab0bf17 Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Sun, 6 Feb 2022 21:23:35 +0900 Subject: [PATCH] aarch64: Load kernel symbol table --- kernel/arch/aarch64/main.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/kernel/arch/aarch64/main.c b/kernel/arch/aarch64/main.c index f69d43a9..a96016f2 100644 --- a/kernel/arch/aarch64/main.c +++ b/kernel/arch/aarch64/main.c @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -432,6 +433,16 @@ void aarch64_processor_data(void) { 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 @@ -496,6 +507,8 @@ int kmain(uintptr_t dtb_base, uintptr_t phys_base) { /* Set up all the other arch-specific stuff here */ fpu_enable(); + symbols_install(); + generic_startup(); /* Initialize the framebuffer and fbterm here */