aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2008-11-11 21:48:59 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2008-11-11 21:48:59 +0000
commit15ed71bae29d61e4c32a9fd1f3b0b47f3d5b2e9b (patch)
treee085d1453a10fee3d9d339c45d395800478e4846
parenta672b4693a07c0cde34d947ae5032606ce089fd1 (diff)
Define OS-dependent qemu_getpagesize() (Hollis Blanchard)
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5701 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--exec.c11
-rw-r--r--osdep.c13
-rw-r--r--osdep.h1
3 files changed, 15 insertions, 10 deletions
diff --git a/exec.c b/exec.c
index 1edc737da5..6285b3d405 100644
--- a/exec.c
+++ b/exec.c
@@ -231,16 +231,7 @@ static void page_init(void)
{
/* NOTE: we can always suppose that qemu_host_page_size >=
TARGET_PAGE_SIZE */
-#ifdef _WIN32
- {
- SYSTEM_INFO system_info;
-
- GetSystemInfo(&system_info);
- qemu_real_host_page_size = system_info.dwPageSize;
- }
-#else
- qemu_real_host_page_size = getpagesize();
-#endif
+ qemu_real_host_page_size = qemu_getpagesize();
if (qemu_host_page_size == 0)
qemu_host_page_size = qemu_real_host_page_size;
if (qemu_host_page_size < TARGET_PAGE_SIZE)
diff --git a/osdep.c b/osdep.c
index 683aad0f0c..8ff260ab98 100644
--- a/osdep.c
+++ b/osdep.c
@@ -66,6 +66,14 @@ void qemu_vfree(void *ptr)
VirtualFree(ptr, 0, MEM_RELEASE);
}
+long qemu_getpagesize(void)
+{
+ SYSTEM_INFO system_info;
+
+ GetSystemInfo(&system_info);
+ return system_info.dwPageSize;
+}
+
#else
#if defined(USE_KQEMU)
@@ -190,6 +198,11 @@ void *qemu_memalign(size_t alignment, size_t size)
#endif
}
+long qemu_getpagesize(void)
+{
+ return sysconf(_SC_PAGESIZE);
+}
+
/* alloc shared memory pages */
void *qemu_vmalloc(size_t size)
{
diff --git a/osdep.h b/osdep.h
index 87f024b127..e4022ba3c3 100644
--- a/osdep.h
+++ b/osdep.h
@@ -72,6 +72,7 @@
void *qemu_memalign(size_t alignment, size_t size);
void *qemu_vmalloc(size_t size);
void qemu_vfree(void *ptr);
+long qemu_getpagesize(void);
int qemu_create_pidfile(const char *filename);