qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] d1bb97: target/i386: fix cmpxchg with 32-bit


From: Paolo Bonzini
Subject: [Qemu-commits] [qemu/qemu] d1bb97: target/i386: fix cmpxchg with 32-bit register dest...
Date: Tue, 15 Nov 2022 15:54:40 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: d1bb978ba1654ddc6e927621b554eebb216fb9dd
      
https://github.com/qemu/qemu/commit/d1bb978ba1654ddc6e927621b554eebb216fb9dd
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   2022-11-15 (Tue, 15 Nov 2022)

  Changed paths:
    M target/i386/tcg/translate.c
    M tests/tcg/x86_64/Makefile.target
    A tests/tcg/x86_64/cmpxchg.c

  Log Message:
  -----------
  target/i386: fix cmpxchg with 32-bit register destination

Unlike the memory case, where "the destination operand receives a write
cycle without regard to the result of the comparison", rm must not be
touched altogether if the write fails, including not zero-extending
it on 64-bit processors.  This is not how the movcond currently works,
because it is always followed by a gen_op_mov_reg_v to rm.

To fix it, introduce a new function that is similar to gen_op_mov_reg_v
but writes to a TCG temporary.

Considering that gen_extu(ot, oldv) is not needed in the memory case
either, the two cases for register and memory destinations are different
enough that one might as well fuse the two "if (mod == 3)" into one.
So do that too.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/508
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[rth: Add a test case ]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: 35d95e4126d83c0bb0de83007494d184f6111b3d
      
https://github.com/qemu/qemu/commit/35d95e4126d83c0bb0de83007494d184f6111b3d
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   2022-11-15 (Tue, 15 Nov 2022)

  Changed paths:
    M target/i386/tcg/translate.c

  Log Message:
  -----------
  target/i386: hardcode R_EAX as destination register for LAHF/SAHF

When translating code that is using LAHF and SAHF in combination with the
REX prefix, the instructions should not use any other register than AH;
however, QEMU selects SPL (SP being register 4, just like AH) if the
REX prefix is present.  To fix this, use deposit directly without
going through gen_op_mov_v_reg and gen_op_mov_reg_v.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/130
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: dd64bcea0016938ef0be7a0c930f98b77d5e1612
      
https://github.com/qemu/qemu/commit/dd64bcea0016938ef0be7a0c930f98b77d5e1612
  Author: Stefan Hajnoczi <stefanha@redhat.com>
  Date:   2022-11-15 (Tue, 15 Nov 2022)

  Changed paths:
    M target/i386/tcg/translate.c
    M tests/tcg/x86_64/Makefile.target
    A tests/tcg/x86_64/cmpxchg.c

  Log Message:
  -----------
  Merge tag 'pull-x86-20221115' of https://gitlab.com/rth7680/qemu into staging

Fix cmpxchgl writeback to rax.
Fix lahf/sahf for 64-bit

# -----BEGIN PGP SIGNATURE-----
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmNy0OYdHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV/2XwgAr2yCrG8irdVBmD1B
# rNW8xJJWIwEXqJ3KSPBSMEQ5lCVW7urwIYasnTYPV9TMwXvwwbFzCzovp+pJ402b
# GPCkkjS/DdLHKbFqzEIcVld6IASaYNbcCZjEDeN3U14RZW9X7Aujy1Yg6qWxWnIc
# ony2awzocGq5iafvPCMATmIkPJErnFv6mLttRq52CmBATgVtsSrxEF735NVuZAaq
# t9bfN+gQpXARo+AcGzqTpNtcR4DTzE2hyJrXAMivTJtAeEl8XweOq8eV7PkAf4qw
# ED/AT6G7I38Buzj1o8SN3G54d/v/jwV/L9fWCLs92QZJC/gIi9B7qZf8DglI1ipV
# YCFKQw==
# =xP4E
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 14 Nov 2022 18:36:06 EST
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "richard.henderson@linaro.org"
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" 
[full]
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* tag 'pull-x86-20221115' of https://gitlab.com/rth7680/qemu:
  target/i386: hardcode R_EAX as destination register for LAHF/SAHF
  target/i386: fix cmpxchg with 32-bit register destination

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


Compare: https://github.com/qemu/qemu/compare/bb00d0aa620e...dd64bcea0016



reply via email to

[Prev in Thread] Current Thread [Next in Thread]