X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/b26d3165c52589d1f8de37bf0df27ad96f460f47..1fe5f5eb5378a47bf0f3451762743c162e40faad:/lunaix-os/kernel/debug/trace.c?ds=inline diff --git a/lunaix-os/kernel/debug/trace.c b/lunaix-os/kernel/debug/trace.c new file mode 100644 index 0000000..c08a6f7 --- /dev/null +++ b/lunaix-os/kernel/debug/trace.c @@ -0,0 +1,37 @@ +#include +#include +#include +#include + +#include + +static struct trace_context trace_ctx; + +void +trace_modksyms_init(struct boot_handoff* bhctx) +{ + struct boot_modent* modents = bhctx->mods.entries; + for (size_t i = 0; i < bhctx->mods.mods_num; i++) { + struct boot_modent* mod = &bhctx->mods.entries[i]; + if (streq(mod->str, "modksyms")) { + // In case boot loader does not place our ksyms on page boundary + ptr_t start = PG_ALIGN(mod->start); + ptr_t end = ROUNDUP(mod->end, PG_SIZE); + ptr_t ksym_va = (ptr_t)ioremap(start, (end - start)); + + trace_ctx.ksym_table = + (struct ksyms*)(ksym_va + (mod->start - start)); + } + } +} + +struct ksym_entry* +trace_sym_lookup(ptr_t pc) +{ + return NULL; +} + +void +trace_walkback(ptr_t fp) +{ +} \ No newline at end of file