Skip to contentSkip to conversation

gdbstub: Introduce ldtul_$endian_p() helpers

PATCH In review Philippe Mathieu-Daudé 4 participants 8 messages Oct 10, 2024 – Oct 15, 2024

lore
Share & tools
lore
#0 lore raw

v3 cover gdbstub: Introduce ldtul_$endian_p() helpers

Only unreviewed patches from v2:
https://lore.kernel.org/qemu-devel/[email protected]/

Philippe Mathieu-Daudé (2):
exec/tswap: Massage target_needs_bswap() definition gdbstub/helpers: Introduce ldtul_$endian_p() helpers

 include/exec/tswap.h      | 2 +-
 include/gdbstub/helpers.h | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
Signature · 1 line
2.45.2
#1 lore raw

PATCH v3 1/2 exec/tswap: Massage target_needs_bswap() definition

Invert target_needs_bswap() comparison to match the COMPILING_PER_TARGET definition (2 lines upper).

Message-Id: <[email protected]>

---
 include/exec/tswap.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/exec/tswap.h +1 -1
index b7a41913475..ecd4faef015 100644
@@ -28,7 +28,7 @@ bool target_words_bigendian(void);
 #ifdef COMPILING_PER_TARGET
 #define target_needs_bswap()  (HOST_BIG_ENDIAN != TARGET_BIG_ENDIAN)
 #else
-#define target_needs_bswap()  (target_words_bigendian() != HOST_BIG_ENDIAN)
+#define target_needs_bswap()  (HOST_BIG_ENDIAN != target_words_bigendian())
 #endif /* COMPILING_PER_TARGET */
 
 static inline uint16_t tswap16(uint16_t s)
Signature · 1 line
2.45.2
Reviewed-by on v3 1/2
#2 lore raw

Re: [PATCH v3 1/2] exec/tswap: Massage target_needs_bswap() definition

Quoted 8 lines · Philippe Mathieu-Daudé

Invert target_needs_bswap() comparison to match the COMPILING_PER_TARGET definition (2 lines upper).

Message-Id: <[email protected]>

---
  include/exec/tswap.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

r~

Quoted 14 lines
include/exec/tswap.h +1 -1
index b7a41913475..ecd4faef015 100644
@@ -28,7 +28,7 @@ bool target_words_bigendian(void);
  #ifdef COMPILING_PER_TARGET
  #define target_needs_bswap()  (HOST_BIG_ENDIAN != TARGET_BIG_ENDIAN)
  #else
-#define target_needs_bswap()  (target_words_bigendian() != HOST_BIG_ENDIAN)
+#define target_needs_bswap()  (HOST_BIG_ENDIAN != target_words_bigendian())
  #endif /* COMPILING_PER_TARGET */
 
  static inline uint16_t tswap16(uint16_t s)
#3 lore raw

PATCH v3 2/2 gdbstub/helpers: Introduce ldtul_$endian_p() helpers

In reply to Philippe Mathieu-Daudé

Introduce ldtul_le_p() and ldtul_be_p() to use directly in place of ldtul_p() when a target endianness is fixed.

---
 include/gdbstub/helpers.h | 4 ++++
 1 file changed, 4 insertions(+)
include/gdbstub/helpers.h +4 -0
index 26140ef1ac0..6f7cc48adcb 100644
@@ -95,9 +95,13 @@ 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_ */
Signature · 1 line
2.45.2
Reviewed-by on v3 2/2
#5 lore raw

Re: [PATCH v3 2/2] gdbstub/helpers: Introduce ldtul_$endian_p() helpers

In reply to Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé

Introduce ldtul_le_p() and ldtul_be_p() to use directly in place of ldtul_p() when a target endianness is fixed.

---
  include/gdbstub/helpers.h | 4 ++++
  1 file changed, 4 insertions(+)

r~

Reviewed-by on the v3 series
#6 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 11 lines · Philippe Mathieu-Daudé

Only unreviewed patches from v2:
https://lore.kernel.org/qemu-devel/[email protected]/

Philippe Mathieu-Daudé (2):
exec/tswap: Massage target_needs_bswap() definition gdbstub/helpers: Introduce ldtul_$endian_p() helpers

  include/exec/tswap.h      | 2 +-
  include/gdbstub/helpers.h | 4 ++++
  2 files changed, 5 insertions(+), 1 deletion(-)

For the series: