Commit 15ed71bae29d61e4c32a9fd1f3b0b47f3d5b2e9b
1 parent
a672b469
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
Showing
3 changed files
with
15 additions
and
10 deletions
exec.c
| @@ -231,16 +231,7 @@ static void page_init(void) | @@ -231,16 +231,7 @@ static void page_init(void) | ||
| 231 | { | 231 | { |
| 232 | /* NOTE: we can always suppose that qemu_host_page_size >= | 232 | /* NOTE: we can always suppose that qemu_host_page_size >= |
| 233 | TARGET_PAGE_SIZE */ | 233 | TARGET_PAGE_SIZE */ |
| 234 | -#ifdef _WIN32 | ||
| 235 | - { | ||
| 236 | - SYSTEM_INFO system_info; | ||
| 237 | - | ||
| 238 | - GetSystemInfo(&system_info); | ||
| 239 | - qemu_real_host_page_size = system_info.dwPageSize; | ||
| 240 | - } | ||
| 241 | -#else | ||
| 242 | - qemu_real_host_page_size = getpagesize(); | ||
| 243 | -#endif | 234 | + qemu_real_host_page_size = qemu_getpagesize(); |
| 244 | if (qemu_host_page_size == 0) | 235 | if (qemu_host_page_size == 0) |
| 245 | qemu_host_page_size = qemu_real_host_page_size; | 236 | qemu_host_page_size = qemu_real_host_page_size; |
| 246 | if (qemu_host_page_size < TARGET_PAGE_SIZE) | 237 | if (qemu_host_page_size < TARGET_PAGE_SIZE) |
osdep.c
| @@ -66,6 +66,14 @@ void qemu_vfree(void *ptr) | @@ -66,6 +66,14 @@ void qemu_vfree(void *ptr) | ||
| 66 | VirtualFree(ptr, 0, MEM_RELEASE); | 66 | VirtualFree(ptr, 0, MEM_RELEASE); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | +long qemu_getpagesize(void) | ||
| 70 | +{ | ||
| 71 | + SYSTEM_INFO system_info; | ||
| 72 | + | ||
| 73 | + GetSystemInfo(&system_info); | ||
| 74 | + return system_info.dwPageSize; | ||
| 75 | +} | ||
| 76 | + | ||
| 69 | #else | 77 | #else |
| 70 | 78 | ||
| 71 | #if defined(USE_KQEMU) | 79 | #if defined(USE_KQEMU) |
| @@ -190,6 +198,11 @@ void *qemu_memalign(size_t alignment, size_t size) | @@ -190,6 +198,11 @@ void *qemu_memalign(size_t alignment, size_t size) | ||
| 190 | #endif | 198 | #endif |
| 191 | } | 199 | } |
| 192 | 200 | ||
| 201 | +long qemu_getpagesize(void) | ||
| 202 | +{ | ||
| 203 | + return sysconf(_SC_PAGESIZE); | ||
| 204 | +} | ||
| 205 | + | ||
| 193 | /* alloc shared memory pages */ | 206 | /* alloc shared memory pages */ |
| 194 | void *qemu_vmalloc(size_t size) | 207 | void *qemu_vmalloc(size_t size) |
| 195 | { | 208 | { |
osdep.h
| @@ -72,6 +72,7 @@ | @@ -72,6 +72,7 @@ | ||
| 72 | void *qemu_memalign(size_t alignment, size_t size); | 72 | void *qemu_memalign(size_t alignment, size_t size); |
| 73 | void *qemu_vmalloc(size_t size); | 73 | void *qemu_vmalloc(size_t size); |
| 74 | void qemu_vfree(void *ptr); | 74 | void qemu_vfree(void *ptr); |
| 75 | +long qemu_getpagesize(void); | ||
| 75 | 76 | ||
| 76 | int qemu_create_pidfile(const char *filename); | 77 | int qemu_create_pidfile(const char *filename); |
| 77 | 78 |