[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/30] target/ppc: add macros to check privilege level
From: |
Daniel Henrique Barboza |
Subject: |
[PULL 17/30] target/ppc: add macros to check privilege level |
Date: |
Mon, 18 Jul 2022 14:21:55 -0300 |
From: Matheus Ferst <matheus.ferst@eldorado.org.br>
Equivalent to CHK_SV and CHK_HV, but can be used in decodetree methods.
Reviewed-by: Leandro Lupori <leandro.lupori@eldorado.org.br>
Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
Signed-off-by: Lucas Coutinho <lucas.coutinho@eldorado.org.br>
Message-Id: <20220701133507.740619-3-lucas.coutinho@eldorado.org.br>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
target/ppc/translate.c | 21 +++++++++++++++++++++
target/ppc/translate/fixedpoint-impl.c.inc | 7 ++-----
2 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index 8afc2e4691..e373c39fc8 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -6559,6 +6559,27 @@ static int times_16(DisasContext *ctx, int x)
} \
} while (0)
+#if !defined(CONFIG_USER_ONLY)
+#define REQUIRE_SV(CTX) \
+ do { \
+ if (unlikely((CTX)->pr)) { \
+ gen_priv_opc(CTX); \
+ return true; \
+ } \
+ } while (0)
+
+#define REQUIRE_HV(CTX) \
+ do { \
+ if (unlikely((CTX)->pr || !(CTX)->hv)) \
+ gen_priv_opc(CTX); \
+ return true; \
+ } \
+ } while (0)
+#else
+#define REQUIRE_SV(CTX) do { gen_priv_opc(CTX); return true; } while (0)
+#define REQUIRE_HV(CTX) do { gen_priv_opc(CTX); return true; } while (0)
+#endif
+
/*
* Helpers for implementing sets of trans_* functions.
* Defer the implementation of NAME to FUNC, with optional extra arguments.
diff --git a/target/ppc/translate/fixedpoint-impl.c.inc
b/target/ppc/translate/fixedpoint-impl.c.inc
index cb0097bedb..db14d3bebc 100644
--- a/target/ppc/translate/fixedpoint-impl.c.inc
+++ b/target/ppc/translate/fixedpoint-impl.c.inc
@@ -79,11 +79,8 @@ static bool do_ldst_quad(DisasContext *ctx, arg_D *a, bool
store, bool prefixed)
REQUIRE_INSNS_FLAGS(ctx, 64BX);
if (!prefixed && !(ctx->insns_flags2 & PPC2_LSQ_ISA207)) {
- if (ctx->pr) {
- /* lq and stq were privileged prior to V. 2.07 */
- gen_priv_exception(ctx, POWERPC_EXCP_PRIV_OPC);
- return true;
- }
+ /* lq and stq were privileged prior to V. 2.07 */
+ REQUIRE_SV(ctx);
if (ctx->le_mode) {
gen_align_no_le(ctx);
--
2.36.1
- [PULL 08/30] target/ppc: Fix gen_priv_exception error value in mfspr/mtspr, (continued)
- [PULL 08/30] target/ppc: Fix gen_priv_exception error value in mfspr/mtspr, Daniel Henrique Barboza, 2022/07/18
- [PULL 09/30] target/ppc: fix exception error value in slbfee, Daniel Henrique Barboza, 2022/07/18
- [PULL 10/30] target/ppc: remove mfdcrux and mtdcrux, Daniel Henrique Barboza, 2022/07/18
- [PULL 13/30] target/ppc: fix exception error code in spr_write_excp_vector, Daniel Henrique Barboza, 2022/07/18
- [PULL 11/30] target/ppc: fix exception error code in helper_{load, store}_dcr, Daniel Henrique Barboza, 2022/07/18
- [PULL 12/30] target/ppc: fix PMU Group A register read/write exceptions, Daniel Henrique Barboza, 2022/07/18
- [PULL 15/30] target/ppc: Implement ISA 3.00 tlbie[l], Daniel Henrique Barboza, 2022/07/18
- [PULL 16/30] target/ppc: receive DisasContext explicitly in GEN_PRIV, Daniel Henrique Barboza, 2022/07/18
- [PULL 14/30] target/ppc: Move tlbie[l] to decode tree, Daniel Henrique Barboza, 2022/07/18
- [PULL 20/30] target/ppc: Move slbia to decodetree, Daniel Henrique Barboza, 2022/07/18
- [PULL 17/30] target/ppc: add macros to check privilege level,
Daniel Henrique Barboza <=
- [PULL 21/30] target/ppc: Move slbmte to decodetree, Daniel Henrique Barboza, 2022/07/18
- [PULL 24/30] target/ppc: Move slbfee to decodetree, Daniel Henrique Barboza, 2022/07/18
- [PULL 19/30] target/ppc: Move slbieg to decodetree, Daniel Henrique Barboza, 2022/07/18
- [PULL 18/30] target/ppc: Move slbie to decodetree, Daniel Henrique Barboza, 2022/07/18
- [PULL 29/30] target/ppc: Improve Radix xlate level validation, Daniel Henrique Barboza, 2022/07/18
- [PULL 23/30] target/ppc: Move slbmfee to decodetree, Daniel Henrique Barboza, 2022/07/18
- [PULL 27/30] target/ppc: check tb_env != 0 before printing TBU/TBL/DECR, Daniel Henrique Barboza, 2022/07/18
- [PULL 22/30] target/ppc: Move slbmfev to decodetree, Daniel Henrique Barboza, 2022/07/18
- [PULL 26/30] target/ppc: Implement slbiag, Daniel Henrique Barboza, 2022/07/18
- [PULL 25/30] target/ppc: Move slbsync to decodetree, Daniel Henrique Barboza, 2022/07/18