Skip to content

Commit 8defe9d

Browse files
committed
target/ppc: Fix facility interrupt checks for VSX
Facility interrupt checks in general should come after the ISA version check, because the facility interrupt and facility type themselves are ISA dependent and should not appear on CPUs where the instruction does not exist at all. This resolves a QEMU crash booting NetBSD/macppc due to qemu: fatal: Raised an exception without defined vector 94 Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2741 Cc: Chinmay Rath <[email protected]> Cc: [email protected] Debugged-by: Richard Henderson <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Fixes: aa0f34e ("target/ppc: implement vrlq") Fixes: 7419dc5 ("target/ppc: Move VSX vector storage access insns to decodetree.") Signed-off-by: Nicholas Piggin <[email protected]>
1 parent 1490d0b commit 8defe9d

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

target/ppc/translate/vmx-impl.c.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -994,8 +994,8 @@ static bool do_vector_rotl_quad(DisasContext *ctx, arg_VX *a, bool mask,
994994
{
995995
TCGv_i64 ah, al, vrb, n, t0, t1, zero = tcg_constant_i64(0);
996996

997-
REQUIRE_VECTOR(ctx);
998997
REQUIRE_INSNS_FLAGS2(ctx, ISA310);
998+
REQUIRE_VECTOR(ctx);
999999

10001000
ah = tcg_temp_new_i64();
10011001
al = tcg_temp_new_i64();

target/ppc/translate/vsx-impl.c.inc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ static bool trans_LXVD2X(DisasContext *ctx, arg_LXVD2X *a)
6161
TCGv EA;
6262
TCGv_i64 t0;
6363

64-
REQUIRE_VSX(ctx);
6564
REQUIRE_INSNS_FLAGS2(ctx, VSX);
65+
REQUIRE_VSX(ctx);
6666

6767
t0 = tcg_temp_new_i64();
6868
gen_set_access_type(ctx, ACCESS_INT);
@@ -80,8 +80,8 @@ static bool trans_LXVW4X(DisasContext *ctx, arg_LXVW4X *a)
8080
TCGv EA;
8181
TCGv_i64 xth, xtl;
8282

83-
REQUIRE_VSX(ctx);
8483
REQUIRE_INSNS_FLAGS2(ctx, VSX);
84+
REQUIRE_VSX(ctx);
8585

8686
xth = tcg_temp_new_i64();
8787
xtl = tcg_temp_new_i64();
@@ -113,12 +113,12 @@ static bool trans_LXVWSX(DisasContext *ctx, arg_LXVWSX *a)
113113
TCGv EA;
114114
TCGv_i32 data;
115115

116+
REQUIRE_INSNS_FLAGS2(ctx, ISA300);
116117
if (a->rt < 32) {
117118
REQUIRE_VSX(ctx);
118119
} else {
119120
REQUIRE_VECTOR(ctx);
120121
}
121-
REQUIRE_INSNS_FLAGS2(ctx, ISA300);
122122

123123
gen_set_access_type(ctx, ACCESS_INT);
124124
EA = do_ea_calc(ctx, a->ra, cpu_gpr[a->rb]);
@@ -133,8 +133,8 @@ static bool trans_LXVDSX(DisasContext *ctx, arg_LXVDSX *a)
133133
TCGv EA;
134134
TCGv_i64 data;
135135

136-
REQUIRE_VSX(ctx);
137136
REQUIRE_INSNS_FLAGS2(ctx, VSX);
137+
REQUIRE_VSX(ctx);
138138

139139
gen_set_access_type(ctx, ACCESS_INT);
140140
EA = do_ea_calc(ctx, a->ra, cpu_gpr[a->rb]);
@@ -185,8 +185,8 @@ static bool trans_LXVH8X(DisasContext *ctx, arg_LXVH8X *a)
185185
TCGv EA;
186186
TCGv_i64 xth, xtl;
187187

188-
REQUIRE_VSX(ctx);
189188
REQUIRE_INSNS_FLAGS2(ctx, ISA300);
189+
REQUIRE_VSX(ctx);
190190

191191
xth = tcg_temp_new_i64();
192192
xtl = tcg_temp_new_i64();
@@ -208,8 +208,8 @@ static bool trans_LXVB16X(DisasContext *ctx, arg_LXVB16X *a)
208208
TCGv EA;
209209
TCGv_i128 data;
210210

211-
REQUIRE_VSX(ctx);
212211
REQUIRE_INSNS_FLAGS2(ctx, ISA300);
212+
REQUIRE_VSX(ctx);
213213

214214
data = tcg_temp_new_i128();
215215
gen_set_access_type(ctx, ACCESS_INT);
@@ -312,8 +312,8 @@ static bool trans_STXVD2X(DisasContext *ctx, arg_STXVD2X *a)
312312
TCGv EA;
313313
TCGv_i64 t0;
314314

315-
REQUIRE_VSX(ctx);
316315
REQUIRE_INSNS_FLAGS2(ctx, VSX);
316+
REQUIRE_VSX(ctx);
317317

318318
t0 = tcg_temp_new_i64();
319319
gen_set_access_type(ctx, ACCESS_INT);
@@ -331,8 +331,8 @@ static bool trans_STXVW4X(DisasContext *ctx, arg_STXVW4X *a)
331331
TCGv EA;
332332
TCGv_i64 xsh, xsl;
333333

334-
REQUIRE_VSX(ctx);
335334
REQUIRE_INSNS_FLAGS2(ctx, VSX);
335+
REQUIRE_VSX(ctx);
336336

337337
xsh = tcg_temp_new_i64();
338338
xsl = tcg_temp_new_i64();
@@ -364,8 +364,8 @@ static bool trans_STXVH8X(DisasContext *ctx, arg_STXVH8X *a)
364364
TCGv EA;
365365
TCGv_i64 xsh, xsl;
366366

367-
REQUIRE_VSX(ctx);
368367
REQUIRE_INSNS_FLAGS2(ctx, ISA300);
368+
REQUIRE_VSX(ctx);
369369

370370
xsh = tcg_temp_new_i64();
371371
xsl = tcg_temp_new_i64();
@@ -394,8 +394,8 @@ static bool trans_STXVB16X(DisasContext *ctx, arg_STXVB16X *a)
394394
TCGv EA;
395395
TCGv_i128 data;
396396

397-
REQUIRE_VSX(ctx);
398397
REQUIRE_INSNS_FLAGS2(ctx, ISA300);
398+
REQUIRE_VSX(ctx);
399399

400400
data = tcg_temp_new_i128();
401401
gen_set_access_type(ctx, ACCESS_INT);

0 commit comments

Comments
 (0)