[v2,05/14] gdbstub: add helper for 128 bit registers

Message ID 20191130084602.10818-6-alex.bennee@linaro.org
State Superseded
Headers show
Series
  • gdbstub refactor and SVE support
Related show

Commit Message

Alex Bennée Nov. 30, 2019, 8:45 a.m.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>


---
v2
  - take care of endianess of the whole 128 bit word
---
 include/exec/gdbstub.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

-- 
2.20.1

Comments

Philippe Mathieu-Daudé Dec. 1, 2019, 8:02 p.m. | #1
On 11/30/19 9:45 AM, Alex Bennée wrote:
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> 

> ---

> v2

>    - take care of endianess of the whole 128 bit word

> ---

>   include/exec/gdbstub.h | 13 +++++++++++++

>   1 file changed, 13 insertions(+)

> 

> diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h

> index 08363969c14..59e366ba3af 100644

> --- a/include/exec/gdbstub.h

> +++ b/include/exec/gdbstub.h

> @@ -102,6 +102,19 @@ static inline int gdb_get_reg64(uint8_t *mem_buf, uint64_t val)

>       return 8;

>   }

>   

> +static inline int gdb_get_reg128(uint8_t *mem_buf, uint64_t val_hi,

> +                                 uint64_t val_lo)

> +{

> +#ifdef TARGET_WORDS_BIGENDIAN

> +    stq_p(mem_buf, val_hi);

> +    stq_p(mem_buf + 8, val_lo);

> +#else

> +    stq_p(mem_buf, val_lo);

> +    stq_p(mem_buf + 8, val_hi);

> +#endif

> +    return 16;

> +}

> +

>   #if TARGET_LONG_BITS == 64

>   #define gdb_get_regl(buf, val) gdb_get_reg64(buf, val)

>   #define ldtul_p(addr) ldq_p(addr)

> 


Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Richard Henderson Dec. 2, 2019, 2:19 a.m. | #2
On 11/30/19 8:45 AM, Alex Bennée wrote:
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> 

> ---

> v2

>   - take care of endianess of the whole 128 bit word

> ---

>  include/exec/gdbstub.h | 13 +++++++++++++

>  1 file changed, 13 insertions(+)


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


r~

Patch

diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h
index 08363969c14..59e366ba3af 100644
--- a/include/exec/gdbstub.h
+++ b/include/exec/gdbstub.h
@@ -102,6 +102,19 @@  static inline int gdb_get_reg64(uint8_t *mem_buf, uint64_t val)
     return 8;
 }
 
+static inline int gdb_get_reg128(uint8_t *mem_buf, uint64_t val_hi,
+                                 uint64_t val_lo)
+{
+#ifdef TARGET_WORDS_BIGENDIAN
+    stq_p(mem_buf, val_hi);
+    stq_p(mem_buf + 8, val_lo);
+#else
+    stq_p(mem_buf, val_lo);
+    stq_p(mem_buf + 8, val_hi);
+#endif
+    return 16;
+}
+
 #if TARGET_LONG_BITS == 64
 #define gdb_get_regl(buf, val) gdb_get_reg64(buf, val)
 #define ldtul_p(addr) ldq_p(addr)