CpuPageTableLib: define IA32_PAGE_LEVEL enum type internally
The change doesn't change functionality behavior. Signed-off-by: Ray Ni <ray.ni@intel.com> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
This commit is contained in:
parent
927113c83b
commit
e9e2ecab2d
|
@ -20,6 +20,14 @@
|
||||||
|
|
||||||
#define REGION_LENGTH(l) LShiftU64 (1, (l) * 9 + 3)
|
#define REGION_LENGTH(l) LShiftU64 (1, (l) * 9 + 3)
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
Pte = 1,
|
||||||
|
Pde = 2,
|
||||||
|
Pdpte = 3,
|
||||||
|
Pml4 = 4,
|
||||||
|
Pml5 = 5
|
||||||
|
} IA32_PAGE_LEVEL;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT64 Present : 1; // 0 = Not present in memory, 1 = Present in memory
|
UINT64 Present : 1; // 0 = Not present in memory, 1 = Present in memory
|
||||||
UINT64 ReadWrite : 1; // 0 = Read-Only, 1= Read/Write
|
UINT64 ReadWrite : 1; // 0 = Read-Only, 1= Read/Write
|
||||||
|
|
|
@ -245,8 +245,8 @@ PageTableLibMapInLevel (
|
||||||
IN BOOLEAN Modify,
|
IN BOOLEAN Modify,
|
||||||
IN VOID *Buffer,
|
IN VOID *Buffer,
|
||||||
IN OUT INTN *BufferSize,
|
IN OUT INTN *BufferSize,
|
||||||
IN UINTN Level,
|
IN IA32_PAGE_LEVEL Level,
|
||||||
IN UINTN MaxLeafLevel,
|
IN IA32_PAGE_LEVEL MaxLeafLevel,
|
||||||
IN UINT64 LinearAddress,
|
IN UINT64 LinearAddress,
|
||||||
IN UINT64 Length,
|
IN UINT64 Length,
|
||||||
IN UINT64 Offset,
|
IN UINT64 Offset,
|
||||||
|
@ -572,8 +572,8 @@ PageTableMap (
|
||||||
IA32_PAGING_ENTRY TopPagingEntry;
|
IA32_PAGING_ENTRY TopPagingEntry;
|
||||||
INTN RequiredSize;
|
INTN RequiredSize;
|
||||||
UINT64 MaxLinearAddress;
|
UINT64 MaxLinearAddress;
|
||||||
UINTN MaxLevel;
|
IA32_PAGE_LEVEL MaxLevel;
|
||||||
UINTN MaxLeafLevel;
|
IA32_PAGE_LEVEL MaxLeafLevel;
|
||||||
IA32_MAP_ATTRIBUTE ParentAttribute;
|
IA32_MAP_ATTRIBUTE ParentAttribute;
|
||||||
|
|
||||||
if ((PagingMode == Paging32bit) || (PagingMode == PagingPae) || (PagingMode >= PagingModeMax)) {
|
if ((PagingMode == Paging32bit) || (PagingMode == PagingPae) || (PagingMode >= PagingModeMax)) {
|
||||||
|
@ -606,8 +606,8 @@ PageTableMap (
|
||||||
return RETURN_INVALID_PARAMETER;
|
return RETURN_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
MaxLeafLevel = (UINT8)PagingMode;
|
MaxLeafLevel = (IA32_PAGE_LEVEL)(UINT8)PagingMode;
|
||||||
MaxLevel = (UINT8)(PagingMode >> 8);
|
MaxLevel = (IA32_PAGE_LEVEL)(UINT8)(PagingMode >> 8);
|
||||||
MaxLinearAddress = LShiftU64 (1, 12 + MaxLevel * 9);
|
MaxLinearAddress = LShiftU64 (1, 12 + MaxLevel * 9);
|
||||||
|
|
||||||
if ((LinearAddress > MaxLinearAddress) || (Length > MaxLinearAddress - LinearAddress)) {
|
if ((LinearAddress > MaxLinearAddress) || (Length > MaxLinearAddress - LinearAddress)) {
|
||||||
|
|
Loading…
Reference in New Issue