From 23838a4e84d328dc8db8e10ad520a1bbfb1da057 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Sat, 13 Mar 2021 03:40:17 +0100 Subject: [PATCH] misc: We don't stacktrace on UEFI --- stage23/lib/trace.h | 1 - stage23/lib/trace.s2.c | 21 ++++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/stage23/lib/trace.h b/stage23/lib/trace.h index 02272a43..9289e491 100644 --- a/stage23/lib/trace.h +++ b/stage23/lib/trace.h @@ -3,7 +3,6 @@ #include -char *trace_address(size_t *off, size_t addr); void print_stacktrace(size_t *base_ptr); #endif diff --git a/stage23/lib/trace.s2.c b/stage23/lib/trace.s2.c index b8f073be..957fad8a 100644 --- a/stage23/lib/trace.s2.c +++ b/stage23/lib/trace.s2.c @@ -8,17 +8,17 @@ #include #include +#if defined (bios) + extern symbol stage2_map, full_map; -char *trace_address(size_t *off, size_t addr) { +static char *trace_address(size_t *off, size_t addr) { char *limine_map; -#if defined (bios) if (!stage3_loaded) limine_map = stage2_map; else limine_map = full_map; -#endif uintptr_t prev_addr = 0; char *prev_sym = NULL; @@ -38,11 +38,7 @@ char *trace_address(size_t *off, size_t addr) { void print_stacktrace(size_t *base_ptr) { if (base_ptr == NULL) { asm volatile ( -#if defined (bios) "mov %0, ebp" -#elif defined (uefi) - "mov %0, rbp" -#endif : "=g"(base_ptr) :: "memory" ); @@ -65,3 +61,14 @@ void print_stacktrace(size_t *base_ptr) { } print("End of trace.\n"); } + +#endif + +#if defined (uefi) + +void print_stacktrace(size_t *base_ptr) { + (void)base_ptr; + print("Stacktrace unavailable when using UEFI.\n"); +} + +#endif