util/oslib-win32: add qemu_get_host_physmem implementation
authorAlex Bennée <alex.bennee@linaro.org>
Fri, 24 Jul 2020 06:44:58 +0000 (07:44 +0100)
committerAlex Bennée <alex.bennee@linaro.org>
Mon, 27 Jul 2020 08:40:16 +0000 (09:40 +0100)
Compile tested only.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Message-Id: <20200724064509.331-6-alex.bennee@linaro.org>

util/oslib-win32.c

index 31030463cc9aca9c8bf8111de05f7fea1654e9fa..c654dafd937219a693afa41f18fb4b03259425f2 100644 (file)
@@ -831,6 +831,11 @@ char *qemu_get_host_name(Error **errp)
 
 size_t qemu_get_host_physmem(void)
 {
-    /* currently unimplemented */
+    MEMORYSTATUSEX statex;
+    statex.dwLength = sizeof(statex);
+
+    if (GlobalMemoryStatusEx(&statex)) {
+        return statex.ullTotalPhys;
+    }
     return 0;
 }