[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 39/85] target/sparc: Split out resolve_asi
|
From: |
Richard Henderson |
|
Subject: |
[PATCH 39/85] target/sparc: Split out resolve_asi |
|
Date: |
Fri, 13 Oct 2023 14:28:00 -0700 |
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/sparc/translate.c | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/target/sparc/translate.c b/target/sparc/translate.c
index e652bdcac2..42a26671f1 100644
--- a/target/sparc/translate.c
+++ b/target/sparc/translate.c
@@ -1815,15 +1815,25 @@ typedef struct {
MemOp memop;
} DisasASI;
-static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop)
+/*
+ * Build DisasASI.
+ * For asi == -1, treat as non-asi.
+ * For ask == -2, treat as immediate offset (v8 error, v9 %asi).
+ */
+static DisasASI resolve_asi(DisasContext *dc, int asi, MemOp memop)
{
- int asi = GET_FIELD(insn, 19, 26);
ASIType type = GET_ASI_HELPER;
int mem_idx = dc->mem_idx;
+ if (asi == -1) {
+ /* Artificial "non-asi" case. */
+ type = GET_ASI_DIRECT;
+ goto done;
+ }
+
#ifndef TARGET_SPARC64
/* Before v9, all asis are immediate and privileged. */
- if (IS_IMM) {
+ if (asi < 0) {
gen_exception(dc, TT_ILL_INSN);
type = GET_ASI_EXCP;
} else if (supervisor(dc)
@@ -1866,7 +1876,7 @@ static DisasASI get_asi(DisasContext *dc, int insn, MemOp
memop)
type = GET_ASI_EXCP;
}
#else
- if (IS_IMM) {
+ if (asi < 0) {
asi = dc->asi;
}
/* With v9, all asis below 0x80 are privileged. */
@@ -2025,9 +2035,16 @@ static DisasASI get_asi(DisasContext *dc, int insn,
MemOp memop)
}
#endif
+ done:
return (DisasASI){ type, asi, mem_idx, memop };
}
+static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop)
+{
+ int asi = IS_IMM ? -2 : GET_FIELD(insn, 19, 26);
+ return resolve_asi(dc, asi, memop);
+}
+
static void gen_ld_asi(DisasContext *dc, TCGv dst, TCGv addr,
int insn, MemOp memop)
{
--
2.34.1
- [PATCH 20/85] target/sparc: Move WRASR to decodetree, (continued)
- [PATCH 20/85] target/sparc: Move WRASR to decodetree, Richard Henderson, 2023/10/13
- [PATCH 25/85] target/sparc: Move ADDC to decodetree, Richard Henderson, 2023/10/13
- [PATCH 24/85] target/sparc: Move basic arithmetic to decodetree, Richard Henderson, 2023/10/13
- [PATCH 27/85] target/sparc: Move UMUL, SMUL to decodetree, Richard Henderson, 2023/10/13
- [PATCH 28/85] target/sparc: Move SUBC to decodetree, Richard Henderson, 2023/10/13
- [PATCH 32/85] target/sparc: Move SLL, SRL, SRA to decodetree, Richard Henderson, 2023/10/13
- [PATCH 33/85] target/sparc: Move MOVcc, MOVR to decodetree, Richard Henderson, 2023/10/13
- [PATCH 37/85] target/sparc: Move FLUSH, SAVE, RESTORE to decodetree, Richard Henderson, 2023/10/13
- [PATCH 36/85] target/sparc: Move JMPL, RETT, RETURN to decodetree, Richard Henderson, 2023/10/13
- [PATCH 38/85] target/sparc: Move DONE, RETRY to decodetree, Richard Henderson, 2023/10/13
- [PATCH 39/85] target/sparc: Split out resolve_asi,
Richard Henderson <=
- [PATCH 42/85] target/sparc: Use tcg_gen_qemu_{ld, st}_i128 for GET_ASI_DTWINX, Richard Henderson, 2023/10/13
- [PATCH 44/85] target/sparc: Move asi integer load/store to decodetree, Richard Henderson, 2023/10/13
- [PATCH 41/85] target/sparc: Split out ldst functions with asi pre-computed, Richard Henderson, 2023/10/13
- [PATCH 40/85] target/sparc: Drop ifdef around get_asi and friends, Richard Henderson, 2023/10/13
- [PATCH 43/85] target/sparc: Move simple integer load/store to decodetree, Richard Henderson, 2023/10/13
- [PATCH 45/85] target/sparc: Move LDSTUB, LDSTUBA to decodetree, Richard Henderson, 2023/10/13
- [PATCH 46/85] target/sparc: Move SWAP, SWAPA to decodetree, Richard Henderson, 2023/10/13
- [PATCH 48/85] target/sparc: Move PREFETCH, PREFETCHA to decodetree, Richard Henderson, 2023/10/13
- [PATCH 51/85] target/sparc: Move asi fp load/store to decodetree, Richard Henderson, 2023/10/13
- [PATCH 50/85] target/sparc: Move simple fp load/store to decodetree, Richard Henderson, 2023/10/13