From 87bc06495cb8c5f673a0e1047c391ef6d52322e5 Mon Sep 17 00:00:00 2001 From: jief666 Date: Fri, 4 Sep 2020 00:35:36 +0300 Subject: [PATCH] Panic message goes in log over serial port. Qemu launch script. --- Qemu/launch | 9 +++++++-- rEFIt_UEFI/Platform/Posix/abort.cpp | 11 ++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Qemu/launch b/Qemu/launch index 8a61e482f..2f52d06e9 100755 --- a/Qemu/launch +++ b/Qemu/launch @@ -24,8 +24,13 @@ set -x if [ "$OSTYPE" = "Darwin" ] then + if ! [ -f ./Qemu/qemu_portable/qemu-system-x86_64 ] + then if ! [ -f /usr/local/bin/qemu-system-x86_64 ] then + echo "You must install Qemu with \"brew install qemu\"", or restore the folder \'qemu_portable\' + exit 1 + fi echo "You must install Qemu with \"brew install qemu\"" exit 1 fi @@ -65,8 +70,8 @@ then set -m cd "$SCRIPT_DIR" - /usr/local/bin/qemu-system-x86_64 \ - -L . \ + ./qemu_portable/qemu-system-x86_64 \ + -L qemu_portable \ -m 2048 \ -cpu core2duo \ -bios ./bios.bin-1.13.0 \ diff --git a/rEFIt_UEFI/Platform/Posix/abort.cpp b/rEFIt_UEFI/Platform/Posix/abort.cpp index e3e8c08ad..bbff05e48 100755 --- a/rEFIt_UEFI/Platform/Posix/abort.cpp +++ b/rEFIt_UEFI/Platform/Posix/abort.cpp @@ -25,12 +25,21 @@ static void panic_(const char* format, VA_LIST va) #endif ; +#define FATAL_ERROR_MSG "\nA fatal error happened. System halted.\n" static void panic_(const char* format, VA_LIST va) { if ( format ) { vprintf(format, va); + #ifdef DEBUG_ON_SERIAL_PORT + char buf[500]; + vsnprintf(buf, sizeof(buf)-1, format, va); + SerialPortWrite((UINT8*)buf, strlen(buf)); + #endif } - printf("A fatal error happened. System halted\n"); + printf(FATAL_ERROR_MSG); + #ifdef DEBUG_ON_SERIAL_PORT + SerialPortWrite((UINT8*)FATAL_ERROR_MSG, strlen(FATAL_ERROR_MSG)); + #endif while (1) { // this will avoid warning : Function declared 'noreturn' should not return CpuDeadLoop(); }