[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 34/59] accel/tcg: Move user-related declarations out of 'exec/cpu-
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 34/59] accel/tcg: Move user-related declarations out of 'exec/cpu-all.h' (2/4) |
Date: |
Fri, 20 Dec 2024 17:15:25 +0100 |
Move declarations related to page protection under user
emulation from "exec/cpu-all.h" to "user/page-protection.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20241212185341.2857-13-philmd@linaro.org>
---
bsd-user/bsd-mem.h | 1 +
include/exec/cpu-all.h | 55 --------------------------------
include/user/page-protection.h | 57 ++++++++++++++++++++++++++++++++++
target/arm/tcg/mte_helper.c | 4 ++-
4 files changed, 61 insertions(+), 56 deletions(-)
diff --git a/bsd-user/bsd-mem.h b/bsd-user/bsd-mem.h
index eef6b222d9e..f5ec0de24ca 100644
--- a/bsd-user/bsd-mem.h
+++ b/bsd-user/bsd-mem.h
@@ -57,6 +57,7 @@
#include "qemu-bsd.h"
#include "exec/page-protection.h"
+#include "user/page-protection.h"
extern struct bsd_shm_regions bsd_shm_regions[];
extern abi_ulong target_brk;
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 3d97323893b..86cd40020c9 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -130,21 +130,6 @@ extern const TargetPageBits target_page;
int page_get_flags(target_ulong address);
-/**
- * page_set_flags:
- * @start: first byte of range
- * @last: last byte of range
- * @flags: flags to set
- * Context: holding mmap lock
- *
- * Modify the flags of a page and invalidate the code if necessary.
- * The flag PAGE_WRITE_ORG is positioned automatically depending
- * on PAGE_WRITE. The mmap_lock should already be held.
- */
-void page_set_flags(target_ulong start, target_ulong last, int flags);
-
-void page_reset_target_data(target_ulong start, target_ulong last);
-
/**
* page_check_range
* @start: first byte of range
@@ -157,46 +142,6 @@ void page_reset_target_data(target_ulong start,
target_ulong last);
*/
bool page_check_range(target_ulong start, target_ulong last, int flags);
-/**
- * page_check_range_empty:
- * @start: first byte of range
- * @last: last byte of range
- * Context: holding mmap lock
- *
- * Return true if the entire range [@start, @last] is unmapped.
- * The memory lock must be held so that the caller will can ensure
- * the result stays true until a new mapping can be installed.
- */
-bool page_check_range_empty(target_ulong start, target_ulong last);
-
-/**
- * page_find_range_empty
- * @min: first byte of search range
- * @max: last byte of search range
- * @len: size of the hole required
- * @align: alignment of the hole required (power of 2)
- *
- * If there is a range [x, x+@len) within [@min, @max] such that
- * x % @align == 0, then return x. Otherwise return -1.
- * The memory lock must be held, as the caller will want to ensure
- * the returned range stays empty until a new mapping can be installed.
- */
-target_ulong page_find_range_empty(target_ulong min, target_ulong max,
- target_ulong len, target_ulong align);
-
-/**
- * page_get_target_data(address)
- * @address: guest virtual address
- *
- * Return TARGET_PAGE_DATA_SIZE bytes of out-of-band data to associate
- * with the guest page at @address, allocating it if necessary. The
- * caller should already have verified that the address is valid.
- *
- * The memory will be freed when the guest page is deallocated,
- * e.g. with the munmap system call.
- */
-void *page_get_target_data(target_ulong address)
- __attribute__((returns_nonnull));
#endif
CPUArchState *cpu_copy(CPUArchState *env);
diff --git a/include/user/page-protection.h b/include/user/page-protection.h
index ea11cf9e328..d21fab1aaf9 100644
--- a/include/user/page-protection.h
+++ b/include/user/page-protection.h
@@ -18,6 +18,63 @@
void page_protect(tb_page_addr_t page_addr);
int page_unprotect(tb_page_addr_t address, uintptr_t pc);
+
+/**
+ * page_set_flags:
+ * @start: first byte of range
+ * @last: last byte of range
+ * @flags: flags to set
+ * Context: holding mmap lock
+ *
+ * Modify the flags of a page and invalidate the code if necessary.
+ * The flag PAGE_WRITE_ORG is positioned automatically depending
+ * on PAGE_WRITE. The mmap_lock should already be held.
+ */
+void page_set_flags(target_ulong start, target_ulong last, int flags);
+
+void page_reset_target_data(target_ulong start, target_ulong last);
+
+/**
+ * page_check_range_empty:
+ * @start: first byte of range
+ * @last: last byte of range
+ * Context: holding mmap lock
+ *
+ * Return true if the entire range [@start, @last] is unmapped.
+ * The memory lock must be held so that the caller will can ensure
+ * the result stays true until a new mapping can be installed.
+ */
+bool page_check_range_empty(target_ulong start, target_ulong last);
+
+/**
+ * page_find_range_empty
+ * @min: first byte of search range
+ * @max: last byte of search range
+ * @len: size of the hole required
+ * @align: alignment of the hole required (power of 2)
+ *
+ * If there is a range [x, x+@len) within [@min, @max] such that
+ * x % @align == 0, then return x. Otherwise return -1.
+ * The memory lock must be held, as the caller will want to ensure
+ * the returned range stays empty until a new mapping can be installed.
+ */
+target_ulong page_find_range_empty(target_ulong min, target_ulong max,
+ target_ulong len, target_ulong align);
+
+/**
+ * page_get_target_data(address)
+ * @address: guest virtual address
+ *
+ * Return TARGET_PAGE_DATA_SIZE bytes of out-of-band data to associate
+ * with the guest page at @address, allocating it if necessary. The
+ * caller should already have verified that the address is valid.
+ *
+ * The memory will be freed when the guest page is deallocated,
+ * e.g. with the munmap system call.
+ */
+__attribute__((returns_nonnull))
+void *page_get_target_data(target_ulong address);
+
typedef int (*walk_memory_regions_fn)(void *, target_ulong,
target_ulong, unsigned long);
diff --git a/target/arm/tcg/mte_helper.c b/target/arm/tcg/mte_helper.c
index b017b26d07b..7943ae2d608 100644
--- a/target/arm/tcg/mte_helper.c
+++ b/target/arm/tcg/mte_helper.c
@@ -23,7 +23,9 @@
#include "internals.h"
#include "exec/exec-all.h"
#include "exec/page-protection.h"
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_USER_ONLY
+#include "user/page-protection.h"
+#else
#include "exec/ram_addr.h"
#endif
#include "exec/cpu_ldst.h"
--
2.47.1
- [PULL 16/59] exec/cpu-all: Include missing 'exec/cpu-defs.h' header, (continued)
- [PULL 16/59] exec/cpu-all: Include missing 'exec/cpu-defs.h' header, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 19/59] linux-user/aarch64: Include missing 'user/abitypes.h' header, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 17/59] exec/cpu-defs: Remove unnecessary headers, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 21/59] target/arm/cpu: Restrict cpu_untagged_addr() to user emulation, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 18/59] exec/translation-block: Include missing 'exec/vaddr.h' header, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 22/59] target/arm/mte: Restrict 'exec/ram_addr.h' to system emulation, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 25/59] accel/tcg: Declare mmap_[un]lock() in 'exec/page-protection.h', Philippe Mathieu-Daudé, 2024/12/20
- [PULL 26/59] accel/tcg: Use tb_page_addr_t type in page_unprotect(), Philippe Mathieu-Daudé, 2024/12/20
- [PULL 20/59] user: Introduce 'user/guest-host.h' header, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 32/59] accel/tcg: Really restrict cpu_io_recompile() to system emulation, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 34/59] accel/tcg: Move user-related declarations out of 'exec/cpu-all.h' (2/4),
Philippe Mathieu-Daudé <=
- [PULL 29/59] accel/tcg: Move 'exec/translate-all.h' -> 'tb-internal.h', Philippe Mathieu-Daudé, 2024/12/20
- [PULL 30/59] accel/tcg: Un-inline log_pc(), Philippe Mathieu-Daudé, 2024/12/20
- [PULL 38/59] user: Move 'linux-user/cpu_loop-common.h' -> 'user/cpu_loop.h', Philippe Mathieu-Daudé, 2024/12/20
- [PULL 23/59] exec/ram_addr: Include missing 'exec/hwaddr.h' and 'exec/cpu-common.h', Philippe Mathieu-Daudé, 2024/12/20
- [PULL 24/59] include: Include missing 'qemu/clang-tsa.h' header, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 27/59] accel/tcg: Move page_[un]protect() to 'user/page-protection.h', Philippe Mathieu-Daudé, 2024/12/20
- [PULL 28/59] system: Remove unnecessary 'exec/translate-all.h' include, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 31/59] accel/tcg: Move TranslationBlock declarations to 'tb-internal.h', Philippe Mathieu-Daudé, 2024/12/20
- [PULL 33/59] accel/tcg: Move user-related declarations out of 'exec/cpu-all.h' (1/4), Philippe Mathieu-Daudé, 2024/12/20
- [PULL 35/59] accel/tcg: Move user-related declarations out of 'exec/cpu-all.h' (3/4), Philippe Mathieu-Daudé, 2024/12/20