[NTOSKRNL] Implement ExSizeOfRundownProtectionCacheAware()
authorPierre Schweitzer <pierre@reactos.org>
Sat, 17 Nov 2018 14:03:43 +0000 (15:03 +0100)
committerPierre Schweitzer <pierre@reactos.org>
Sat, 17 Nov 2018 15:44:35 +0000 (16:44 +0100)
ntoskrnl/ex/rundown.c

index 5b35485..ee1dbad 100644 (file)
@@ -606,13 +606,28 @@ ExInitializeRundownProtectionCacheAware(IN PEX_RUNDOWN_REF_CACHE_AWARE RunRefCac
 }
 
 /*
- * @unimplemented NT5.2
+ * @implemented NT5.2
  */
 SIZE_T
 NTAPI
 ExSizeOfRundownProtectionCacheAware(VOID)
 {
-    UNIMPLEMENTED;
-    return 0;
+    SIZE_T Size;
+
+    PAGED_CODE();
+
+    /* Compute the needed size for runrefs */
+    if (KeNumberProcessors <= 1)
+    {
+        Size = sizeof(EX_RUNDOWN_REF);
+    }
+    else
+    {
+        /* We +1, to have enough room for alignment */
+        Size = (KeNumberProcessors + 1) * KeGetRecommendedSharedDataAlignment();
+    }
+
+    /* Return total size (master structure and runrefs) */
+    return Size + sizeof(EX_RUNDOWN_REF_CACHE_AWARE);
 }