[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 39/45] osdep: move qemu_real_host_page_size/mask
From: |
Emilio G. Cota |
Subject: |
[Qemu-devel] [PATCH v2 39/45] osdep: move qemu_real_host_page_size/mask to osdep |
Date: |
Sun, 16 Jul 2017 16:04:22 -0400 |
These only depend on the host and therefore belong in the common
osdep, not in a target-dependent object.
Signed-off-by: Emilio G. Cota <address@hidden>
---
include/exec/cpu-all.h | 2 --
include/qemu/osdep.h | 8 ++++++++
exec.c | 5 +----
util/osdep.c | 9 +++++++++
4 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index ffe43d5..778031c 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -229,8 +229,6 @@ extern int target_page_bits;
/* Using intptr_t ensures that qemu_*_page_mask is sign-extended even
* when intptr_t is 32-bit and we are aligning a long long.
*/
-extern uintptr_t qemu_real_host_page_size;
-extern intptr_t qemu_real_host_page_mask;
extern uintptr_t qemu_host_page_size;
extern intptr_t qemu_host_page_mask;
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 8559634..3cb36e6 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -483,6 +483,14 @@ char *qemu_get_pid_name(pid_t pid);
*/
pid_t qemu_fork(Error **errp);
+void real_host_page_size_init(void);
+
+/* Using intptr_t ensures that qemu_*_page_mask is sign-extended even
+ * when intptr_t is 32-bit and we are aligning a long long.
+ */
+extern uintptr_t qemu_real_host_page_size;
+extern intptr_t qemu_real_host_page_mask;
+
extern int qemu_icache_linesize;
extern int qemu_dcache_linesize;
diff --git a/exec.c b/exec.c
index adc160f..135dcbc 100644
--- a/exec.c
+++ b/exec.c
@@ -120,8 +120,6 @@ int use_icount;
uintptr_t qemu_host_page_size;
intptr_t qemu_host_page_mask;
-uintptr_t qemu_real_host_page_size;
-intptr_t qemu_real_host_page_mask;
bool set_preferred_target_page_bits(int bits)
{
@@ -3608,8 +3606,7 @@ void page_size_init(void)
{
/* NOTE: we can always suppose that qemu_host_page_size >=
TARGET_PAGE_SIZE */
- qemu_real_host_page_size = getpagesize();
- qemu_real_host_page_mask = -(intptr_t)qemu_real_host_page_size;
+ real_host_page_size_init();
if (qemu_host_page_size == 0) {
qemu_host_page_size = qemu_real_host_page_size;
}
diff --git a/util/osdep.c b/util/osdep.c
index a2863c8..90f4f11 100644
--- a/util/osdep.c
+++ b/util/osdep.c
@@ -46,6 +46,9 @@ extern int madvise(caddr_t, size_t, int);
#define QEMU_GETLK F_GETLK
#endif
+uintptr_t qemu_real_host_page_size;
+intptr_t qemu_real_host_page_mask;
+
static bool fips_enabled = false;
static const char *hw_version = QEMU_HW_VERSION;
@@ -65,6 +68,12 @@ int socket_set_nodelay(int fd)
return qemu_setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &v, sizeof(v));
}
+void real_host_page_size_init(void)
+{
+ qemu_real_host_page_size = getpagesize();
+ qemu_real_host_page_mask = -(intptr_t)qemu_real_host_page_size;
+}
+
int qemu_madvise(void *addr, size_t len, int advice)
{
if (advice == QEMU_MADV_INVALID) {
--
2.7.4
- [Qemu-devel] [PATCH v2 09/45] tcg/mips: constify tcg_target_callee_save_regs, (continued)
- [Qemu-devel] [PATCH v2 09/45] tcg/mips: constify tcg_target_callee_save_regs, Emilio G. Cota, 2017/07/16
- [Qemu-devel] [PATCH v2 23/45] translate-all: define and use DEBUG_TB_FLUSH_GATE, Emilio G. Cota, 2017/07/16
- [Qemu-devel] [PATCH v2 22/45] cpu-exec: lookup/generate TB outside exclusive region during step_atomic, Emilio G. Cota, 2017/07/16
- [Qemu-devel] [PATCH v2 33/45] tcg: take .helpers out of TCGContext, Emilio G. Cota, 2017/07/16
- [Qemu-devel] [PATCH v2 26/45] translate-all: define and use DEBUG_TB_CHECK_GATE, Emilio G. Cota, 2017/07/16
- [Qemu-devel] [PATCH v2 18/45] target/m68k: check CF_PARALLEL instead of parallel_cpus, Emilio G. Cota, 2017/07/16
- [Qemu-devel] [PATCH v2 39/45] osdep: move qemu_real_host_page_size/mask to osdep,
Emilio G. Cota <=
- [Qemu-devel] [PATCH v2 37/45] tcg: introduce **tcg_ctxs to keep track of all TCGContext's, Emilio G. Cota, 2017/07/16
- [Qemu-devel] [PATCH v2 40/45] osdep: introduce qemu_mprotect_rwx/none, Emilio G. Cota, 2017/07/16
- [Qemu-devel] [PATCH v2 32/45] tcg: take tb_ctx out of TCGContext, Emilio G. Cota, 2017/07/16
- [Qemu-devel] [PATCH v2 10/45] translate-all: guarantee that tb_hash only holds valid TBs, Emilio G. Cota, 2017/07/16