[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/9] include/hw: introduce CPU_MAX_NEGATIVE_ENV_OFFSET
From: |
Anton Johansson |
Subject: |
[PATCH 4/9] include/hw: introduce CPU_MAX_NEGATIVE_ENV_OFFSET |
Date: |
Fri, 30 Jun 2023 14:25:46 +0200 |
For reasons related to code-generation quality, the offset of
CPUTLBDescFast and IcountDecr from CPUArchState needs to fit within
11 bits of displacement (arm[32|64] and riscv addressing modes).
This commit introduces a new constant to store the maximum allowed
negative offset, so it can be statically asserted to hold later on.
Signed-off-by: Anton Johansson <anjo@rev.ng>
---
include/hw/core/cpu.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index c226d7263c..0377f74d48 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -259,6 +259,17 @@ struct qemu_work_item;
#define CPU_UNSET_NUMA_NODE_ID -1
+/*
+ * For reasons related to code-generation quality the fast path
+ * CPUTLBDescFast array and IcountDecr fields need to be located within a
+ * small negative offset of CPUArchState. This requirement comes from
+ * host-specific addressing modes of arm[32|64] and riscv which uses 12-
+ * and 11 bits of displacement respectively.
+ */
+#define CPU_MIN_DISPLACEMENT_BITS 11
+#define CPU_MAX_NEGATIVE_ENV_OFFSET \
+ (-(1 << CPU_MIN_DISPLACEMENT_BITS))
+
/**
* CPUState:
* @cpu_index: CPU index (informative).
--
2.41.0
- [PATCH 0/9] Collapse CPUNegativeOffsetState into CPUState, Anton Johansson, 2023/06/30
- [PATCH 6/9] Move IcountDecr to CPUState and assert offset, Anton Johansson, 2023/06/30
- [PATCH 1/9] target/arm: Replace TARGET_PAGE_ENTRY_EXTRA, Anton Johansson, 2023/06/30
- [PATCH 2/9] include: Move MMUAccessType to tlb-common.h, Anton Johansson, 2023/06/30
- [PATCH 7/9] include/exec: Remove [cpu|env]_neg() functions, Anton Johansson, 2023/06/30
- [PATCH 3/9] include/exec: Move CPUTLB and friends to tlb-common.h, Anton Johansson, 2023/06/30
- [PATCH 4/9] include/hw: introduce CPU_MAX_NEGATIVE_ENV_OFFSET,
Anton Johansson <=
- [PATCH 9/9] include/exec: Remove CPUNegativeOffsetState, Anton Johansson, 2023/06/30
- [PATCH 8/9] target: Remove CPUNegativeOffsetState field from ArchCPU, Anton Johansson, 2023/06/30
- [PATCH 5/9] accel: Move CPUTLB to CPUState and assert offset, Anton Johansson, 2023/06/30