]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/char/riscv_htif: Fix printing of console characters on big endian hosts
authorThomas Huth <thuth@redhat.com>
Fri, 21 Jul 2023 09:47:19 +0000 (11:47 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Wed, 13 Sep 2023 09:21:22 +0000 (12:21 +0300)
commitec0afe3c0b0fd27db95928ff0a13f5c6597db70d
treef359e3a16a82c710664a9fff7d4ef7777534c492
parentc04c0123bd3938331265e0b91727e8d084e20dea
hw/char/riscv_htif: Fix printing of console characters on big endian hosts

The character that should be printed is stored in the 64 bit "payload"
variable. The code currently tries to print it by taking the address
of the variable and passing this pointer to qemu_chr_fe_write(). However,
this only works on little endian hosts where the least significant bits
are stored on the lowest address. To do this in a portable way, we have
to store the value in an uint8_t variable instead.

Fixes: 5033606780 ("RISC-V HTIF Console")
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230721094720.902454-2-thuth@redhat.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
(cherry picked from commit c255946e3df4d9660e4f468a456633c24393d468)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(Mjt: edit to compensate for v7.2.0-805-g753ae97abc and v7.2.0-808-gdadee9e3ce)
hw/char/riscv_htif.c