[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 52/59] target/xtensa: Remove tswap() calls in semihosting simcall(
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 52/59] target/xtensa: Remove tswap() calls in semihosting simcall() helper |
Date: |
Fri, 20 Dec 2024 17:15:43 +0100 |
In preparation of heterogeneous emulation where cores with
different endianness can run concurrently, replace the pair
of cpu_memory_rw_debug() + tswap() calls by put/get_user_u32()
ones, which still do the same under the hood, but simplify the
code maintenance (having less sites to do endianness code
conversion).
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <6e1e69d8-a9f3-4a30-83c8-84c5647578d5@linaro.org>
---
target/xtensa/xtensa-semi.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/target/xtensa/xtensa-semi.c b/target/xtensa/xtensa-semi.c
index fa21b7e11fc..2ded8e5634e 100644
--- a/target/xtensa/xtensa-semi.c
+++ b/target/xtensa/xtensa-semi.c
@@ -30,6 +30,7 @@
#include "chardev/char-fe.h"
#include "exec/helper-proto.h"
#include "semihosting/semihost.h"
+#include "semihosting/uaccess.h"
#include "qapi/error.h"
#include "qemu/log.h"
@@ -323,15 +324,12 @@ void HELPER(simcall)(CPUXtensaState *env)
uint32_t fd = regs[3];
uint32_t rq = regs[4];
uint32_t target_tv = regs[5];
- uint32_t target_tvv[2];
struct timeval tv = {0};
if (target_tv) {
- cpu_memory_rw_debug(cs, target_tv,
- (uint8_t *)target_tvv, sizeof(target_tvv), 0);
- tv.tv_sec = (int32_t)tswap32(target_tvv[0]);
- tv.tv_usec = (int32_t)tswap32(target_tvv[1]);
+ get_user_u32(tv.tv_sec, target_tv);
+ get_user_u32(tv.tv_sec, target_tv + 4);
}
if (fd < 3 && sim_console) {
if ((fd == 1 || fd == 2) && rq == SELECT_ONE_WRITE) {
@@ -387,11 +385,8 @@ void HELPER(simcall)(CPUXtensaState *env)
const char *str = semihosting_get_arg(i);
int str_size = strlen(str) + 1;
- argptr = tswap32(regs[3] + str_offset);
-
- cpu_memory_rw_debug(cs,
- regs[3] + i * sizeof(uint32_t),
- (uint8_t *)&argptr, sizeof(argptr), 1);
+ put_user_u32(regs[3] + str_offset,
+ regs[3] + i * sizeof(uint32_t));
cpu_memory_rw_debug(cs,
regs[3] + str_offset,
(uint8_t *)str, str_size, 1);
--
2.47.1
- [PULL 43/59] target/sparc: Move sparc_restore_state_to_opc() to cpu.c, (continued)
- [PULL 43/59] target/sparc: Move sparc_restore_state_to_opc() to cpu.c, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 42/59] target/sparc: Uninline cpu_get_tb_cpu_state(), Philippe Mathieu-Daudé, 2024/12/20
- [PULL 44/59] exec/cpu-all: Include 'cpu.h' earlier so MMU_USER_IDX is always defined, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 45/59] accel/tcg: Declare cpu_loop_exit_requested() in 'exec/cpu-common.h', Philippe Mathieu-Daudé, 2024/12/20
- [PULL 46/59] exec/translation-block: Include missing 'qemu/atomic.h' header, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 47/59] qemu/coroutine: Include missing 'qemu/atomic.h' header, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 48/59] accel/tcg: Restrict curr_cflags() declaration to 'internal-common.h', Philippe Mathieu-Daudé, 2024/12/20
- [PULL 49/59] accel/tcg: Move tcg_cflags_has/set() to 'exec/translation-block.h', Philippe Mathieu-Daudé, 2024/12/20
- [PULL 50/59] accel/tcg: Include missing 'exec/translation-block.h' header, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 51/59] accel/tcg: Un-inline translator_is_same_page(), Philippe Mathieu-Daudé, 2024/12/20
- [PULL 52/59] target/xtensa: Remove tswap() calls in semihosting simcall() helper,
Philippe Mathieu-Daudé <=
- [PULL 53/59] target/mips: Remove tswap() calls in semihosting uhi_fstat_cb(), Philippe Mathieu-Daudé, 2024/12/20
- [PULL 55/59] hw/xen: Remove unnecessary 'exec/cpu-common.h' header, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 54/59] target/mips: Drop left-over comment about Jazz machine, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 56/59] system/numa: Remove unnecessary 'exec/cpu-common.h' header, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 57/59] system/accel-ops: Remove unnecessary 'exec/cpu-common.h' header, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 58/59] meson: Do not define CONFIG_DEVICES on user emulation, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 59/59] util/qemu-timer: fix indentation, Philippe Mathieu-Daudé, 2024/12/20
- Re: [PULL 00/59] Accel & exec patches for 2024-12-20, Stefan Hajnoczi, 2024/12/21