aboutsummaryrefslogtreecommitdiff
path: root/machine/mtrap.c
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2022-02-17 15:34:27 -0800
committerAndrew Waterman <andrew@sifive.com>2022-02-17 15:34:27 -0800
commit0d3339c73e8401a6dcfee2f0b97f6f52c81181c6 (patch)
tree132a1f4a44db109c554ac473f7850308f3a687f4 /machine/mtrap.c
parentbc6e624fe1167b088af5694bb74eb68d61dde8ba (diff)
downloadriscv-pk-0d3339c73e8401a6dcfee2f0b97f6f52c81181c6.zip
riscv-pk-0d3339c73e8401a6dcfee2f0b97f6f52c81181c6.tar.gz
riscv-pk-0d3339c73e8401a6dcfee2f0b97f6f52c81181c6.tar.bz2
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
Diffstat (limited to 'machine/mtrap.c')
-rw-r--r--machine/mtrap.c2
1 files changed, 1 insertions, 1 deletions
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;
}
}