mirror of https://github.com/acidanthera/audk.git
Ensure GDT for APs is under 4G, in order to secure that APs can safely use it to switch from real mode to protected mode, as well as from protected mode to long mode.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10290 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
1329da4417
commit
50684330f5
|
@ -1444,6 +1444,8 @@ PrepareAPStartupVector (
|
|||
{
|
||||
MP_ASSEMBLY_ADDRESS_MAP AddressMap;
|
||||
IA32_DESCRIPTOR GdtrForBSP;
|
||||
EFI_PHYSICAL_ADDRESS GdtForAP;
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Get the address map of startup code for AP,
|
||||
|
@ -1481,7 +1483,22 @@ PrepareAPStartupVector (
|
|||
mExchangeInfo->StackSize = AP_STACK_SIZE;
|
||||
|
||||
AsmReadGdtr (&GdtrForBSP);
|
||||
mExchangeInfo->GdtrProfile.Base = GdtrForBSP.Base;
|
||||
|
||||
//
|
||||
// Allocate memory under 4G to hold GDT for APs
|
||||
//
|
||||
GdtForAP = 0xffffffff;
|
||||
Status = gBS->AllocatePages (
|
||||
AllocateMaxAddress,
|
||||
EfiBootServicesData,
|
||||
EFI_SIZE_TO_PAGES (GdtrForBSP.Limit + 1),
|
||||
&GdtForAP
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
CopyMem ((VOID *) (UINTN) GdtForAP, (VOID *) GdtrForBSP.Base, GdtrForBSP.Limit + 1);
|
||||
|
||||
mExchangeInfo->GdtrProfile.Base = (UINTN) GdtForAP;
|
||||
mExchangeInfo->GdtrProfile.Limit = GdtrForBSP.Limit;
|
||||
|
||||
mExchangeInfo->BufferStart = (UINT32) mStartupVector;
|
||||
|
|
Loading…
Reference in New Issue