[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 26/47] accel/tcg: Introduce page_check_range_empty
From: |
Richard Henderson |
Subject: |
[PULL 26/47] accel/tcg: Introduce page_check_range_empty |
Date: |
Sat, 15 Jul 2023 14:52:56 +0100 |
Examine the interval tree to validate that a region
has no existing mappings.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230707204054.8792-10-richard.henderson@linaro.org>
---
include/exec/cpu-all.h | 12 ++++++++++++
accel/tcg/user-exec.c | 7 +++++++
2 files changed, 19 insertions(+)
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 472fe9ad9c..94f828b109 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -224,6 +224,18 @@ void page_set_flags(target_ulong start, target_ulong last,
int flags);
void page_reset_target_data(target_ulong start, target_ulong last);
int page_check_range(target_ulong start, target_ulong len, 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_get_target_data(address)
* @address: guest virtual address
diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
index d95b875a6a..ab684a3ea2 100644
--- a/accel/tcg/user-exec.c
+++ b/accel/tcg/user-exec.c
@@ -598,6 +598,13 @@ int page_check_range(target_ulong start, target_ulong len,
int flags)
return ret;
}
+bool page_check_range_empty(target_ulong start, target_ulong last)
+{
+ assert(last >= start);
+ assert_memory_lock();
+ return pageflags_find(start, last) == NULL;
+}
+
void page_protect(tb_page_addr_t address)
{
PageFlagsNode *p;
--
2.34.1
- [PULL 08/47] linux-user: Use abi_ullong not unsigned long long in syscall_defs.h, (continued)
- [PULL 08/47] linux-user: Use abi_ullong not unsigned long long in syscall_defs.h, Richard Henderson, 2023/07/15
- [PULL 18/47] accel/tcg: Split out cpu_exec_longjmp_cleanup, Richard Henderson, 2023/07/15
- [PULL 32/47] linux-user: Rewrite mmap_frag, Richard Henderson, 2023/07/15
- [PULL 23/47] linux-user: Split TARGET_MAP_* out of syscall_defs.h, Richard Henderson, 2023/07/15
- [PULL 33/47] accel/tcg: Introduce page_find_range_empty, Richard Henderson, 2023/07/15
- [PULL 28/47] linux-user: Implement MAP_FIXED_NOREPLACE, Richard Henderson, 2023/07/15
- [PULL 24/47] linux-user: Split TARGET_PROT_* out of syscall_defs.h, Richard Henderson, 2023/07/15
- [PULL 21/47] linux-user: Fix formatting of mmap.c, Richard Henderson, 2023/07/15
- [PULL 38/47] linux-user: Rename mmap_reserve to mmap_reserve_or_unmap, Richard Henderson, 2023/07/15
- [PULL 37/47] linux-user: Rewrite mmap_reserve, Richard Henderson, 2023/07/15
- [PULL 26/47] accel/tcg: Introduce page_check_range_empty,
Richard Henderson <=
- [PULL 42/47] linux-user: Remove can_passthrough_madvise, Richard Henderson, 2023/07/15
- [PULL 43/47] linux-user: Simplify target_madvise, Richard Henderson, 2023/07/15
- [PULL 44/47] linux-user: Drop uint and ulong, Richard Henderson, 2023/07/15
- [PULL 45/47] linux-user/arm: Do not allocate a commpage at all for M-profile CPUs, Richard Henderson, 2023/07/15
- [PULL 47/47] tcg: Use HAVE_CMPXCHG128 instead of CONFIG_CMPXCHG128, Richard Henderson, 2023/07/15
- [PULL 41/47] accel/tcg: Return bool from page_check_range, Richard Henderson, 2023/07/15
- [PULL 46/47] accel/tcg: Always lock pages before translation, Richard Henderson, 2023/07/15
- [PULL 40/47] accel/tcg: Accept more page flags in page_check_range, Richard Henderson, 2023/07/15