+/**\r
+ Internal function. Frees guarded pool pages.\r
+\r
+ @param PoolType The type of memory for the pool pages\r
+ @param Memory The base address to free\r
+ @param NoPages The number of pages to free\r
+\r
+**/\r
+STATIC\r
+VOID\r
+CoreFreePoolPagesWithGuard (\r
+ IN EFI_MEMORY_TYPE PoolType,\r
+ IN EFI_PHYSICAL_ADDRESS Memory,\r
+ IN UINTN NoPages\r
+ )\r
+{\r
+ EFI_PHYSICAL_ADDRESS MemoryGuarded;\r
+ UINTN NoPagesGuarded;\r
+\r
+ MemoryGuarded = Memory;\r
+ NoPagesGuarded = NoPages;\r
+\r
+ AdjustMemoryF (&Memory, &NoPages);\r
+ //\r
+ // It's safe to unset Guard page inside memory lock because there should\r
+ // be no memory allocation occurred in updating memory page attribute at\r
+ // this point. And unsetting Guard page before free will prevent Guard\r
+ // page just freed back to pool from being allocated right away before\r
+ // marking it usable (from non-present to present).\r
+ //\r
+ UnsetGuardForMemory (MemoryGuarded, NoPagesGuarded);\r
+ if (NoPages > 0) {\r
+ CoreFreePoolPagesI (PoolType, Memory, NoPages);\r
+ }\r
+}\r
+\r