Author: pschweitzer
Date: Wed Jun 17 17:28:19 2015
New Revision: 68171
URL:
http://svn.reactos.org/svn/reactos?rev=68171&view=rev
Log:
[NTOSKRNL]
Completely implement Complete NtQuerySystemInformation - SystemNumaProcessorMap
CORE-9680
Modified:
trunk/reactos/ntoskrnl/ex/sysinfo.c
Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/sysinfo.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/sysinfo.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/sysinfo.c [iso-8859-1] Wed Jun 17 17:28:19 2015
@@ -2168,31 +2168,47 @@
/* Class 55 - NUMA processor information */
QSI_DEF(SystemNumaProcessorMap)
{
+ ULONG MaxEntries, Node;
PSYSTEM_NUMA_INFORMATION NumaInformation = (PSYSTEM_NUMA_INFORMATION)Buffer;
+ /* Validate input size */
if (Size < sizeof(ULONG))
{
return STATUS_INFO_LENGTH_MISMATCH;
}
-#if 1 // Partial & incomplete implementation just to let GetNumaHighestNodeNumber()
work
- /* In case of a partial query, just return number of nodes and stop here */
- if (Size < sizeof(SYSTEM_NUMA_INFORMATION))
- {
- NumaInformation->HighestNodeNumber = KeNumberNodes - 1;
+ /* Return highest node */
+ NumaInformation->HighestNodeNumber = KeNumberNodes - 1;
+
+ /* Compute how much entries we will be able to put in output structure */
+ MaxEntries = (Size - FIELD_OFFSET(SYSTEM_NUMA_INFORMATION,
ActiveProcessorsAffinityMask)) / sizeof(ULONGLONG);
+ /* Make sure we don't overflow KeNodeBlock */
+ if (MaxEntries > KeNumberNodes)
+ {
+ MaxEntries = KeNumberNodes;
+ }
+
+ /* If we have entries to write, and room for it */
+ if (Size >= FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, ActiveProcessorsAffinityMask)
&&
+ MaxEntries != 0)
+ {
+ /* Already set size we return */
+ *ReqSize = FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, ActiveProcessorsAffinityMask) +
+ MaxEntries * sizeof(ULONGLONG);
+
+ /* For each node, return processor mask */
+ for (Node = 0; Node < MaxEntries; ++Node)
+ {
+ NumaInformation->ActiveProcessorsAffinityMask[Node] =
KeNodeBlock[Node]->ProcessorMask;
+ }
+ }
+ else
+ {
+ /* We only returned highest node number */
*ReqSize = sizeof(ULONG);
- return STATUS_SUCCESS;
- }
- else
- {
- DPRINT1("NtQuerySystemInformation - SystemNumaProcessorMap not
implemented\n");
- return STATUS_NOT_IMPLEMENTED;
- }
-#else
- /* FIXME */
- DPRINT1("NtQuerySystemInformation - SystemNumaProcessorMap not
implemented\n");
- return STATUS_NOT_IMPLEMENTED;
-#endif
+ }
+
+ return STATUS_SUCCESS;
}