=?UTF-8?Q?Michael=20M=C3=BCller=20?=: ntdll: Use sysinfo to report correct number of physical pages.
Alexandre Julliard
julliard at winehq.org
Thu Jul 14 08:58:05 CDT 2016
Module: wine
Branch: master
Commit: d0832cdf428696e2c08b1aa27382baad4d1e376f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d0832cdf428696e2c08b1aa27382baad4d1e376f
Author: Michael Müller <michael at fds-team.de>
Date: Fri Jul 8 05:40:22 2016 +0200
ntdll: Use sysinfo to report correct number of physical pages.
Signed-off-by: Michael Müller <michael at fds-team.de>
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
configure | 1 +
configure.ac | 1 +
dlls/ntdll/virtual.c | 14 ++++++++++++++
include/config.h.in | 3 +++
4 files changed, 19 insertions(+)
diff --git a/configure b/configure
index 944ff6b..ce49aed 100755
--- a/configure
+++ b/configure
@@ -6809,6 +6809,7 @@ for ac_header in \
sys/statvfs.h \
sys/strtio.h \
sys/syscall.h \
+ sys/sysinfo.h \
sys/tihdr.h \
sys/time.h \
sys/timeout.h \
diff --git a/configure.ac b/configure.ac
index 6e960a1..019d549 100644
--- a/configure.ac
+++ b/configure.ac
@@ -494,6 +494,7 @@ AC_CHECK_HEADERS(\
sys/statvfs.h \
sys/strtio.h \
sys/syscall.h \
+ sys/sysinfo.h \
sys/tihdr.h \
sys/time.h \
sys/timeout.h \
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 5c43d26..2e63b78 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -38,6 +38,9 @@
#ifdef HAVE_SYS_MMAN_H
# include <sys/mman.h>
#endif
+#ifdef HAVE_SYS_SYSINFO_H
+# include <sys/sysinfo.h>
+#endif
#ifdef HAVE_VALGRIND_VALGRIND_H
# include <valgrind/valgrind.h>
#endif
@@ -1356,11 +1359,22 @@ void virtual_init_threading(void)
*/
void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info )
{
+#ifdef HAVE_SYS_SYSINFO_H
+ struct sysinfo sinfo;
+#endif
+
info->unknown = 0;
info->KeMaximumIncrement = 0; /* FIXME */
info->PageSize = page_size;
info->MmLowestPhysicalPage = 1;
info->MmHighestPhysicalPage = 0x7fffffff / page_size;
+#ifdef HAVE_SYS_SYSINFO_H
+ if (!sysinfo(&sinfo))
+ {
+ ULONG64 total = (ULONG64)sinfo.totalram * sinfo.mem_unit;
+ info->MmHighestPhysicalPage = max(1, total / page_size);
+ }
+#endif
info->MmNumberOfPhysicalPages = info->MmHighestPhysicalPage - info->MmLowestPhysicalPage;
info->AllocationGranularity = get_mask(0) + 1;
info->LowestUserAddress = (void *)0x10000;
diff --git a/include/config.h.in b/include/config.h.in
index a4a4bb4..64f56fd 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -1119,6 +1119,9 @@
/* Define to 1 if you have the <sys/sysctl.h> header file. */
#undef HAVE_SYS_SYSCTL_H
+/* Define to 1 if you have the <sys/sysinfo.h> header file. */
+#undef HAVE_SYS_SYSINFO_H
+
/* Define to 1 if you have the <sys/thr.h> header file. */
#undef HAVE_SYS_THR_H
More information about the wine-cvs
mailing list