qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v3 05/16] util/oslib-win32: add qemu_get_host_physmem implementat


From: Alex Bennée
Subject: [PATCH v3 05/16] util/oslib-win32: add qemu_get_host_physmem implementation
Date: Fri, 24 Jul 2020 07:44:58 +0100

Compile tested only.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Stefan Weil <sw@weilnetz.de>

---
v2
  - used more widely available GlobalMemoryStatusEx
  - dropped Phillipe's r-b due to the change
---
 util/oslib-win32.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index 31030463cc9..a74ee5a3aa7 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -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;
 }
-- 
2.20.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]