From 0d3339c73e8401a6dcfee2f0b97f6f52c81181c6 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Thu, 17 Feb 2022 15:34:27 -0800 Subject: Fix sbi_console_getchar return value if no UART is present The UART drivers all return -1 if no character is present, and so that's what we should do if there's no UART at all. See discussion on https://github.com/riscv-non-isa/riscv-sbi-doc/issues/82 --- machine/mtrap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/machine/mtrap.c b/machine/mtrap.c index dcff050..3cea874 100644 --- a/machine/mtrap.c +++ b/machine/mtrap.c @@ -77,7 +77,7 @@ static uintptr_t mcall_console_getchar() } else if (htif) { return htif_console_getchar(); } else { - return '\0'; + return (uintptr_t)-1; } } -- cgit v1.1