mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-23 05:34:31 +02:00
Core/Dxe: Fixed memory type in Ring3AllocatePages(), and code alignment.
This commit is contained in:
parent
c23d434619
commit
7720181673
@ -128,7 +128,7 @@ Ring3AllocatePages (
|
|||||||
Status = SysCall (
|
Status = SysCall (
|
||||||
SysCallAllocatePages,
|
SysCallAllocatePages,
|
||||||
Type,
|
Type,
|
||||||
MemoryType,
|
EfiRing3MemoryType,
|
||||||
NumberOfPages,
|
NumberOfPages,
|
||||||
Memory
|
Memory
|
||||||
);
|
);
|
||||||
|
@ -222,40 +222,40 @@ InitializeUserPageTable (
|
|||||||
// Map gRing3Data, gRing3Interfaces, gRing3CallStackBase, DxeRing3
|
// Map gRing3Data, gRing3Interfaces, gRing3CallStackBase, DxeRing3
|
||||||
//
|
//
|
||||||
gCpu->SetUserMemoryAttributes (
|
gCpu->SetUserMemoryAttributes (
|
||||||
gCpu,
|
gCpu,
|
||||||
UserPageTable,
|
UserPageTable,
|
||||||
(UINTN)gRing3Data,
|
(UINTN)gRing3Data,
|
||||||
ALIGN_VALUE (sizeof (RING3_DATA), EFI_PAGE_SIZE),
|
ALIGN_VALUE (sizeof (RING3_DATA), EFI_PAGE_SIZE),
|
||||||
EFI_MEMORY_XP | EFI_MEMORY_USER
|
EFI_MEMORY_XP | EFI_MEMORY_USER
|
||||||
);
|
);
|
||||||
|
|
||||||
gCpu->SetUserMemoryAttributes (
|
gCpu->SetUserMemoryAttributes (
|
||||||
gCpu,
|
gCpu,
|
||||||
UserPageTable,
|
UserPageTable,
|
||||||
(UINTN)gRing3Interfaces,
|
(UINTN)gRing3Interfaces,
|
||||||
EFI_PAGES_TO_SIZE (RING3_INTERFACES_PAGES),
|
EFI_PAGES_TO_SIZE (RING3_INTERFACES_PAGES),
|
||||||
EFI_MEMORY_XP | EFI_MEMORY_USER
|
EFI_MEMORY_XP | EFI_MEMORY_USER
|
||||||
);
|
);
|
||||||
|
|
||||||
gCpu->SetUserMemoryAttributes (
|
gCpu->SetUserMemoryAttributes (
|
||||||
gCpu,
|
gCpu,
|
||||||
UserPageTable,
|
UserPageTable,
|
||||||
(UINTN)gRing3CallStackBase,
|
(UINTN)gRing3CallStackBase,
|
||||||
EFI_SIZE_TO_PAGES (USER_STACK_SIZE) * EFI_PAGE_SIZE,
|
EFI_SIZE_TO_PAGES (USER_STACK_SIZE) * EFI_PAGE_SIZE,
|
||||||
EFI_MEMORY_XP | EFI_MEMORY_USER
|
EFI_MEMORY_XP | EFI_MEMORY_USER
|
||||||
);
|
);
|
||||||
|
|
||||||
SectionAddress = mDxeRing3->StartAddress;
|
SectionAddress = mDxeRing3->StartAddress;
|
||||||
for (Index = 0; Index < mDxeRing3->NumSegments; Index++) {
|
for (Index = 0; Index < mDxeRing3->NumSegments; Index++) {
|
||||||
ImageRecordSegment = &mDxeRing3->Segments[Index];
|
ImageRecordSegment = &mDxeRing3->Segments[Index];
|
||||||
|
|
||||||
gCpu->SetUserMemoryAttributes (
|
gCpu->SetUserMemoryAttributes (
|
||||||
gCpu,
|
gCpu,
|
||||||
UserPageTable,
|
UserPageTable,
|
||||||
SectionAddress,
|
SectionAddress,
|
||||||
ImageRecordSegment->Size,
|
ImageRecordSegment->Size,
|
||||||
ImageRecordSegment->Attributes | EFI_MEMORY_USER
|
ImageRecordSegment->Attributes | EFI_MEMORY_USER
|
||||||
);
|
);
|
||||||
|
|
||||||
SectionAddress += ImageRecordSegment->Size;
|
SectionAddress += ImageRecordSegment->Size;
|
||||||
}
|
}
|
||||||
@ -264,63 +264,63 @@ InitializeUserPageTable (
|
|||||||
// Map CoreBootServices, gCoreSysCallStackBase, ExceptionHandlers, ExceptionStacks
|
// Map CoreBootServices, gCoreSysCallStackBase, ExceptionHandlers, ExceptionStacks
|
||||||
//
|
//
|
||||||
gCpu->SetUserMemoryAttributes (
|
gCpu->SetUserMemoryAttributes (
|
||||||
gCpu,
|
gCpu,
|
||||||
UserPageTable,
|
UserPageTable,
|
||||||
(UINTN)&SysCallBase,
|
(UINTN)&SysCallBase,
|
||||||
(UINTN)&SysCallEnd - (UINTN)&SysCallBase,
|
(UINTN)&SysCallEnd - (UINTN)&SysCallBase,
|
||||||
EFI_MEMORY_RO
|
EFI_MEMORY_RO
|
||||||
);
|
);
|
||||||
|
|
||||||
gCpu->SetUserMemoryAttributes (
|
gCpu->SetUserMemoryAttributes (
|
||||||
gCpu,
|
gCpu,
|
||||||
UserPageTable,
|
UserPageTable,
|
||||||
(UINTN)&gCorePageTable,
|
(UINTN)&gCorePageTable,
|
||||||
SIZE_4KB,
|
SIZE_4KB,
|
||||||
EFI_MEMORY_RO | EFI_MEMORY_XP
|
EFI_MEMORY_RO | EFI_MEMORY_XP
|
||||||
);
|
);
|
||||||
|
|
||||||
gCpu->SetUserMemoryAttributes (
|
gCpu->SetUserMemoryAttributes (
|
||||||
gCpu,
|
gCpu,
|
||||||
UserPageTable,
|
UserPageTable,
|
||||||
(UINTN)gCoreSysCallStackBase,
|
(UINTN)gCoreSysCallStackBase,
|
||||||
EFI_SIZE_TO_PAGES (USER_STACK_SIZE) * EFI_PAGE_SIZE,
|
EFI_SIZE_TO_PAGES (USER_STACK_SIZE) * EFI_PAGE_SIZE,
|
||||||
EFI_MEMORY_XP
|
EFI_MEMORY_XP
|
||||||
);
|
);
|
||||||
|
|
||||||
gCpu->SetUserMemoryAttributes (
|
gCpu->SetUserMemoryAttributes (
|
||||||
gCpu,
|
gCpu,
|
||||||
UserPageTable,
|
UserPageTable,
|
||||||
mExceptionAddresses->ExceptionStackBase,
|
mExceptionAddresses->ExceptionStackBase,
|
||||||
mExceptionAddresses->ExceptionStackSize,
|
mExceptionAddresses->ExceptionStackSize,
|
||||||
EFI_MEMORY_XP
|
EFI_MEMORY_XP
|
||||||
);
|
);
|
||||||
|
|
||||||
gCpu->SetUserMemoryAttributes (
|
gCpu->SetUserMemoryAttributes (
|
||||||
gCpu,
|
gCpu,
|
||||||
UserPageTable,
|
UserPageTable,
|
||||||
mExceptionAddresses->ExceptionHandlerBase,
|
mExceptionAddresses->ExceptionHandlerBase,
|
||||||
mExceptionAddresses->ExceptionHandlerSize,
|
mExceptionAddresses->ExceptionHandlerSize,
|
||||||
EFI_MEMORY_RO
|
EFI_MEMORY_RO
|
||||||
);
|
);
|
||||||
|
|
||||||
gCpu->SetUserMemoryAttributes (
|
gCpu->SetUserMemoryAttributes (
|
||||||
gCpu,
|
gCpu,
|
||||||
UserPageTable,
|
UserPageTable,
|
||||||
mExceptionAddresses->ExceptionDataBase,
|
mExceptionAddresses->ExceptionDataBase,
|
||||||
SIZE_4KB,
|
SIZE_4KB,
|
||||||
EFI_MEMORY_XP
|
EFI_MEMORY_XP
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Necessary fix for ProcessLibraryConstructorList() -> DxeCcProbeLibConstructor()
|
// Necessary fix for ProcessLibraryConstructorList() -> DxeCcProbeLibConstructor()
|
||||||
//
|
//
|
||||||
gCpu->SetUserMemoryAttributes (
|
gCpu->SetUserMemoryAttributes (
|
||||||
gCpu,
|
gCpu,
|
||||||
UserPageTable,
|
UserPageTable,
|
||||||
FixedPcdGet32 (PcdOvmfWorkAreaBase),
|
FixedPcdGet32 (PcdOvmfWorkAreaBase),
|
||||||
FixedPcdGet32 (PcdOvmfWorkAreaSize),
|
FixedPcdGet32 (PcdOvmfWorkAreaSize),
|
||||||
EFI_MEMORY_XP | EFI_MEMORY_USER
|
EFI_MEMORY_XP | EFI_MEMORY_USER
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Map User Image
|
// Map User Image
|
||||||
@ -333,12 +333,12 @@ InitializeUserPageTable (
|
|||||||
ImageRecordSegment = &UserImageRecord->Segments[Index];
|
ImageRecordSegment = &UserImageRecord->Segments[Index];
|
||||||
|
|
||||||
gCpu->SetUserMemoryAttributes (
|
gCpu->SetUserMemoryAttributes (
|
||||||
gCpu,
|
gCpu,
|
||||||
UserPageTable,
|
UserPageTable,
|
||||||
SectionAddress,
|
SectionAddress,
|
||||||
ImageRecordSegment->Size,
|
ImageRecordSegment->Size,
|
||||||
ImageRecordSegment->Attributes | EFI_MEMORY_USER
|
ImageRecordSegment->Attributes | EFI_MEMORY_USER
|
||||||
);
|
);
|
||||||
|
|
||||||
SectionAddress += ImageRecordSegment->Size;
|
SectionAddress += ImageRecordSegment->Size;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user