diff options
author | xli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-03-19 09:22:28 +0000 |
---|---|---|
committer | xli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-03-19 09:22:28 +0000 |
commit | 50684330f5dbaeb3d50550e3c18d59b7cc85bcc9 (patch) | |
tree | 88d1ccd36e43bae9db4a9302700cb5195d1551f4 /EdkCompatibilityPkg | |
parent | 1329da4417afbbc54da4a6409f1a230cc2c93154 (diff) | |
download | edk2-platforms-50684330f5dbaeb3d50550e3c18d59b7cc85bcc9.tar.xz |
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
Diffstat (limited to 'EdkCompatibilityPkg')
-rw-r--r-- | EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/MpServicesOnFrameworkMpServicesThunk.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/MpServicesOnFrameworkMpServicesThunk.c b/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/MpServicesOnFrameworkMpServicesThunk.c index 9005670bae..4d0918fa78 100644 --- a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/MpServicesOnFrameworkMpServicesThunk.c +++ b/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/MpServicesOnFrameworkMpServicesThunk.c @@ -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;
|