From 4d1c59078b21def05f27b621253e85b68fcd9e77 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Fri, 17 Sep 2021 16:04:20 -0400 Subject: [PATCH] EFI: Hand off bootloader log to the kernel. Eventually, EFI should get support for the debug log ring_buffer like bios_ia32 has for transparent handoffs, but this preserves everything except for the pre-start MMU dump, which is an improvement. Fixes #15455. --- src/system/boot/platform/efi/debug.cpp | 13 +++++++++++++ src/system/boot/platform/efi/debug.h | 20 ++++++++++++++++++++ src/system/boot/platform/efi/start.cpp | 3 +++ 3 files changed, 36 insertions(+) create mode 100644 src/system/boot/platform/efi/debug.h diff --git a/src/system/boot/platform/efi/debug.cpp b/src/system/boot/platform/efi/debug.cpp index 48724ad3ce..54592342a0 100644 --- a/src/system/boot/platform/efi/debug.cpp +++ b/src/system/boot/platform/efi/debug.cpp @@ -10,6 +10,7 @@ #include #include +#include "debug.h" #include "efi_platform.h" #include "serial.h" @@ -70,6 +71,18 @@ panic(const char *format, ...) } +void +debug_cleanup(void) +{ + gKernelArgs.keep_debug_output_buffer = false; + gKernelArgs.debug_output = kernel_args_malloc(sBufferPosition); + if (gKernelArgs.debug_output != NULL) { + memcpy(gKernelArgs.debug_output, sBuffer, sBufferPosition); + gKernelArgs.debug_size = sBufferPosition; + } +} + + char* platform_debug_get_log_buffer(size_t *_size) { diff --git a/src/system/boot/platform/efi/debug.h b/src/system/boot/platform/efi/debug.h new file mode 100644 index 0000000000..f676229cef --- /dev/null +++ b/src/system/boot/platform/efi/debug.h @@ -0,0 +1,20 @@ +/* + * Copyright 2021, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef DEBUG_H +#define DEBUG_H + + +#ifdef __cplusplus +extern "C" { +#endif + +void debug_cleanup(void); + +#ifdef __cplusplus +} +#endif + + +#endif // DEBUG_H diff --git a/src/system/boot/platform/efi/start.cpp b/src/system/boot/platform/efi/start.cpp index e6e8181461..ed4a41f5d8 100644 --- a/src/system/boot/platform/efi/start.cpp +++ b/src/system/boot/platform/efi/start.cpp @@ -25,6 +25,7 @@ #include "acpi.h" #include "console.h" #include "cpu.h" +#include "debug.h" #ifdef _BOOT_FDT_SUPPORT #include "dtb.h" #endif @@ -186,6 +187,8 @@ platform_start_kernel(void) dprintf(" data: %#" B_PRIx64 ", %#" B_PRIx64 "\n", dataRegion.start, dataRegion.size); dprintf(" entry: %#lx\n", kernelEntry); + debug_cleanup(); + arch_mmu_init(); convert_kernel_args();