@@ -462,6 +462,7 @@ static inline void set_pc(CPULoongArchState *env, uint64_t value)
#define HW_FLAGS_FP 0x40
#define HW_FLAGS_FP_SP 0x80
#define HW_FLAGS_FP_DP 0x100
+#define HW_FLAGS_LSPW 0x200
static inline void cpu_get_tb_cpu_state(CPULoongArchState *env, vaddr *pc,
uint64_t *cs_base, uint32_t *flags)
@@ -475,6 +476,7 @@ static inline void cpu_get_tb_cpu_state(CPULoongArchState *env, vaddr *pc,
*flags |= FIELD_EX32(env->cpucfg[2], CPUCFG2, FP) * HW_FLAGS_FP;
*flags |= FIELD_EX32(env->cpucfg[2], CPUCFG2, FP_SP) * HW_FLAGS_FP_SP;
*flags |= FIELD_EX32(env->cpucfg[2], CPUCFG2, FP_DP) * HW_FLAGS_FP_DP;
+ *flags |= FIELD_EX32(env->cpucfg[2], CPUCFG2, LSPW) * HW_FLAGS_LSPW;
}
void loongarch_cpu_list(void);
@@ -432,11 +432,18 @@ static bool trans_cacop(DisasContext *ctx, arg_cacop *a)
return true;
}
+#define REQUIRE_LSPW do { \
+ if ((ctx->base.tb->flags & HW_FLAGS_LSPW) == 0) { \
+ return false; \
+ } \
+} while (0)
+
static bool trans_ldpte(DisasContext *ctx, arg_ldpte *a)
{
TCGv_i32 mem_idx = tcg_constant_i32(ctx->mem_idx);
TCGv src1 = gpr_src(ctx, a->rj, EXT_NONE);
+ REQUIRE_LSPW;
if (check_plv(ctx)) {
return false;
}
@@ -450,6 +457,7 @@ static bool trans_lddir(DisasContext *ctx, arg_lddir *a)
TCGv src = gpr_src(ctx, a->rj, EXT_NONE);
TCGv dest = gpr_dst(ctx, a->rd, EXT_NONE);
+ REQUIRE_LSPW;
if (check_plv(ctx)) {
return false;
}
Signed-off-by: Song Gao <gaosong@loongson.cn> --- target/loongarch/cpu.h | 2 ++ target/loongarch/insn_trans/trans_privileged.c.inc | 8 ++++++++ 2 files changed, 10 insertions(+)