From Alex von Gluck IV <kallisti5@xxxxxxxxxxx>:
Alex von Gluck IV has uploaded this change for review. (
https://review.haiku-os.org/c/haiku/+/3541 ;)
Change subject: kernel/arm: Prevent a uart dereference.
......................................................................
kernel/arm: Prevent a uart dereference.
* Make some wild qemu virt uart assumptions as a fallback
Change-Id: If8ff74b6a6f53b6c38515a9bdd5fba2573f21700
---
M src/system/kernel/arch/arm/arch_debug_console.cpp
1 file changed, 13 insertions(+), 4 deletions(-)
git pull ssh://git.haiku-os.org:22/haiku refs/changes/41/3541/1
diff --git a/src/system/kernel/arch/arm/arch_debug_console.cpp
b/src/system/kernel/arch/arm/arch_debug_console.cpp
index dba5ce5..bd5c39e 100644
--- a/src/system/kernel/arch/arm/arch_debug_console.cpp
+++ b/src/system/kernel/arch/arm/arch_debug_console.cpp
@@ -13,6 +13,7 @@
//#include <arch_platform.h>
#include <arch/debug_console.h>
#include <arch/generic/debug_uart.h>
+#include <arch/arm/arch_uart_pl011.h>
#include <boot/kernel_args.h>
#include <kernel.h>
#include <vm/vm.h>
@@ -62,6 +63,9 @@
char
arch_debug_serial_getchar(void)
{
+ if (gArchDebugUART == NULL)
+ return NULL;
+
return gArchDebugUART->GetChar(false);
}
@@ -69,6 +73,9 @@
void
arch_debug_serial_putchar(const char c)
{
+ if (gArchDebugUART == NULL)
+ return;
+
gArchDebugUART->PutChar(c);
}
@@ -95,12 +102,14 @@
arch_debug_console_init(kernel_args *args)
{
// first try with hints from the FDT
- // TODO: Use UEFI somehow
-
+ // TODO: Use UEFI somehow to get fdt
//gArchDebugUART = debug_uart_from_fdt(args->platform_args.fdt);
- // Do we can some kind of direct fallback here
- // (aka, guess arch_get_uart_pl011 or arch_get_uart_8250?)
+ // As a last try, lets assume qemu's pl011 at a sane address
+ if (gArchDebugUART == NULL)
+ gArchDebugUART = arch_get_uart_pl011(0x9000000, 0x16e3600);
+
+ // Oh well.
if (gArchDebugUART == NULL)
return B_ERROR;
--
To view, visit https://review.haiku-os.org/c/haiku/+/3541
To unsubscribe, or for help writing mail filters, visit
https://review.haiku-os.org/settings
Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: If8ff74b6a6f53b6c38515a9bdd5fba2573f21700
Gerrit-Change-Number: 3541
Gerrit-PatchSet: 1
Gerrit-Owner: Alex von Gluck IV <kallisti5@xxxxxxxxxxx>
Gerrit-MessageType: newchange