[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 15/18] target/loongarch: Add avail_LSPW to check LSPW instruct
From: |
Song Gao |
Subject: |
[PATCH v3 15/18] target/loongarch: Add avail_LSPW to check LSPW instructions |
Date: |
Thu, 17 Aug 2023 17:31:18 +0800 |
Signed-off-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
target/loongarch/insn_trans/trans_privileged.c.inc | 8 ++++++++
target/loongarch/translate.h | 1 +
2 files changed, 9 insertions(+)
diff --git a/target/loongarch/insn_trans/trans_privileged.c.inc
b/target/loongarch/insn_trans/trans_privileged.c.inc
index 684ff547a7..099cd871f0 100644
--- a/target/loongarch/insn_trans/trans_privileged.c.inc
+++ b/target/loongarch/insn_trans/trans_privileged.c.inc
@@ -437,6 +437,10 @@ 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);
+ if (!avail_LSPW(ctx)) {
+ return true;
+ }
+
if (check_plv(ctx)) {
return false;
}
@@ -450,6 +454,10 @@ 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);
+ if (!avail_LSPW(ctx)) {
+ return true;
+ }
+
if (check_plv(ctx)) {
return false;
}
diff --git a/target/loongarch/translate.h b/target/loongarch/translate.h
index 0f244cd83b..f0d7b82932 100644
--- a/target/loongarch/translate.h
+++ b/target/loongarch/translate.h
@@ -20,6 +20,7 @@
#define avail_FP(C) (FIELD_EX32((C)->cpucfg2, CPUCFG2, FP))
#define avail_FP_SP(C) (FIELD_EX32((C)->cpucfg2, CPUCFG2, FP_SP))
#define avail_FP_DP(C) (FIELD_EX32((C)->cpucfg2, CPUCFG2, FP_DP))
+#define avail_LSPW(C) (FIELD_EX32((C)->cpucfg2, CPUCFG2, LSPW))
/*
* If an operation is being performed on less than TARGET_LONG_BITS,
--
2.39.1
- [PATCH v3 03/18] target/loongarch: Add GDB support for loongarch32 mode, (continued)
- [PATCH v3 03/18] target/loongarch: Add GDB support for loongarch32 mode, Song Gao, 2023/08/17
- [PATCH v3 09/18] target/loongarch: Sign extend results in VA32 mode, Song Gao, 2023/08/17
- [PATCH v3 02/18] target/loongarch: Add new object class for loongarch32 cpus, Song Gao, 2023/08/17
- [PATCH v3 06/18] target/loongarch: Support LoongArch32 VPPN, Song Gao, 2023/08/17
- [PATCH v3 08/18] target/loongarch: Truncate high 32 bits of address in VA32 mode, Song Gao, 2023/08/17
- [PATCH v3 15/18] target/loongarch: Add avail_LSPW to check LSPW instructions,
Song Gao <=
- [PATCH v3 11/18] target/loongarch: Add a check parameter to the TRANS macro, Song Gao, 2023/08/17
- [PATCH v3 05/18] target/loongarch: Support LoongArch32 DMW, Song Gao, 2023/08/17
- [PATCH v3 13/18] target/loongarch: Add loongarch32 cpu la132, Song Gao, 2023/08/17
- [PATCH v3 17/18] target/loongarch: Add avail_LSX to check LSX instructions, Song Gao, 2023/08/17
- [PATCH v3 12/18] target/loongarch: Add avail_64 to check la64-only instructions, Song Gao, 2023/08/17