Character must be returned via ret[0] field (copied to a0 by KVM). Return value should be set to 0 to indicate successful processing.
Signed-off-by: Vladimir Isaev <vladimir.is...@syntacore.com> --- target/riscv/kvm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/riscv/kvm.c b/target/riscv/kvm.c index 30f21453d69c..0f932a5b966e 100644 --- a/target/riscv/kvm.c +++ b/target/riscv/kvm.c @@ -467,10 +467,11 @@ static int kvm_riscv_handle_sbi(CPUState *cs, struct kvm_run *run) case SBI_EXT_0_1_CONSOLE_GETCHAR: ret = qemu_chr_fe_read_all(serial_hd(0)->be, &ch, sizeof(ch)); if (ret == sizeof(ch)) { - run->riscv_sbi.args[0] = ch; + run->riscv_sbi.ret[0] = ch; } else { - run->riscv_sbi.args[0] = -1; + run->riscv_sbi.ret[0] = -1; } + ret = 0; break; default: qemu_log_mask(LOG_UNIMP, -- 2.39.1