aboutsummaryrefslogtreecommitdiff
path: root/util/oslib-win32.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-06-20 18:01:24 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-06-20 18:01:24 +0100
commit0a99aae5fab5ed260aab96049c274b0334eb4085 (patch)
tree7db67e570b622a37a2139da871b79b0386942e4b /util/oslib-win32.c
parent53001c148340127c2dca1f90329804cd0ac0e236 (diff)
parent705456c0d7f24fbd76733c891525b8eeea332e8b (diff)
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
pc,pci,virtio,hotplug fixes, enhancements numa work by Hu Tao and others memory hotplug by Igor vhost-user by Nikolay, Antonios and others guest virtio announcements by Jason qtest fixes by Sergey qdev hotplug fixes by Paolo misc other fixes mostly by myself Signed-off-by: Michael S. Tsirkin <mst@redhat.com> * remotes/mst/tags/for_upstream: (109 commits) numa: use RAM_ADDR_FMT with ram_addr_t qapi/string-output-visitor: fix bugs tests: simplify code qapi: fix input visitor bugs acpi: rephrase comment qmp: add ACPI_DEVICE_OST event handling qmp: add query-acpi-ospm-status command acpi: implement ospm_status() method for PIIX4/ICH9_LPC devices acpi: introduce TYPE_ACPI_DEVICE_IF interface qmp: add query-memory-devices command numa: handle mmaped memory allocation failure correctly pc: acpi: do not hardcode preprocessor qmp: clean out whitespace qdev: recursively unrealize devices when unrealizing bus qdev: reorganize error reporting in bus_set_realized qapi: fix build on glib < 2.28 qapi: make string output visitor parse int list qapi: make string input visitor parse int list tests: fix memory leak in test of string input visitor hmp: add info memdev ... Conflicts: include/hw/i386/pc.h [PMM: fixed minor conflict in pc.h] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'util/oslib-win32.c')
-rw-r--r--util/oslib-win32.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index 157f10fab2..507cedd84d 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -446,3 +446,22 @@ gint g_poll(GPollFD *fds, guint nfds, gint timeout)
return retval;
}
+
+size_t getpagesize(void)
+{
+ SYSTEM_INFO system_info;
+
+ GetSystemInfo(&system_info);
+ return system_info.dwPageSize;
+}
+
+void os_mem_prealloc(int fd, char *area, size_t memory)
+{
+ int i;
+ size_t pagesize = getpagesize();
+
+ memory = (memory + pagesize - 1) & -pagesize;
+ for (i = 0; i < memory / pagesize; i++) {
+ memset(area + pagesize * i, 0, 1);
+ }
+}