aboutsummaryrefslogtreecommitdiff
path: root/include/exec/cpu-defs.h
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2019-03-22 22:03:39 -0700
committerRichard Henderson <richard.henderson@linaro.org>2019-06-10 07:03:42 -0700
commit269bd5d8f61c6b0825ed3c6a5fe01a3ad71c3b4a (patch)
treeb51b8c1ca4eadac1eee562a5e1671b778e022250 /include/exec/cpu-defs.h
parent5e1401969b25f676fee6b1c564441759cf967a43 (diff)
cpu: Move the softmmu tlb to CPUNegativeOffsetState
We have for some time had code within the tcg backends to handle large positive offsets from env. This move makes sure that need not happen. Indeed, we are able to assert at build time that simple offsets suffice for all hosts. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'include/exec/cpu-defs.h')
-rw-r--r--include/exec/cpu-defs.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h
index c067994e5c..006f8db9cf 100644
--- a/include/exec/cpu-defs.h
+++ b/include/exec/cpu-defs.h
@@ -178,13 +178,14 @@ typedef struct CPUTLBDesc {
/*
* Data elements that are per MMU mode, accessed by the fast path.
+ * The structure is aligned to aid loading the pair with one insn.
*/
typedef struct CPUTLBDescFast {
/* Contains (n_entries - 1) << CPU_TLB_ENTRY_BITS */
uintptr_t mask;
/* The array of tlb entries itself. */
CPUTLBEntry *table;
-} CPUTLBDescFast;
+} CPUTLBDescFast QEMU_ALIGNED(2 * sizeof(void *));
/*
* Data elements that are shared between all MMU modes.
@@ -211,28 +212,33 @@ typedef struct CPUTLBCommon {
/*
* The entire softmmu tlb, for all MMU modes.
* The meaning of each of the MMU modes is defined in the target code.
+ * Since this is placed within CPUNegativeOffsetState, the smallest
+ * negative offsets are at the end of the struct.
*/
typedef struct CPUTLB {
- CPUTLBDescFast f[NB_MMU_MODES];
- CPUTLBDesc d[NB_MMU_MODES];
CPUTLBCommon c;
+ CPUTLBDesc d[NB_MMU_MODES];
+ CPUTLBDescFast f[NB_MMU_MODES];
} CPUTLB;
-/* There are target-specific members named "tlb". This is temporary. */
-#define CPU_COMMON CPUTLB tlb_;
-#define env_tlb(ENV) (&(ENV)->tlb_)
+/* This will be used by TCG backends to compute offsets. */
+#define TLB_MASK_TABLE_OFS(IDX) \
+ ((int)offsetof(ArchCPU, neg.tlb.f[IDX]) - (int)offsetof(ArchCPU, env))
#else
-#define CPU_COMMON /* Nothing */
+typedef struct CPUTLB { } CPUTLB;
#endif /* !CONFIG_USER_ONLY && CONFIG_TCG */
+#define CPU_COMMON /* Nothing */
+
/*
* This structure must be placed in ArchCPU immedately
* before CPUArchState, as a field named "neg".
*/
typedef struct CPUNegativeOffsetState {
+ CPUTLB tlb;
IcountDecr icount_decr;
} CPUNegativeOffsetState;