]> git.proxmox.com Git - mirror_qemu.git/commitdiff
accel/tcg: Introduce page_check_range_empty
authorRichard Henderson <richard.henderson@linaro.org>
Fri, 7 Jul 2023 20:40:37 +0000 (21:40 +0100)
committerRichard Henderson <richard.henderson@linaro.org>
Sat, 15 Jul 2023 07:02:32 +0000 (08:02 +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>

accel/tcg/user-exec.c
include/exec/cpu-all.h

index d95b875a6a35bce4e33ec4a2cc1d6f7a02af0062..ab684a3ea20bb30b7fce15701cccbb086338cf33 100644 (file)
@@ -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;
index 472fe9ad9c16bae2dd0579a486e84d6867977b10..94f828b10933dc05f1e5a9cd416639e9a7cf4351 100644 (file)
@@ -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