]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Bug 494252 - s390x: Fix disassembly for LOCHI and friends
authorFlorian Krohm <flo2030@eich-krohm.de>
Wed, 9 Oct 2024 15:10:08 +0000 (17:10 +0200)
committerAndreas Arnez <arnez@linux.ibm.com>
Wed, 9 Oct 2024 15:10:08 +0000 (17:10 +0200)
The disassembly for LOCHI, LOCGHI, and LOCHHI is bogus.  For instance, the
instruction

    lochi  %r3,7,5

is disassembled as

    lochi  %r5,3,0,.+10

instead of

    lochinhe %r3,7

It seems that s390_format_RIE_RUPIX was copy-pasted from
s390_format_RIS_RUPI without adjusting it appropriately.  Fix this.

Reviewed-by: Andreas Arnez <arnez@linux.ibm.com>
NEWS
VEX/priv/guest_s390_toIR.c

diff --git a/NEWS b/NEWS
index 319caf68f89ce35b5bff6e909778d09f12dc2376..76cec58be9d0c0c7fc05eb5f90838b0e34507b47 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -71,6 +71,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
 493507  direct readlink syscall from PRE handler is incompatible with
         FUSE_COMPATIBLE_MAY_BLOCK
 493970  s390x: Store/restore FPC upon helper call causes slowdown
+494252  s390x: incorrect disassembly for LOCHI and friends
 n-i-bz  Improve messages for sigaltstack errors, use specific
         stack_t member names
 
index c3816a10edb8694625292b7806d31d986682ae36..2e0f6bb28d070c25016f561fc6431cb422054ae1 100644 (file)
@@ -2842,15 +2842,13 @@ s390_format_RIE_RUPI(const HChar *(*irgen)(UChar r1, UChar m3, UShort i4,
 }
 
 static void
-s390_format_RIE_RUPIX(const HChar *(*irgen)(UChar r1, UChar m3, UShort i4,
-                                           UChar i2),
-                     UChar r1, UChar m3, UShort i4, UChar i2, Int xmnm_kind)
+s390_format_RIE_RUPIX(const HChar *(*irgen)(UChar r1, UChar m3, UShort i2),
+                      UChar r1, UChar m3, UShort i2, Int xmnm_kind)
 {
-   const HChar *mnm = irgen(r1, m3, i4, i2);
+   irgen(r1, m3, i2);
 
    if (UNLIKELY(vex_traceflags & VEX_TRACE_FE))
-      s390_disasm(ENC5(XMNM, GPR, INT, CABM, PCREL), xmnm_kind, mnm, m3, r1,
-                  (Int)(Char)i2, m3, (Int)(Short)i4);
+      s390_disasm(ENC3(XMNM, GPR, INT), xmnm_kind, m3, r1, (Int)(Short)i2);
 }
 
 static void
@@ -17058,7 +17056,7 @@ s390_irgen_LOCFHR(UChar m3, UChar r1, UChar r2)
 }
 
 static const HChar *
-s390_irgen_LOCHHI(UChar r1, UChar m3, UShort i2, UChar unused)
+s390_irgen_LOCHHI(UChar r1, UChar m3, UShort i2)
 {
    next_insn_if(binop(Iop_CmpEQ32, s390_call_calculate_cond(m3), mkU32(0)));
    put_gpr_w0(r1, mkU32((UInt)(Int)(Short)i2));
@@ -17067,7 +17065,7 @@ s390_irgen_LOCHHI(UChar r1, UChar m3, UShort i2, UChar unused)
 }
 
 static const HChar *
-s390_irgen_LOCHI(UChar r1, UChar m3, UShort i2, UChar unused)
+s390_irgen_LOCHI(UChar r1, UChar m3, UShort i2)
 {
    next_insn_if(binop(Iop_CmpEQ32, s390_call_calculate_cond(m3), mkU32(0)));
    put_gpr_w1(r1, mkU32((UInt)(Int)(Short)i2));
@@ -17076,7 +17074,7 @@ s390_irgen_LOCHI(UChar r1, UChar m3, UShort i2, UChar unused)
 }
 
 static const HChar *
-s390_irgen_LOCGHI(UChar r1, UChar m3, UShort i2, UChar unused)
+s390_irgen_LOCGHI(UChar r1, UChar m3, UShort i2)
 {
    next_insn_if(binop(Iop_CmpEQ32, s390_call_calculate_cond(m3), mkU32(0)));
    put_gpr_dw0(r1, mkU64((ULong)(Long)(Short)i2));
@@ -22324,7 +22322,6 @@ s390_decode_6byte_and_irgen(const UChar *bytes)
                                                  RIEv3_r1(ovl),
                                                  RIEv3_m3(ovl),
                                                  RIEv3_i4(ovl),
-                                                 RIEv3_i2(ovl),
                                                  S390_XMNM_LOCHI);  goto ok;
    case 0xec0000000044ULL: s390_format_RIE_RRP(s390_irgen_BRXHG, RIE_r1(ovl),
                                                RIE_r3(ovl), RIE_i2(ovl));
@@ -22336,13 +22333,11 @@ s390_decode_6byte_and_irgen(const UChar *bytes)
                                                  RIEv3_r1(ovl),
                                                  RIEv3_m3(ovl),
                                                  RIEv3_i4(ovl),
-                                                 RIEv3_i2(ovl),
                                                  S390_XMNM_LOCGHI);  goto ok;
    case 0xec000000004eULL: s390_format_RIE_RUPIX(s390_irgen_LOCHHI,
                                                  RIEv3_r1(ovl),
                                                  RIEv3_m3(ovl),
                                                  RIEv3_i4(ovl),
-                                                 RIEv3_i2(ovl),
                                                  S390_XMNM_LOCHHI);  goto ok;
    case 0xec0000000051ULL: s390_format_RIE_RRUUU(s390_irgen_RISBLG,
                                                  RIE_RRUUU_r1(ovl),