MdeModulePkg/PiSmmCore: AllocatePool should use MemoryType.

PiSmmCore supports page level protection based upon the Memory Type
(EfiRuntimeServicesCode/EfiRuntimeServicesData) and PE image.

However, the Memory Type information is ignored in AllocatePool().
If a caller calls AllocatePool with EfiRuntimeServicesCode,
the final memory is still allocated as EfiRuntimeServicesData.

This patch supports AllocatePool with EfiRuntimeServicesCode.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Jiewen Yao
2016-11-30 23:08:51 +08:00
parent 432f1d83f7
commit 5f4d3e1794
3 changed files with 122 additions and 67 deletions

View File

@@ -1109,8 +1109,9 @@ extern LIST_ENTRY mSmmMemoryMap;
#define MAX_POOL_INDEX (MAX_POOL_SHIFT - MIN_POOL_SHIFT + 1)
typedef struct {
UINTN Size;
BOOLEAN Available;
UINTN Size;
BOOLEAN Available;
EFI_MEMORY_TYPE Type;
} POOL_HEADER;
typedef struct {
@@ -1118,6 +1119,12 @@ typedef struct {
LIST_ENTRY Link;
} FREE_POOL_HEADER;
extern LIST_ENTRY mSmmPoolLists[MAX_POOL_INDEX];
typedef enum {
SmmPoolTypeCode,
SmmPoolTypeData,
SmmPoolTypeMax,
} SMM_POOL_TYPE;
extern LIST_ENTRY mSmmPoolLists[SmmPoolTypeMax][MAX_POOL_INDEX];
#endif