1 #include <lunaix/mm/mmio.h>
2 #include <lunaix/mm/page.h>
3 #include <lunaix/spike.h>
4 #include <lunaix/trace.h>
6 #include <klibc/string.h>
8 static struct trace_context trace_ctx;
11 trace_modksyms_init(struct boot_handoff* bhctx)
13 struct boot_modent* modents = bhctx->mods.entries;
14 for (size_t i = 0; i < bhctx->mods.mods_num; i++) {
15 struct boot_modent* mod = &bhctx->mods.entries[i];
16 if (streq(mod->str, "modksyms")) {
17 // In case boot loader does not place our ksyms on page boundary
18 ptr_t start = PG_ALIGN(mod->start);
19 ptr_t end = ROUNDUP(mod->end, PG_SIZE);
20 ptr_t ksym_va = (ptr_t)ioremap(start, (end - start));
22 trace_ctx.ksym_table =
23 (struct ksyms*)(ksym_va + (mod->start - start));
29 trace_sym_lookup(ptr_t pc)
35 trace_walkback(ptr_t fp)