[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 24/28] util/osdep: Add qemu_mprotect_rw
From: |
Richard Henderson |
Subject: |
[PATCH v3 24/28] util/osdep: Add qemu_mprotect_rw |
Date: |
Sun, 2 May 2021 16:18:40 -0700 |
For --enable-tcg-interpreter on Windows, we will need this.
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
include/qemu/osdep.h | 1 +
util/osdep.c | 9 +++++++++
2 files changed, 10 insertions(+)
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index cb2a07e472..c4a675b9a3 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -512,6 +512,7 @@ void sigaction_invoke(struct sigaction *action,
#endif
int qemu_madvise(void *addr, size_t len, int advice);
+int qemu_mprotect_rw(void *addr, size_t size);
int qemu_mprotect_rwx(void *addr, size_t size);
int qemu_mprotect_none(void *addr, size_t size);
diff --git a/util/osdep.c b/util/osdep.c
index 66d01b9160..42a0a4986a 100644
--- a/util/osdep.c
+++ b/util/osdep.c
@@ -97,6 +97,15 @@ static int qemu_mprotect__osdep(void *addr, size_t size, int
prot)
#endif
}
+int qemu_mprotect_rw(void *addr, size_t size)
+{
+#ifdef _WIN32
+ return qemu_mprotect__osdep(addr, size, PAGE_READWRITE);
+#else
+ return qemu_mprotect__osdep(addr, size, PROT_READ | PROT_WRITE);
+#endif
+}
+
int qemu_mprotect_rwx(void *addr, size_t size)
{
#ifdef _WIN32
--
2.25.1
- [PATCH v3 05/28] tcg: Split out tcg_region_initial_alloc, (continued)
- [PATCH v3 05/28] tcg: Split out tcg_region_initial_alloc, Richard Henderson, 2021/05/02
- [PATCH v3 02/28] meson: Split out fpu/meson.build, Richard Henderson, 2021/05/02
- [PATCH v3 04/28] tcg: Remove error return from tcg_region_initial_alloc__locked, Richard Henderson, 2021/05/02
- [PATCH v3 08/28] accel/tcg: Inline cpu_gen_init, Richard Henderson, 2021/05/02
- [PATCH v3 10/28] accel/tcg: Rename tcg_init to tcg_init_machine, Richard Henderson, 2021/05/02
- [PATCH v3 07/28] tcg: Split out region.c, Richard Henderson, 2021/05/02
- [PATCH v3 15/28] tcg: Move MAX_CODE_GEN_BUFFER_SIZE to tcg-target.h, Richard Henderson, 2021/05/02
- [PATCH v3 11/28] tcg: Create tcg_init, Richard Henderson, 2021/05/02
- [PATCH v3 18/28] tcg: Tidy tcg_n_regions, Richard Henderson, 2021/05/02
- [PATCH v3 16/28] tcg: Replace region.end with region.total_size, Richard Henderson, 2021/05/02
- [PATCH v3 24/28] util/osdep: Add qemu_mprotect_rw,
Richard Henderson <=
- [PATCH v3 17/28] tcg: Rename region.start to region.after_prologue, Richard Henderson, 2021/05/02
- [PATCH v3 22/28] tcg: Return the map protection from alloc_code_gen_buffer, Richard Henderson, 2021/05/02
- [PATCH v3 21/28] tcg: Allocate code_gen_buffer into struct tcg_region_state, Richard Henderson, 2021/05/02
- [PATCH v3 20/28] tcg: Move in_code_gen_buffer and tests to region.c, Richard Henderson, 2021/05/02
- [PATCH v3 23/28] tcg: Sink qemu_madvise call to common code, Richard Henderson, 2021/05/02
- [PATCH v3 27/28] tcg: When allocating for !splitwx, begin with PROT_NONE, Richard Henderson, 2021/05/02
- [PATCH v3 28/28] tcg: Move tcg_init_ctx and tcg_ctx from accel/tcg/, Richard Henderson, 2021/05/02
- [PATCH v3 19/28] tcg: Tidy split_cross_256mb, Richard Henderson, 2021/05/02
- [PATCH v3 26/28] tcg: Merge buffer protection and guard page protection, Richard Henderson, 2021/05/02
- [PATCH v3 09/28] accel/tcg: Move alloc_code_gen_buffer to tcg/region.c, Richard Henderson, 2021/05/02