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

Philippe Mathieu-Daudé posted 2 patches 1 month, 2 weeks ago
[PATCH v3 2/2] gdbstub/helpers: Introduce ldtul_$endian_p() helpers
Posted by Philippe Mathieu-Daudé 1 month, 2 weeks ago
Introduce ldtul_le_p() and ldtul_be_p() to use directly
in place of ldtul_p() when a target endianness is fixed.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/gdbstub/helpers.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/gdbstub/helpers.h b/include/gdbstub/helpers.h
index 26140ef1ac0..6f7cc48adcb 100644
--- a/include/gdbstub/helpers.h
+++ b/include/gdbstub/helpers.h
@@ -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_ */
-- 
2.45.2


Re: [PATCH v3 2/2] gdbstub/helpers: Introduce ldtul_$endian_p() helpers
Posted by Richard Henderson 1 month, 1 week ago
On 10/10/24 10:52, Philippe Mathieu-Daudé wrote:
> Introduce ldtul_le_p() and ldtul_be_p() to use directly
> in place of ldtul_p() when a target endianness is fixed.
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   include/gdbstub/helpers.h | 4 ++++
>   1 file changed, 4 insertions(+)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~

Re: [PATCH v3 2/2] gdbstub/helpers: Introduce ldtul_$endian_p() helpers
Posted by Alex Bennée 1 month, 2 weeks ago
Philippe Mathieu-Daudé <philmd@linaro.org> writes:

> Introduce ldtul_le_p() and ldtul_be_p() to use directly
> in place of ldtul_p() when a target endianness is fixed.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Acked-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro