Commit d0832cdf authored by Michael Müller's avatar Michael Müller Committed by Alexandre Julliard

ntdll: Use sysinfo to report correct number of physical pages.

parent a8044beb
...@@ -6809,6 +6809,7 @@ for ac_header in \ ...@@ -6809,6 +6809,7 @@ for ac_header in \
sys/statvfs.h \ sys/statvfs.h \
sys/strtio.h \ sys/strtio.h \
sys/syscall.h \ sys/syscall.h \
sys/sysinfo.h \
sys/tihdr.h \ sys/tihdr.h \
sys/time.h \ sys/time.h \
sys/timeout.h \ sys/timeout.h \
......
...@@ -494,6 +494,7 @@ AC_CHECK_HEADERS(\ ...@@ -494,6 +494,7 @@ AC_CHECK_HEADERS(\
sys/statvfs.h \ sys/statvfs.h \
sys/strtio.h \ sys/strtio.h \
sys/syscall.h \ sys/syscall.h \
sys/sysinfo.h \
sys/tihdr.h \ sys/tihdr.h \
sys/time.h \ sys/time.h \
sys/timeout.h \ sys/timeout.h \
......
...@@ -38,6 +38,9 @@ ...@@ -38,6 +38,9 @@
#ifdef HAVE_SYS_MMAN_H #ifdef HAVE_SYS_MMAN_H
# include <sys/mman.h> # include <sys/mman.h>
#endif #endif
#ifdef HAVE_SYS_SYSINFO_H
# include <sys/sysinfo.h>
#endif
#ifdef HAVE_VALGRIND_VALGRIND_H #ifdef HAVE_VALGRIND_VALGRIND_H
# include <valgrind/valgrind.h> # include <valgrind/valgrind.h>
#endif #endif
...@@ -1356,11 +1359,22 @@ void virtual_init_threading(void) ...@@ -1356,11 +1359,22 @@ void virtual_init_threading(void)
*/ */
void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info ) void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info )
{ {
#ifdef HAVE_SYS_SYSINFO_H
struct sysinfo sinfo;
#endif
info->unknown = 0; info->unknown = 0;
info->KeMaximumIncrement = 0; /* FIXME */ info->KeMaximumIncrement = 0; /* FIXME */
info->PageSize = page_size; info->PageSize = page_size;
info->MmLowestPhysicalPage = 1; info->MmLowestPhysicalPage = 1;
info->MmHighestPhysicalPage = 0x7fffffff / page_size; 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->MmNumberOfPhysicalPages = info->MmHighestPhysicalPage - info->MmLowestPhysicalPage;
info->AllocationGranularity = get_mask(0) + 1; info->AllocationGranularity = get_mask(0) + 1;
info->LowestUserAddress = (void *)0x10000; info->LowestUserAddress = (void *)0x10000;
......
...@@ -1119,6 +1119,9 @@ ...@@ -1119,6 +1119,9 @@
/* Define to 1 if you have the <sys/sysctl.h> header file. */ /* Define to 1 if you have the <sys/sysctl.h> header file. */
#undef HAVE_SYS_SYSCTL_H #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. */ /* Define to 1 if you have the <sys/thr.h> header file. */
#undef HAVE_SYS_THR_H #undef HAVE_SYS_THR_H
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment