Skip to content

Commit

Permalink
target/s390x: Make CKSM raise an exception if R2 is odd
Browse files Browse the repository at this point in the history
R2 designates an even-odd register pair; the instruction should raise
a specification exception when R2 is not even.

Cc: qemu-stable@nongnu.org
Fixes: e023e83 ("s390x: translate engine for s390x CPU")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20230724082032.66864-2-iii@linux.ibm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 761b0aa)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
iii-i authored and Michael Tokarev committed Jul 31, 2023
1 parent 6f7c39a commit bdbf5e1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion target/s390x/tcg/insn-data.h.inc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
C(0xb2fa, NIAI, E, EH, 0, 0, 0, 0, 0, 0)

/* CHECKSUM */
C(0xb241, CKSM, RRE, Z, r1_o, ra2, new, r1_32, cksm, 0)
C(0xb241, CKSM, RRE, Z, r1_o, ra2_E, new, r1_32, cksm, 0)

/* COPY SIGN */
F(0xb372, CPSDR, RRF_b, FPSSH, f3, f2, new, f1, cps, 0, IF_AFP1 | IF_AFP2 | IF_AFP3)
Expand Down
6 changes: 6 additions & 0 deletions target/s390x/tcg/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -5800,6 +5800,12 @@ static void in2_ra2(DisasContext *s, DisasOps *o)
}
#define SPEC_in2_ra2 0

static void in2_ra2_E(DisasContext *s, DisasOps *o)
{
return in2_ra2(s, o);
}
#define SPEC_in2_ra2_E SPEC_r2_even

static void in2_a2(DisasContext *s, DisasOps *o)
{
int x2 = have_field(s, x2) ? get_field(s, x2) : 0;
Expand Down

0 comments on commit bdbf5e1

Please sign in to comment.