[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 48/94] target/sparc: Split out resolve_asi
|
From: |
Richard Henderson |
|
Subject: |
[PULL 48/94] target/sparc: Split out resolve_asi |
|
Date: |
Wed, 25 Oct 2023 17:14:56 -0700 |
Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
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 8faf2c59b2..6c1610486e 100644
--- a/target/sparc/translate.c
+++ b/target/sparc/translate.c
@@ -1919,15 +1919,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)
@@ -1970,7 +1980,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. */
@@ -2129,9 +2139,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
- [PULL 50/94] target/sparc: Split out ldst functions with asi pre-computed, (continued)
- [PULL 50/94] target/sparc: Split out ldst functions with asi pre-computed, Richard Henderson, 2023/10/25
- [PULL 27/94] target/sparc: Move WRPSR, SAVED, RESTORED to decodetree, Richard Henderson, 2023/10/25
- [PULL 29/94] target/sparc: Move WRTBR, WRHPR to decodetree, Richard Henderson, 2023/10/25
- [PATCH 25/29] tcg/s390x: Support TCG_COND_TST{EQ,NE}, Richard Henderson, 2023/10/25
- [PATCH 20/29] tcg/sparc64: Support TCG_COND_TST{EQ,NE}, Richard Henderson, 2023/10/25
- [PATCH 27/29] target/alpha: Use TCG_COND_TST{EQ,NE} for BLB{C,S}, Richard Henderson, 2023/10/25
- [PULL 32/94] target/sparc: Remove cpu_hintp, cpu_htba, cpu_hver, cpu_ssr, cpu_ver, Richard Henderson, 2023/10/25
- [PULL 33/94] target/sparc: Move basic arithmetic to decodetree, Richard Henderson, 2023/10/25
- [PULL 40/94] target/sparc: Move TADD, TSUB, MULS to decodetree, Richard Henderson, 2023/10/25
- [PULL 45/94] target/sparc: Move JMPL, RETT, RETURN to decodetree, Richard Henderson, 2023/10/25
- [PULL 48/94] target/sparc: Split out resolve_asi,
Richard Henderson <=
- [PULL 42/94] target/sparc: Move MOVcc, MOVR to decodetree, Richard Henderson, 2023/10/25
- [PULL 49/94] target/sparc: Drop ifdef around get_asi and friends, Richard Henderson, 2023/10/25
- [PULL 54/94] target/sparc: Move LDSTUB, LDSTUBA to decodetree, Richard Henderson, 2023/10/25
- [PULL 56/94] target/sparc: Move CASA, CASXA to decodetree, Richard Henderson, 2023/10/25
- [PULL 51/94] target/sparc: Use tcg_gen_qemu_{ld, st}_i128 for GET_ASI_DTWINX, Richard Henderson, 2023/10/25
- [PULL 57/94] target/sparc: Move PREFETCH, PREFETCHA to decodetree, Richard Henderson, 2023/10/25
- [PULL 61/94] target/sparc: Move LDFSR, STFSR to decodetree, Richard Henderson, 2023/10/25
- [PULL 60/94] target/sparc: Move asi fp load/store to decodetree, Richard Henderson, 2023/10/25
- [PULL 58/94] target/sparc: Split out fp ldst functions with asi precomputed, Richard Henderson, 2023/10/25
- [PULL 52/94] target/sparc: Move simple integer load/store to decodetree, Richard Henderson, 2023/10/25