return to firmware instead of halting in uefi mode
This commit is contained in:
parent
4c1782357a
commit
2c679dcec3
|
@ -1,6 +1,10 @@
|
||||||
#include <lib/print.h>
|
#include <lib/print.h>
|
||||||
#include <lib/real.h>
|
#include <lib/real.h>
|
||||||
#include <lib/trace.h>
|
#include <lib/trace.h>
|
||||||
|
#include <lib/blib.h>
|
||||||
|
#include <lib/readline.h>
|
||||||
|
#include <lib/gterm.h>
|
||||||
|
#include <mm/pmm.h>
|
||||||
|
|
||||||
__attribute__((noreturn)) void panic(const char *fmt, ...) {
|
__attribute__((noreturn)) void panic(const char *fmt, ...) {
|
||||||
asm volatile ("cli" ::: "memory");
|
asm volatile ("cli" ::: "memory");
|
||||||
|
@ -18,8 +22,16 @@ __attribute__((noreturn)) void panic(const char *fmt, ...) {
|
||||||
print_stacktrace(NULL);
|
print_stacktrace(NULL);
|
||||||
|
|
||||||
#if defined (bios)
|
#if defined (bios)
|
||||||
|
print("System halted.");
|
||||||
rm_hcf();
|
rm_hcf();
|
||||||
#elif defined (uefi)
|
#elif defined (uefi)
|
||||||
for (;;) asm ("hlt");
|
print("Press any key to return to firmware.");
|
||||||
|
getchar();
|
||||||
|
gterm_clear(true);
|
||||||
|
|
||||||
|
// release all uefi memory and return to firmware
|
||||||
|
pmm_release_uefi_mem();
|
||||||
|
uefi_call_wrapper(gBS->Exit, 4, efi_image_handle, EFI_ABORTED, 0, NULL);
|
||||||
|
__builtin_unreachable();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,5 +73,5 @@ void print_stacktrace(size_t *base_ptr) {
|
||||||
break;
|
break;
|
||||||
base_ptr = (void*)old_bp;
|
base_ptr = (void*)old_bp;
|
||||||
}
|
}
|
||||||
print("End of trace.\n");
|
print("End of trace. ");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue