Sync to trunk (r44933)
[reactos.git] / reactos / ntoskrnl / ex / sysinfo.c
index b594436..5ef7a90 100644 (file)
@@ -1004,9 +1004,9 @@ QSI_DEF(SystemModuleInformation)
     /* Call the generic handler with the system module list */
     Status = ExpQueryModuleInformation(&PsLoadedModuleList,
                                        &MmLoadedUserImageList,
-                                       (PRTL_PROCESS_MODULES)Buffer,
-                                       Size,
-                                       ReqSize);
+                                     (PRTL_PROCESS_MODULES)Buffer,
+                                     Size,
+                                     ReqSize);
 
     /* Release list lock and return status */
     ExReleaseResourceLite(&PsLoadedModuleResource);
@@ -1113,7 +1113,7 @@ QSI_DEF(SystemHandleInformation)
 
         for (Count = 0; HandleCount > 0 ; HandleCount--)
         {
-            Shi->Handles[i].UniqueProcessId = (USHORT)(ULONG)pr->UniqueProcessId;
+            Shi->Handles[i].UniqueProcessId = (USHORT)(ULONG_PTR)pr->UniqueProcessId;
             Count++;
             i++;
         }
@@ -1238,6 +1238,7 @@ QSI_DEF(SystemPoolTagInformation)
 QSI_DEF(SystemInterruptInformation)
 {
     PKPRCB Prcb;
+    PKPCR Pcr;
     LONG i;
     ULONG ti;
     PSYSTEM_INTERRUPT_INFORMATION sii = (PSYSTEM_INTERRUPT_INFORMATION)Buffer;
@@ -1252,7 +1253,16 @@ QSI_DEF(SystemInterruptInformation)
     for (i = 0; i < KeNumberProcessors; i++)
     {
         Prcb = KiProcessorBlock[i];
-        sii->ContextSwitches = KeGetContextSwitches(Prcb);
+#ifdef _M_AMD64
+        Pcr = CONTAINING_RECORD(Prcb, KPCR, CurrentPrcb);
+#else
+        Pcr = CONTAINING_RECORD(Prcb, KPCR, Prcb);
+#endif
+#ifdef _M_ARM // This code should probably be done differently
+        sii->ContextSwitches = Pcr->ContextSwitches;
+#else
+        sii->ContextSwitches = ((PKIPCR)Pcr)->ContextSwitches;
+#endif
         sii->DpcCount = Prcb->DpcData[0].DpcCount;
         sii->DpcRate = Prcb->DpcRequestRate;
         sii->TimeIncrement = ti;
@@ -1372,11 +1382,11 @@ SSI_DEF(SystemUnloadGdiDriverInformation)
     PVOID SectionPointer = Buffer;
 
     /* Validate size */
-    if (Size != sizeof(PVOID))
+    if(Size != sizeof(PVOID))
     {
         /* Incorrect length, fail */
         return STATUS_INFO_LENGTH_MISMATCH;
-    }
+        }
 
     /* Only kernel mode can call this function */
     if (ExGetPreviousMode() != KernelMode) return STATUS_PRIVILEGE_NOT_HELD;
@@ -1384,7 +1394,7 @@ SSI_DEF(SystemUnloadGdiDriverInformation)
     /* Unload the image */
     MmUnloadSystemImage(SectionPointer);
     return STATUS_SUCCESS;
-}
+    }
 
 /* Class 28 - Time Adjustment Information */
 QSI_DEF(SystemTimeAdjustmentInformation)
@@ -1964,7 +1974,7 @@ NtFlushInstructionCache(IN HANDLE ProcessHandle,
 {
     PAGED_CODE();
 
-#if defined(_M_IX86)
+#if defined(_M_IX86) || defined(_M_AMD64)
     __wbinvd();
 #elif defined(_M_PPC)
     __asm__ __volatile__("tlbsync");