[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 07/24] accel/tcg: Introduce page_check_range_empty
From: |
Richard Henderson |
Subject: |
[PATCH 07/24] accel/tcg: Introduce page_check_range_empty |
Date: |
Fri, 30 Jun 2023 15:21:42 +0200 |
Examine the interval tree to validate that a region
has no existing mappings.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
include/exec/cpu-all.h | 11 +++++++++++
accel/tcg/user-exec.c | 7 +++++++
2 files changed, 18 insertions(+)
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 8018ce783e..5b2c230d52 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -224,6 +224,17 @@ 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
+ *
+ * Return true if the entire range [@start, @last] is unmapped.
+ * The memory lock must be held, as the caller will want to 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 8fbcbf9771..25c605dc1b 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
- [PATCH for-8.1? 00/24] linux-user: mmap range fixes, Richard Henderson, 2023/06/30
- [PATCH 01/24] linux-user: Use assert in mmap_fork_start, Richard Henderson, 2023/06/30
- [PATCH 02/24] linux-user: Fix formatting of mmap.c, Richard Henderson, 2023/06/30
- [PATCH 06/24] linux-user: Populate more bits in mmap_flags_tbl, Richard Henderson, 2023/06/30
- [PATCH 04/24] linux-user: Split TARGET_MAP_* out of syscall_defs.h, Richard Henderson, 2023/06/30
- [PATCH 07/24] accel/tcg: Introduce page_check_range_empty,
Richard Henderson <=
- [PATCH 03/24] linux-user/strace: Expand struct flags to hold a mask, Richard Henderson, 2023/06/30
- [PATCH 05/24] linux-user: Split TARGET_PROT_* out of syscall_defs.h, Richard Henderson, 2023/06/30
- [PATCH 08/24] bsd-user: Use page_check_range_empty for MAP_EXCL, Richard Henderson, 2023/06/30
- [PATCH 11/24] linux-user: Widen target_mmap offset argument to off_t, Richard Henderson, 2023/06/30
- [PATCH 12/24] linux-user: Rewrite target_mprotect, Richard Henderson, 2023/06/30
- [PATCH 09/24] linux-user: Implement MAP_FIXED_NOREPLACE, Richard Henderson, 2023/06/30
- [PATCH 10/24] linux-user: Split out target_to_host_prot, Richard Henderson, 2023/06/30
- [PATCH 14/24] accel/tcg: Introduce page_find_range_empty, Richard Henderson, 2023/06/30