[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 16/24] exec: Move GUEST_ADDR_MAX definition to 'cpu_ldst.h'
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 16/24] exec: Move GUEST_ADDR_MAX definition to 'cpu_ldst.h' |
Date: |
Thu, 18 Apr 2024 21:25:15 +0200 |
GUEST_ADDR_MAX is only used in accel/tcg/user-exec.c
and "exec/cpu_ldst.h". Move it from "exec/cpu-all.h"
to "exec/cpu_ldst.h" so we can avoid including
"exec/cpu-all.h" in accel/tcg/user-exec.c.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/exec/cpu-all.h | 34 +---------------------------------
include/exec/cpu_ldst.h | 30 ++++++++++++++++++++++++++++++
accel/tcg/cpu-exec.c | 1 -
3 files changed, 31 insertions(+), 34 deletions(-)
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index e75ec13cd0..554b937ddb 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -63,39 +63,7 @@
/* MMU memory access macros */
-#if defined(CONFIG_USER_ONLY)
-#include "exec/user/abitypes.h"
-
-/*
- * If non-zero, the guest virtual address space is a contiguous subset
- * of the host virtual address space, i.e. '-R reserved_va' is in effect
- * either from the command-line or by default. The value is the last
- * byte of the guest address space e.g. UINT32_MAX.
- *
- * If zero, the host and guest virtual address spaces are intermingled.
- */
-extern unsigned long reserved_va;
-
-/*
- * Limit the guest addresses as best we can.
- *
- * When not using -R reserved_va, we cannot really limit the guest
- * to less address space than the host. For 32-bit guests, this
- * acts as a sanity check that we're not giving the guest an address
- * that it cannot even represent. For 64-bit guests... the address
- * might not be what the real kernel would give, but it is at least
- * representable in the guest.
- *
- * TODO: Improve address allocation to avoid this problem, and to
- * avoid setting bits at the top of guest addresses that might need
- * to be used for tags.
- */
-#define GUEST_ADDR_MAX_ \
- ((MIN_CONST(TARGET_VIRT_ADDR_SPACE_BITS, TARGET_ABI_BITS) <= 32) ? \
- UINT32_MAX : ~0ul)
-#define GUEST_ADDR_MAX (reserved_va ? : GUEST_ADDR_MAX_)
-
-#else
+#if !defined(CONFIG_USER_ONLY)
#include "exec/hwaddr.h"
diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h
index 6d47d3114a..07649a01c1 100644
--- a/include/exec/cpu_ldst.h
+++ b/include/exec/cpu_ldst.h
@@ -73,8 +73,38 @@
#if defined(CONFIG_USER_ONLY)
+#include "user/abitypes.h"
#include "user/guest-base.h"
+/*
+ * If non-zero, the guest virtual address space is a contiguous subset
+ * of the host virtual address space, i.e. '-R reserved_va' is in effect
+ * either from the command-line or by default. The value is the last
+ * byte of the guest address space e.g. UINT32_MAX.
+ *
+ * If zero, the host and guest virtual address spaces are intermingled.
+ */
+extern unsigned long reserved_va;
+
+/*
+ * Limit the guest addresses as best we can.
+ *
+ * When not using -R reserved_va, we cannot really limit the guest
+ * to less address space than the host. For 32-bit guests, this
+ * acts as a sanity check that we're not giving the guest an address
+ * that it cannot even represent. For 64-bit guests... the address
+ * might not be what the real kernel would give, but it is at least
+ * representable in the guest.
+ *
+ * TODO: Improve address allocation to avoid this problem, and to
+ * avoid setting bits at the top of guest addresses that might need
+ * to be used for tags.
+ */
+#define GUEST_ADDR_MAX_ \
+ ((MIN_CONST(TARGET_VIRT_ADDR_SPACE_BITS, TARGET_ABI_BITS) <= 32) ? \
+ UINT32_MAX : ~0ul)
+#define GUEST_ADDR_MAX (reserved_va ? : GUEST_ADDR_MAX_)
+
#ifndef TARGET_TAGGED_ADDRESSES
static inline abi_ptr cpu_untagged_addr(CPUState *cs, abi_ptr x)
{
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 225e5fbd3e..7bfd558027 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -31,7 +31,6 @@
#include "exec/log.h"
#include "qemu/main-loop.h"
#include "sysemu/cpus.h"
-#include "exec/cpu-all.h"
#include "sysemu/cpu-timers.h"
#include "exec/replay-core.h"
#include "sysemu/tcg.h"
--
2.41.0
- [PATCH 15/24] exec: Restrict inclusion of 'user/guest-base.h', (continued)
- [PATCH 15/24] exec: Restrict inclusion of 'user/guest-base.h', Philippe Mathieu-Daudé, 2024/04/18
- [PATCH 19/24] gdbstub: Avoid including 'cpu.h' in 'gdbstub/helpers.h', Philippe Mathieu-Daudé, 2024/04/18
- [PATCH 21/24] plugins: Un-inline qemu_plugin_disable_mem_helpers(), Philippe Mathieu-Daudé, 2024/04/18
- [PATCH 23/24] exec: Remove 'disas/disas.h' from 'exec/log.h', Philippe Mathieu-Daudé, 2024/04/18
- [PATCH 13/24] target/sparc: Replace abi_ulong by uint32_t for TARGET_ABI32, Philippe Mathieu-Daudé, 2024/04/18
- [PATCH 16/24] exec: Move GUEST_ADDR_MAX definition to 'cpu_ldst.h',
Philippe Mathieu-Daudé <=
- [PATCH 18/24] plugins: Include missing 'qemu/bitmap.h' header, Philippe Mathieu-Daudé, 2024/04/18
- [PATCH 22/24] exec: Remove 'exec/tswap.h' from 'exec/cpu-all.h', Philippe Mathieu-Daudé, 2024/04/18
- [PATCH 24/24] exec: Remove unnecessary inclusions of 'hw/core/cpu.h', Philippe Mathieu-Daudé, 2024/04/18
- [PATCH 20/24] hw/xtensa: Include missing 'exec/cpu-common.h' in 'bootparam.h', Philippe Mathieu-Daudé, 2024/04/18