qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] target/i386: fix byte swap issue with XMM register access
@ 2022-04-12  8:54 Alex Bennée
  2022-04-12 14:35 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Bennée @ 2022-04-12  8:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Alex Bennée, qemu-stable

During the conversion to the gdb_get_reg128 helpers the high and low
parts of the XMM register where inadvertently swapped. This causes
reads of the register to report the incorrect value to gdb.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/971
Fixes: b7b8756a9c (target/i386: use gdb_get_reg helpers)
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: qemu-stable@nongnu.org
---
 target/i386/gdbstub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/i386/gdbstub.c b/target/i386/gdbstub.c
index 098a2ad15a..c3a2cf6f28 100644
--- a/target/i386/gdbstub.c
+++ b/target/i386/gdbstub.c
@@ -129,8 +129,8 @@ int x86_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
         n -= IDX_XMM_REGS;
         if (n < CPU_NB_REGS32 || TARGET_LONG_BITS == 64) {
             return gdb_get_reg128(mem_buf,
-                                  env->xmm_regs[n].ZMM_Q(0),
-                                  env->xmm_regs[n].ZMM_Q(1));
+                                  env->xmm_regs[n].ZMM_Q(1),
+                                  env->xmm_regs[n].ZMM_Q(0));
         }
     } else {
         switch (n) {
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC PATCH] target/i386: fix byte swap issue with XMM register access
  2022-04-12  8:54 [RFC PATCH] target/i386: fix byte swap issue with XMM register access Alex Bennée
@ 2022-04-12 14:35 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2022-04-12 14:35 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel; +Cc: pbonzini, qemu-stable

On 4/12/22 01:54, Alex Bennée wrote:
> During the conversion to the gdb_get_reg128 helpers the high and low
> parts of the XMM register where inadvertently swapped. This causes
> reads of the register to report the incorrect value to gdb.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/971
> Fixes: b7b8756a9c (target/i386: use gdb_get_reg helpers)
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Cc: qemu-stable@nongnu.org
> ---
>   target/i386/gdbstub.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

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


r~

> 
> diff --git a/target/i386/gdbstub.c b/target/i386/gdbstub.c
> index 098a2ad15a..c3a2cf6f28 100644
> --- a/target/i386/gdbstub.c
> +++ b/target/i386/gdbstub.c
> @@ -129,8 +129,8 @@ int x86_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
>           n -= IDX_XMM_REGS;
>           if (n < CPU_NB_REGS32 || TARGET_LONG_BITS == 64) {
>               return gdb_get_reg128(mem_buf,
> -                                  env->xmm_regs[n].ZMM_Q(0),
> -                                  env->xmm_regs[n].ZMM_Q(1));
> +                                  env->xmm_regs[n].ZMM_Q(1),
> +                                  env->xmm_regs[n].ZMM_Q(0));
>           }
>       } else {
>           switch (n) {



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-12 14:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-12  8:54 [RFC PATCH] target/i386: fix byte swap issue with XMM register access Alex Bennée
2022-04-12 14:35 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).