* [PATCH-for-10.1 0/5] exec: Remove TARGET_LONG_SIZE definition
@ 2025-03-25 13:02 Philippe Mathieu-Daudé
2025-03-25 13:02 ` [PATCH-for-10.1 1/5] target/i386: Use explicit little-endian LD/ST API Philippe Mathieu-Daudé
` (6 more replies)
0 siblings, 7 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-25 13:02 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel Henrique Barboza, Eduardo Habkost, Zhao Liu,
Pierrick Bouvier, Alex Bennée, Anton Johansson,
Philippe Mathieu-Daudé, Riku Voipio, Paolo Bonzini,
Nicholas Piggin, Richard Henderson, qemu-ppc
TARGET_LONG_SIZE is only used in 1 source file
and 1 header. Remove it to be able to focus on
making TARGET_LONG_BITS target agnostic.
Philippe Mathieu-Daudé (5):
target/i386: Use explicit little-endian LD/ST API
gdbstub: Remove ldtul_be_p() and ldtul_le_p() macros
target/ppc/gdbstub: Replace TARGET_LONG_SIZE -> sizeof(target_ulong)
user/tswap: Replace TARGET_LONG_SIZE -> TARGET_LONG_BITS
exec/target_long: Remove TARGET_LONG_SIZE definition
include/exec/target_long.h | 8 +++----
include/gdbstub/helpers.h | 4 ----
include/user/tswap-target.h | 2 +-
target/i386/gdbstub.c | 24 ++++++++++-----------
target/i386/tcg/system/excp_helper.c | 4 ++--
target/i386/xsave_helper.c | 32 ++++++++++++++--------------
target/ppc/gdbstub.c | 10 ++++-----
7 files changed, 39 insertions(+), 45 deletions(-)
--
2.47.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH-for-10.1 1/5] target/i386: Use explicit little-endian LD/ST API
2025-03-25 13:02 [PATCH-for-10.1 0/5] exec: Remove TARGET_LONG_SIZE definition Philippe Mathieu-Daudé
@ 2025-03-25 13:02 ` Philippe Mathieu-Daudé
2025-03-25 13:02 ` [PATCH-for-10.1 2/5] gdbstub: Remove ldtul_be_p() and ldtul_le_p() macros Philippe Mathieu-Daudé
` (5 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-25 13:02 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel Henrique Barboza, Eduardo Habkost, Zhao Liu,
Pierrick Bouvier, Alex Bennée, Anton Johansson,
Philippe Mathieu-Daudé, Riku Voipio, Paolo Bonzini,
Nicholas Piggin, Richard Henderson, qemu-ppc
The x86 architecture uses little endianness. Directly use
the little-endian LD/ST API.
Mechanical change using:
$ end=le; \
for acc in uw w l q tul; do \
sed -i -e "s/ld${acc}_p(/ld${acc}_${end}_p(/" \
-e "s/st${acc}_p(/st${acc}_${end}_p(/" \
$(git grep -wlE '(ld|st)t?u?[wlq]_p' target/i386/); \
done
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20241004163042.85922-10-philmd@linaro.org>
---
target/i386/gdbstub.c | 24 ++++++++++-----------
target/i386/tcg/system/excp_helper.c | 4 ++--
target/i386/xsave_helper.c | 32 ++++++++++++++--------------
3 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/target/i386/gdbstub.c b/target/i386/gdbstub.c
index 04c49e802d7..9262cf46b0a 100644
--- a/target/i386/gdbstub.c
+++ b/target/i386/gdbstub.c
@@ -94,10 +94,10 @@ static int gdb_read_reg_cs64(uint32_t hflags, GByteArray *buf, target_ulong val)
static int gdb_write_reg_cs64(uint32_t hflags, uint8_t *buf, target_ulong *val)
{
if (hflags & HF_CS64_MASK) {
- *val = ldq_p(buf);
+ *val = ldq_le_p(buf);
return 8;
}
- *val = ldl_p(buf);
+ *val = ldl_le_p(buf);
return 4;
}
@@ -231,7 +231,7 @@ int x86_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
static int x86_cpu_gdb_load_seg(X86CPU *cpu, X86Seg sreg, uint8_t *mem_buf)
{
CPUX86State *env = &cpu->env;
- uint16_t selector = ldl_p(mem_buf);
+ uint16_t selector = ldl_le_p(mem_buf);
if (selector != env->segs[sreg].selector) {
#if defined(CONFIG_USER_ONLY)
@@ -287,15 +287,15 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
if (n < CPU_NB_REGS) {
if (TARGET_LONG_BITS == 64) {
if (env->hflags & HF_CS64_MASK) {
- env->regs[gpr_map[n]] = ldtul_p(mem_buf);
+ env->regs[gpr_map[n]] = ldq_le_p(mem_buf);
} else if (n < CPU_NB_REGS32) {
- env->regs[gpr_map[n]] = ldtul_p(mem_buf) & 0xffffffffUL;
+ env->regs[gpr_map[n]] = ldq_le_p(mem_buf) & 0xffffffffUL;
}
return sizeof(target_ulong);
} else if (n < CPU_NB_REGS32) {
n = gpr_map32[n];
env->regs[n] &= ~0xffffffffUL;
- env->regs[n] |= (uint32_t)ldl_p(mem_buf);
+ env->regs[n] |= (uint32_t)ldl_le_p(mem_buf);
return 4;
}
} else if (n >= IDX_FP_REGS && n < IDX_FP_REGS + 8) {
@@ -306,8 +306,8 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
} else if (n >= IDX_XMM_REGS && n < IDX_XMM_REGS + CPU_NB_REGS) {
n -= IDX_XMM_REGS;
if (n < CPU_NB_REGS32 || TARGET_LONG_BITS == 64) {
- env->xmm_regs[n].ZMM_Q(0) = ldq_p(mem_buf);
- env->xmm_regs[n].ZMM_Q(1) = ldq_p(mem_buf + 8);
+ env->xmm_regs[n].ZMM_Q(0) = ldq_le_p(mem_buf);
+ env->xmm_regs[n].ZMM_Q(1) = ldq_le_p(mem_buf + 8);
return 16;
}
} else {
@@ -315,7 +315,7 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
case IDX_IP_REG:
return gdb_write_reg(env, mem_buf, &env->eip);
case IDX_FLAGS_REG:
- env->eflags = ldl_p(mem_buf);
+ env->eflags = ldl_le_p(mem_buf);
return 4;
case IDX_SEG_REGS:
@@ -341,10 +341,10 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
return 4;
case IDX_FP_REGS + 8:
- cpu_set_fpuc(env, ldl_p(mem_buf));
+ cpu_set_fpuc(env, ldl_le_p(mem_buf));
return 4;
case IDX_FP_REGS + 9:
- tmp = ldl_p(mem_buf);
+ tmp = ldl_le_p(mem_buf);
env->fpstt = (tmp >> 11) & 7;
env->fpus = tmp & ~0x3800;
return 4;
@@ -362,7 +362,7 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
return 4;
case IDX_MXCSR_REG:
- cpu_set_mxcsr(env, ldl_p(mem_buf));
+ cpu_set_mxcsr(env, ldl_le_p(mem_buf));
return 4;
case IDX_CTL_CR0_REG:
diff --git a/target/i386/tcg/system/excp_helper.c b/target/i386/tcg/system/excp_helper.c
index 6876329de21..f00bb15afe0 100644
--- a/target/i386/tcg/system/excp_helper.c
+++ b/target/i386/tcg/system/excp_helper.c
@@ -85,7 +85,7 @@ static bool ptw_translate(PTETranslate *inout, hwaddr addr)
static inline uint32_t ptw_ldl(const PTETranslate *in, uint64_t ra)
{
if (likely(in->haddr)) {
- return ldl_p(in->haddr);
+ return ldl_le_p(in->haddr);
}
return cpu_ldl_mmuidx_ra(in->env, in->gaddr, in->ptw_idx, ra);
}
@@ -93,7 +93,7 @@ static inline uint32_t ptw_ldl(const PTETranslate *in, uint64_t ra)
static inline uint64_t ptw_ldq(const PTETranslate *in, uint64_t ra)
{
if (likely(in->haddr)) {
- return ldq_p(in->haddr);
+ return ldq_le_p(in->haddr);
}
return cpu_ldq_mmuidx_ra(in->env, in->gaddr, in->ptw_idx, ra);
}
diff --git a/target/i386/xsave_helper.c b/target/i386/xsave_helper.c
index 996e9f3bfef..fc10bfa6718 100644
--- a/target/i386/xsave_helper.c
+++ b/target/i386/xsave_helper.c
@@ -43,8 +43,8 @@ void x86_cpu_xsave_all_areas(X86CPU *cpu, void *buf, uint32_t buflen)
for (i = 0; i < CPU_NB_REGS; i++) {
uint8_t *xmm = legacy->xmm_regs[i];
- stq_p(xmm, env->xmm_regs[i].ZMM_Q(0));
- stq_p(xmm + 8, env->xmm_regs[i].ZMM_Q(1));
+ stq_le_p(xmm, env->xmm_regs[i].ZMM_Q(0));
+ stq_le_p(xmm + 8, env->xmm_regs[i].ZMM_Q(1));
}
header->xstate_bv = env->xstate_bv;
@@ -58,8 +58,8 @@ void x86_cpu_xsave_all_areas(X86CPU *cpu, void *buf, uint32_t buflen)
for (i = 0; i < CPU_NB_REGS; i++) {
uint8_t *ymmh = avx->ymmh[i];
- stq_p(ymmh, env->xmm_regs[i].ZMM_Q(2));
- stq_p(ymmh + 8, env->xmm_regs[i].ZMM_Q(3));
+ stq_le_p(ymmh, env->xmm_regs[i].ZMM_Q(2));
+ stq_le_p(ymmh + 8, env->xmm_regs[i].ZMM_Q(3));
}
}
@@ -101,10 +101,10 @@ void x86_cpu_xsave_all_areas(X86CPU *cpu, void *buf, uint32_t buflen)
for (i = 0; i < CPU_NB_REGS; i++) {
uint8_t *zmmh = zmm_hi256->zmm_hi256[i];
- stq_p(zmmh, env->xmm_regs[i].ZMM_Q(4));
- stq_p(zmmh + 8, env->xmm_regs[i].ZMM_Q(5));
- stq_p(zmmh + 16, env->xmm_regs[i].ZMM_Q(6));
- stq_p(zmmh + 24, env->xmm_regs[i].ZMM_Q(7));
+ stq_le_p(zmmh, env->xmm_regs[i].ZMM_Q(4));
+ stq_le_p(zmmh + 8, env->xmm_regs[i].ZMM_Q(5));
+ stq_le_p(zmmh + 16, env->xmm_regs[i].ZMM_Q(6));
+ stq_le_p(zmmh + 24, env->xmm_regs[i].ZMM_Q(7));
}
#ifdef TARGET_X86_64
@@ -177,8 +177,8 @@ void x86_cpu_xrstor_all_areas(X86CPU *cpu, const void *buf, uint32_t buflen)
for (i = 0; i < CPU_NB_REGS; i++) {
const uint8_t *xmm = legacy->xmm_regs[i];
- env->xmm_regs[i].ZMM_Q(0) = ldq_p(xmm);
- env->xmm_regs[i].ZMM_Q(1) = ldq_p(xmm + 8);
+ env->xmm_regs[i].ZMM_Q(0) = ldq_le_p(xmm);
+ env->xmm_regs[i].ZMM_Q(1) = ldq_le_p(xmm + 8);
}
env->xstate_bv = header->xstate_bv;
@@ -191,8 +191,8 @@ void x86_cpu_xrstor_all_areas(X86CPU *cpu, const void *buf, uint32_t buflen)
for (i = 0; i < CPU_NB_REGS; i++) {
const uint8_t *ymmh = avx->ymmh[i];
- env->xmm_regs[i].ZMM_Q(2) = ldq_p(ymmh);
- env->xmm_regs[i].ZMM_Q(3) = ldq_p(ymmh + 8);
+ env->xmm_regs[i].ZMM_Q(2) = ldq_le_p(ymmh);
+ env->xmm_regs[i].ZMM_Q(3) = ldq_le_p(ymmh + 8);
}
}
@@ -241,10 +241,10 @@ void x86_cpu_xrstor_all_areas(X86CPU *cpu, const void *buf, uint32_t buflen)
for (i = 0; i < CPU_NB_REGS; i++) {
const uint8_t *zmmh = zmm_hi256->zmm_hi256[i];
- env->xmm_regs[i].ZMM_Q(4) = ldq_p(zmmh);
- env->xmm_regs[i].ZMM_Q(5) = ldq_p(zmmh + 8);
- env->xmm_regs[i].ZMM_Q(6) = ldq_p(zmmh + 16);
- env->xmm_regs[i].ZMM_Q(7) = ldq_p(zmmh + 24);
+ env->xmm_regs[i].ZMM_Q(4) = ldq_le_p(zmmh);
+ env->xmm_regs[i].ZMM_Q(5) = ldq_le_p(zmmh + 8);
+ env->xmm_regs[i].ZMM_Q(6) = ldq_le_p(zmmh + 16);
+ env->xmm_regs[i].ZMM_Q(7) = ldq_le_p(zmmh + 24);
}
#ifdef TARGET_X86_64
--
2.47.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH-for-10.1 2/5] gdbstub: Remove ldtul_be_p() and ldtul_le_p() macros
2025-03-25 13:02 [PATCH-for-10.1 0/5] exec: Remove TARGET_LONG_SIZE definition Philippe Mathieu-Daudé
2025-03-25 13:02 ` [PATCH-for-10.1 1/5] target/i386: Use explicit little-endian LD/ST API Philippe Mathieu-Daudé
@ 2025-03-25 13:02 ` Philippe Mathieu-Daudé
2025-03-26 12:59 ` Alex Bennée
2025-03-25 13:02 ` [PATCH-for-10.1 3/5] target/ppc/gdbstub: Replace TARGET_LONG_SIZE -> sizeof(target_ulong) Philippe Mathieu-Daudé
` (4 subsequent siblings)
6 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-25 13:02 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel Henrique Barboza, Eduardo Habkost, Zhao Liu,
Pierrick Bouvier, Alex Bennée, Anton Johansson,
Philippe Mathieu-Daudé, Riku Voipio, Paolo Bonzini,
Nicholas Piggin, Richard Henderson, qemu-ppc
Last uses of ldtul_be_p() were removed in commit 78920b4ff2b
("target/sparc: Use explicit big-endian LD/ST API"), and of
ldtul_le_p() in 39631d57d7c ("target/riscv: Use explicit
little-endian LD/ST API"). Remove these legacy macros.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/gdbstub/helpers.h | 4 ----
1 file changed, 4 deletions(-)
diff --git a/include/gdbstub/helpers.h b/include/gdbstub/helpers.h
index 6f7cc48adcb..26140ef1ac0 100644
--- a/include/gdbstub/helpers.h
+++ b/include/gdbstub/helpers.h
@@ -95,13 +95,9 @@ static inline uint8_t *gdb_get_reg_ptr(GByteArray *buf, int len)
#if TARGET_LONG_BITS == 64
#define gdb_get_regl(buf, val) gdb_get_reg64(buf, val)
#define ldtul_p(addr) ldq_p(addr)
-#define ldtul_le_p(addr) ldq_le_p(addr)
-#define ldtul_be_p(addr) ldq_be_p(addr)
#else
#define gdb_get_regl(buf, val) gdb_get_reg32(buf, val)
#define ldtul_p(addr) ldl_p(addr)
-#define ldtul_le_p(addr) ldl_le_p(addr)
-#define ldtul_be_p(addr) ldl_be_p(addr)
#endif
#endif /* _GDBSTUB_HELPERS_H_ */
--
2.47.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH-for-10.1 3/5] target/ppc/gdbstub: Replace TARGET_LONG_SIZE -> sizeof(target_ulong)
2025-03-25 13:02 [PATCH-for-10.1 0/5] exec: Remove TARGET_LONG_SIZE definition Philippe Mathieu-Daudé
2025-03-25 13:02 ` [PATCH-for-10.1 1/5] target/i386: Use explicit little-endian LD/ST API Philippe Mathieu-Daudé
2025-03-25 13:02 ` [PATCH-for-10.1 2/5] gdbstub: Remove ldtul_be_p() and ldtul_le_p() macros Philippe Mathieu-Daudé
@ 2025-03-25 13:02 ` Philippe Mathieu-Daudé
2025-03-25 13:02 ` [PATCH-for-10.1 4/5] user/tswap: Replace TARGET_LONG_SIZE -> TARGET_LONG_BITS Philippe Mathieu-Daudé
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-25 13:02 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel Henrique Barboza, Eduardo Habkost, Zhao Liu,
Pierrick Bouvier, Alex Bennée, Anton Johansson,
Philippe Mathieu-Daudé, Riku Voipio, Paolo Bonzini,
Nicholas Piggin, Richard Henderson, qemu-ppc
TARGET_LONG_SIZE is equivalent of sizeof(target_ulong).
Since this is the single use of TARGET_LONG_SIZE in a
source file, use the equivalent form to be able to remove
the definition in a pair of commits.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/ppc/gdbstub.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c
index 3b28d4e21c7..4d36dcfb563 100644
--- a/target/ppc/gdbstub.c
+++ b/target/ppc/gdbstub.c
@@ -367,6 +367,7 @@ static int gdb_get_spr_reg(CPUState *cs, GByteArray *buf, int n)
{
PowerPCCPU *cpu = POWERPC_CPU(cs);
CPUPPCState *env = &cpu->env;
+ target_ulong val;
int reg;
int len;
@@ -375,10 +376,7 @@ static int gdb_get_spr_reg(CPUState *cs, GByteArray *buf, int n)
return 0;
}
- len = TARGET_LONG_SIZE;
-
/* Handle those SPRs that are not part of the env->spr[] array */
- target_ulong val;
switch (reg) {
#if defined(TARGET_PPC64)
case SPR_CFAR:
@@ -402,6 +400,7 @@ static int gdb_get_spr_reg(CPUState *cs, GByteArray *buf, int n)
}
gdb_get_regl(buf, val);
+ len = sizeof(val);
ppc_maybe_bswap_register(env, gdb_get_reg_ptr(buf, len), len);
return len;
}
@@ -410,6 +409,7 @@ static int gdb_set_spr_reg(CPUState *cs, uint8_t *mem_buf, int n)
{
PowerPCCPU *cpu = POWERPC_CPU(cs);
CPUPPCState *env = &cpu->env;
+ target_ulong val;
int reg;
int len;
@@ -418,11 +418,11 @@ static int gdb_set_spr_reg(CPUState *cs, uint8_t *mem_buf, int n)
return 0;
}
- len = TARGET_LONG_SIZE;
+ len = sizeof(val);
ppc_maybe_bswap_register(env, mem_buf, len);
/* Handle those SPRs that are not part of the env->spr[] array */
- target_ulong val = ldn_p(mem_buf, len);
+ val = ldn_p(mem_buf, len);
switch (reg) {
#if defined(TARGET_PPC64)
case SPR_CFAR:
--
2.47.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH-for-10.1 4/5] user/tswap: Replace TARGET_LONG_SIZE -> TARGET_LONG_BITS
2025-03-25 13:02 [PATCH-for-10.1 0/5] exec: Remove TARGET_LONG_SIZE definition Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2025-03-25 13:02 ` [PATCH-for-10.1 3/5] target/ppc/gdbstub: Replace TARGET_LONG_SIZE -> sizeof(target_ulong) Philippe Mathieu-Daudé
@ 2025-03-25 13:02 ` Philippe Mathieu-Daudé
2025-03-25 13:02 ` [PATCH-for-10.1 5/5] exec/target_long: Remove TARGET_LONG_SIZE definition Philippe Mathieu-Daudé
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-25 13:02 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel Henrique Barboza, Eduardo Habkost, Zhao Liu,
Pierrick Bouvier, Alex Bennée, Anton Johansson,
Philippe Mathieu-Daudé, Riku Voipio, Paolo Bonzini,
Nicholas Piggin, Richard Henderson, qemu-ppc
Having in "exec/target_long.h" this definition:
#define TARGET_LONG_SIZE (TARGET_LONG_BITS / 8)
It is safe to check TARGET_LONG_BITS == 32 instead
of the equivalent TARGET_LONG_SIZE == 4 expression.
This removes the last use of TARGET_LONG_SIZE outside
of "exec/target_long.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/user/tswap-target.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/user/tswap-target.h b/include/user/tswap-target.h
index 4719330dbbc..1c66a5b9344 100644
--- a/include/user/tswap-target.h
+++ b/include/user/tswap-target.h
@@ -11,7 +11,7 @@
#include "exec/cpu-defs.h"
#include "exec/tswap.h"
-#if TARGET_LONG_SIZE == 4
+#if TARGET_LONG_BITS == 32
#define tswapl(s) tswap32(s)
#define bswaptls(s) bswap32s(s)
#else
--
2.47.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH-for-10.1 5/5] exec/target_long: Remove TARGET_LONG_SIZE definition
2025-03-25 13:02 [PATCH-for-10.1 0/5] exec: Remove TARGET_LONG_SIZE definition Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2025-03-25 13:02 ` [PATCH-for-10.1 4/5] user/tswap: Replace TARGET_LONG_SIZE -> TARGET_LONG_BITS Philippe Mathieu-Daudé
@ 2025-03-25 13:02 ` Philippe Mathieu-Daudé
2025-03-25 14:15 ` [PATCH-for-10.1 0/5] exec: " Richard Henderson
2025-03-25 14:25 ` Pierrick Bouvier
6 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-25 13:02 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel Henrique Barboza, Eduardo Habkost, Zhao Liu,
Pierrick Bouvier, Alex Bennée, Anton Johansson,
Philippe Mathieu-Daudé, Riku Voipio, Paolo Bonzini,
Nicholas Piggin, Richard Henderson, qemu-ppc
Directly use TARGET_LONG_BITS, so we don't need
the TARGET_LONG_SIZE definition at all.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/exec/target_long.h | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/include/exec/target_long.h b/include/exec/target_long.h
index 3cd8e26a23f..d8898625f4e 100644
--- a/include/exec/target_long.h
+++ b/include/exec/target_long.h
@@ -20,17 +20,15 @@
#error TARGET_LONG_BITS not defined
#endif
-#define TARGET_LONG_SIZE (TARGET_LONG_BITS / 8)
-
/* target_ulong is the type of a virtual address */
-#if TARGET_LONG_SIZE == 4
+#if TARGET_LONG_BITS == 32
typedef int32_t target_long;
typedef uint32_t target_ulong;
#define TARGET_FMT_lx "%08x"
#define TARGET_FMT_ld "%d"
#define TARGET_FMT_lu "%u"
#define MO_TL MO_32
-#elif TARGET_LONG_SIZE == 8
+#elif TARGET_LONG_BITS == 64
typedef int64_t target_long;
typedef uint64_t target_ulong;
#define TARGET_FMT_lx "%016" PRIx64
@@ -38,7 +36,7 @@ typedef uint64_t target_ulong;
#define TARGET_FMT_lu "%" PRIu64
#define MO_TL MO_64
#else
-#error TARGET_LONG_SIZE undefined
+#error unsupported TARGET_LONG_BITS value
#endif
#endif /* _TARGET_LONG_H_ */
--
2.47.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH-for-10.1 0/5] exec: Remove TARGET_LONG_SIZE definition
2025-03-25 13:02 [PATCH-for-10.1 0/5] exec: Remove TARGET_LONG_SIZE definition Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2025-03-25 13:02 ` [PATCH-for-10.1 5/5] exec/target_long: Remove TARGET_LONG_SIZE definition Philippe Mathieu-Daudé
@ 2025-03-25 14:15 ` Richard Henderson
2025-03-25 14:25 ` Pierrick Bouvier
6 siblings, 0 replies; 10+ messages in thread
From: Richard Henderson @ 2025-03-25 14:15 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Daniel Henrique Barboza, Eduardo Habkost, Zhao Liu,
Pierrick Bouvier, Alex Bennée, Anton Johansson, Riku Voipio,
Paolo Bonzini, Nicholas Piggin, qemu-ppc
On 3/25/25 06:02, Philippe Mathieu-Daudé wrote:
> Philippe Mathieu-Daudé (5):
> target/i386: Use explicit little-endian LD/ST API
> gdbstub: Remove ldtul_be_p() and ldtul_le_p() macros
> target/ppc/gdbstub: Replace TARGET_LONG_SIZE -> sizeof(target_ulong)
> user/tswap: Replace TARGET_LONG_SIZE -> TARGET_LONG_BITS
> exec/target_long: Remove TARGET_LONG_SIZE definition
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH-for-10.1 0/5] exec: Remove TARGET_LONG_SIZE definition
2025-03-25 13:02 [PATCH-for-10.1 0/5] exec: Remove TARGET_LONG_SIZE definition Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2025-03-25 14:15 ` [PATCH-for-10.1 0/5] exec: " Richard Henderson
@ 2025-03-25 14:25 ` Pierrick Bouvier
6 siblings, 0 replies; 10+ messages in thread
From: Pierrick Bouvier @ 2025-03-25 14:25 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Daniel Henrique Barboza, Eduardo Habkost, Zhao Liu,
Alex Bennée, Anton Johansson, Riku Voipio, Paolo Bonzini,
Nicholas Piggin, Richard Henderson, qemu-ppc
On 3/25/25 06:02, Philippe Mathieu-Daudé wrote:
> TARGET_LONG_SIZE is only used in 1 source file
> and 1 header. Remove it to be able to focus on
> making TARGET_LONG_BITS target agnostic.
>
> Philippe Mathieu-Daudé (5):
> target/i386: Use explicit little-endian LD/ST API
> gdbstub: Remove ldtul_be_p() and ldtul_le_p() macros
> target/ppc/gdbstub: Replace TARGET_LONG_SIZE -> sizeof(target_ulong)
> user/tswap: Replace TARGET_LONG_SIZE -> TARGET_LONG_BITS
> exec/target_long: Remove TARGET_LONG_SIZE definition
>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH-for-10.1 2/5] gdbstub: Remove ldtul_be_p() and ldtul_le_p() macros
2025-03-25 13:02 ` [PATCH-for-10.1 2/5] gdbstub: Remove ldtul_be_p() and ldtul_le_p() macros Philippe Mathieu-Daudé
@ 2025-03-26 12:59 ` Alex Bennée
2025-03-31 11:49 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 10+ messages in thread
From: Alex Bennée @ 2025-03-26 12:59 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Daniel Henrique Barboza, Eduardo Habkost, Zhao Liu,
Pierrick Bouvier, Anton Johansson, Riku Voipio, Paolo Bonzini,
Nicholas Piggin, Richard Henderson, qemu-ppc
Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> Last uses of ldtul_be_p() were removed in commit 78920b4ff2b
> ("target/sparc: Use explicit big-endian LD/ST API"), and of
> ldtul_le_p() in 39631d57d7c ("target/riscv: Use explicit
> little-endian LD/ST API"). Remove these legacy macros.
I'm guessing these are commits in your tree because I can't see them in
origin.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/gdbstub/helpers.h | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/include/gdbstub/helpers.h b/include/gdbstub/helpers.h
> index 6f7cc48adcb..26140ef1ac0 100644
> --- a/include/gdbstub/helpers.h
> +++ b/include/gdbstub/helpers.h
> @@ -95,13 +95,9 @@ static inline uint8_t *gdb_get_reg_ptr(GByteArray *buf, int len)
> #if TARGET_LONG_BITS == 64
> #define gdb_get_regl(buf, val) gdb_get_reg64(buf, val)
> #define ldtul_p(addr) ldq_p(addr)
> -#define ldtul_le_p(addr) ldq_le_p(addr)
> -#define ldtul_be_p(addr) ldq_be_p(addr)
> #else
> #define gdb_get_regl(buf, val) gdb_get_reg32(buf, val)
> #define ldtul_p(addr) ldl_p(addr)
> -#define ldtul_le_p(addr) ldl_le_p(addr)
> -#define ldtul_be_p(addr) ldl_be_p(addr)
> #endif
>
> #endif /* _GDBSTUB_HELPERS_H_ */
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH-for-10.1 2/5] gdbstub: Remove ldtul_be_p() and ldtul_le_p() macros
2025-03-26 12:59 ` Alex Bennée
@ 2025-03-31 11:49 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-31 11:49 UTC (permalink / raw)
To: Alex Bennée
Cc: qemu-devel, Daniel Henrique Barboza, Eduardo Habkost, Zhao Liu,
Pierrick Bouvier, Anton Johansson, Riku Voipio, Paolo Bonzini,
Nicholas Piggin, Richard Henderson, qemu-ppc
On 26/3/25 13:59, Alex Bennée wrote:
> Philippe Mathieu-Daudé <philmd@linaro.org> writes:
>
>> Last uses of ldtul_be_p() were removed in commit 78920b4ff2b
>> ("target/sparc: Use explicit big-endian LD/ST API"), and of
>> ldtul_le_p() in 39631d57d7c ("target/riscv: Use explicit
>> little-endian LD/ST API"). Remove these legacy macros.
>
> I'm guessing these are commits in your tree because I can't see them in
> origin.
Oops. I'll respin altogether as a single series.
>
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> include/gdbstub/helpers.h | 4 ----
>> 1 file changed, 4 deletions(-)
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-03-31 11:50 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-25 13:02 [PATCH-for-10.1 0/5] exec: Remove TARGET_LONG_SIZE definition Philippe Mathieu-Daudé
2025-03-25 13:02 ` [PATCH-for-10.1 1/5] target/i386: Use explicit little-endian LD/ST API Philippe Mathieu-Daudé
2025-03-25 13:02 ` [PATCH-for-10.1 2/5] gdbstub: Remove ldtul_be_p() and ldtul_le_p() macros Philippe Mathieu-Daudé
2025-03-26 12:59 ` Alex Bennée
2025-03-31 11:49 ` Philippe Mathieu-Daudé
2025-03-25 13:02 ` [PATCH-for-10.1 3/5] target/ppc/gdbstub: Replace TARGET_LONG_SIZE -> sizeof(target_ulong) Philippe Mathieu-Daudé
2025-03-25 13:02 ` [PATCH-for-10.1 4/5] user/tswap: Replace TARGET_LONG_SIZE -> TARGET_LONG_BITS Philippe Mathieu-Daudé
2025-03-25 13:02 ` [PATCH-for-10.1 5/5] exec/target_long: Remove TARGET_LONG_SIZE definition Philippe Mathieu-Daudé
2025-03-25 14:15 ` [PATCH-for-10.1 0/5] exec: " Richard Henderson
2025-03-25 14:25 ` Pierrick Bouvier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.