+STATIC\r
+VOID *\r
+CoreAllocatePoolPagesI (\r
+ IN EFI_MEMORY_TYPE PoolType,\r
+ IN UINTN NoPages,\r
+ IN UINTN Granularity\r
+ )\r
+{\r
+ VOID *Buffer;\r
+ EFI_STATUS Status;\r
+\r
+ Status = CoreAcquireLockOrFail (&gMemoryLock);\r
+ if (EFI_ERROR (Status)) {\r
+ return NULL;\r
+ }\r
+\r
+ Buffer = CoreAllocatePoolPages (PoolType, NoPages, Granularity);\r
+ CoreReleaseMemoryLock ();\r
+\r
+ if (Buffer != NULL) {\r
+ ApplyMemoryProtectionPolicy (EfiConventionalMemory, PoolType,\r
+ (EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, EFI_PAGES_TO_SIZE (NoPages));\r
+ }\r
+ return Buffer;\r
+}\r
+\r