Merge pull request #84 from chocabloc/trunk
Return to firmware instead of halting in UEFI mode
This commit is contained in:
commit
0d3d667ba8
|
@ -1,6 +1,13 @@
|
|||
#include <lib/print.h>
|
||||
#include <lib/real.h>
|
||||
#include <lib/trace.h>
|
||||
#if defined (uefi)
|
||||
# include <efi.h>
|
||||
#endif
|
||||
#include <lib/blib.h>
|
||||
#include <lib/readline.h>
|
||||
#include <lib/gterm.h>
|
||||
#include <mm/pmm.h>
|
||||
|
||||
__attribute__((noreturn)) void panic(const char *fmt, ...) {
|
||||
asm volatile ("cli" ::: "memory");
|
||||
|
@ -18,8 +25,15 @@ __attribute__((noreturn)) void panic(const char *fmt, ...) {
|
|||
print_stacktrace(NULL);
|
||||
|
||||
#if defined (bios)
|
||||
print("System halted.");
|
||||
rm_hcf();
|
||||
#elif defined (uefi)
|
||||
for (;;) asm ("hlt");
|
||||
print("Press [ENTER] to return to firmware.");
|
||||
fb_clear(&fbinfo);
|
||||
|
||||
// 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
|
||||
}
|
||||
|
|
|
@ -73,5 +73,5 @@ void print_stacktrace(size_t *base_ptr) {
|
|||
break;
|
||||
base_ptr = (void*)old_bp;
|
||||
}
|
||||
print("End of trace.\n");
|
||||
print("End of trace. ");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue