diff options
author | Wei Yang <richardw.yang@linux.intel.com> | 2019-10-13 10:11:45 +0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2019-10-26 15:38:06 +0200 |
commit | 038adc2f5850e32019bda06c559d0301be436eae (patch) | |
tree | 9eea94c77ab858c6f288121ef1a42796d0b25b9d /util/mmap-alloc.c | |
parent | 5608956575088554f7612b716916efafae46187c (diff) | |
download | qemu-038adc2f5850e32019bda06c559d0301be436eae.zip qemu-038adc2f5850e32019bda06c559d0301be436eae.tar.gz qemu-038adc2f5850e32019bda06c559d0301be436eae.tar.bz2 |
core: replace getpagesize() with qemu_real_host_page_size
There are three page size in qemu:
real host page size
host page size
target page size
All of them have dedicate variable to represent. For the last two, we
use the same form in the whole qemu project, while for the first one we
use two forms: qemu_real_host_page_size and getpagesize().
qemu_real_host_page_size is defined to be a replacement of
getpagesize(), so let it serve the role.
[Note] Not fully tested for some arch or device.
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20191013021145.16011-3-richardw.yang@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'util/mmap-alloc.c')
-rw-r--r-- | util/mmap-alloc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c index f7f177d..27dcccd 100644 --- a/util/mmap-alloc.c +++ b/util/mmap-alloc.c @@ -48,7 +48,7 @@ size_t qemu_fd_getpagesize(int fd) #endif #endif - return getpagesize(); + return qemu_real_host_page_size; } size_t qemu_mempath_getpagesize(const char *mem_path) @@ -79,7 +79,7 @@ size_t qemu_mempath_getpagesize(const char *mem_path) #endif #endif - return getpagesize(); + return qemu_real_host_page_size; } void *qemu_ram_mmap(int fd, @@ -114,7 +114,7 @@ void *qemu_ram_mmap(int fd, */ flags = MAP_PRIVATE; pagesize = qemu_fd_getpagesize(fd); - if (fd == -1 || pagesize == getpagesize()) { + if (fd == -1 || pagesize == qemu_real_host_page_size) { guardfd = -1; flags |= MAP_ANONYMOUS; } else { @@ -123,7 +123,7 @@ void *qemu_ram_mmap(int fd, } #else guardfd = -1; - pagesize = getpagesize(); + pagesize = qemu_real_host_page_size; flags = MAP_PRIVATE | MAP_ANONYMOUS; #endif @@ -205,7 +205,7 @@ void qemu_ram_munmap(int fd, void *ptr, size_t size) #if defined(__powerpc64__) && defined(__linux__) pagesize = qemu_fd_getpagesize(fd); #else - pagesize = getpagesize(); + pagesize = qemu_real_host_page_size; #endif munmap(ptr, size + pagesize); } |