\r
#include "DxeIpl.h"\r
\r
-#ifndef __GNUC__\r
-#pragma warning( disable : 4305 )\r
-#endif\r
-\r
BOOLEAN gInMemory = FALSE;\r
\r
//\r
--*/\r
{\r
EFI_STATUS Status;\r
- EFI_PHYSICAL_ADDRESS TopOfStack;\r
- EFI_PHYSICAL_ADDRESS BaseOfStack;\r
- EFI_PHYSICAL_ADDRESS BspStore;\r
EFI_GUID DxeCoreFileName;\r
EFI_GUID FirmwareFileName;\r
VOID *Pe32Data;\r
EFI_BOOT_MODE BootMode;\r
EFI_PEI_RECOVERY_MODULE_PPI *PeiRecovery;\r
EFI_PEI_S3_RESUME_PPI *S3Resume;\r
- EFI_PHYSICAL_ADDRESS PageTables;\r
\r
// PERF_START (PeiServices, L"DxeIpl", NULL, 0);\r
- TopOfStack = 0;\r
- BaseOfStack = 0;\r
- BspStore = 0;\r
- PageTables = 0;\r
\r
//\r
// if in S3 Resume, restore configure\r
PeiEfiPeiPeCoffLoader = (EFI_PEI_PE_COFF_LOADER_PROTOCOL *)GetPeCoffLoaderProtocol ();\r
ASSERT (PeiEfiPeiPeCoffLoader != NULL);\r
\r
- //\r
- // Allocate 128KB for the Stack\r
- //\r
- PeiServicesAllocatePages (EfiBootServicesData, EFI_SIZE_TO_PAGES (STACK_SIZE), &BaseOfStack);\r
- ASSERT (BaseOfStack != 0);\r
-\r
- //\r
- // Add architecture-specifc HOBs (including the BspStore HOB)\r
- //\r
- Status = CreateArchSpecificHobs (&BspStore);\r
- ASSERT_EFI_ERROR (Status);\r
\r
//\r
// Find the EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE type compressed Firmware Volume file\r
EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_CORE_PC_HANDOFF_TO_NEXT\r
);\r
\r
- DEBUG ((EFI_D_INFO, "DXE Core Entry\n"));\r
- if (FeaturePcdGet(PcdDxeIplSwitchToLongMode)) {\r
- //\r
- // Compute the top of the stack we were allocated, which is used to load X64 dxe core. \r
- // Pre-allocate a 32 bytes which confroms to x64 calling convention.\r
- //\r
- // The first four parameters to a function are passed in rcx, rdx, r8 and r9. \r
- // Any further parameters are pushed on the stack. Furthermore, space (4 * 8bytes) for the \r
- // register parameters is reserved on the stack, in case the called function \r
- // wants to spill them; this is important if the function is variadic. \r
- //\r
- TopOfStack = BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - 32;\r
-\r
- //\r
- // X64 Calling Conventions requires that the stack must be aligned to 16 bytes\r
- //\r
- TopOfStack = (EFI_PHYSICAL_ADDRESS) (UINTN) ALIGN_POINTER (TopOfStack, 16);\r
- //\r
- // Load the GDT of Go64. Since the GDT of 32-bit Tiano locates in the BS_DATA\r
- // memory, it may be corrupted when copying FV to high-end memory \r
- //\r
- LoadGo64Gdt();\r
- //\r
- // Limit to 36 bits of addressing for debug. Should get it from CPU\r
- //\r
- PageTables = CreateIdentityMappingPageTables (36);\r
- //\r
- // Go to Long Mode. Interrupts will not get turned on until the CPU AP is loaded.\r
- // Call x64 drivers passing in single argument, a pointer to the HOBs.\r
- //\r
- ActivateLongMode (\r
- PageTables, \r
- (EFI_PHYSICAL_ADDRESS)(UINTN)(HobList.Raw), \r
- TopOfStack,\r
- 0x00000000,\r
- DxeCoreEntryPoint\r
- );\r
- } else {\r
- //\r
- // Add HOB for the EFI Decompress Protocol\r
- //\r
- BuildGuidDataHob (\r
- &gEfiDecompressProtocolGuid,\r
- (VOID *)&gEfiDecompress,\r
- sizeof (gEfiDecompress)\r
- );\r
-\r
- //\r
- // Add HOB for the Tiano Decompress Protocol\r
- //\r
- BuildGuidDataHob (\r
- &gEfiTianoDecompressProtocolGuid,\r
- (VOID *)&gTianoDecompress,\r
- sizeof (gTianoDecompress)\r
- );\r
-\r
- //\r
- // Add HOB for the user customized Decompress Protocol\r
- //\r
- BuildGuidDataHob (\r
- &gEfiCustomizedDecompressProtocolGuid,\r
- (VOID *)&gCustomDecompress,\r
- sizeof (gCustomDecompress)\r
- );\r
+ if (FeaturePcdGet (PcdDxeIplBuildShareCodeHobs)) {\r
+ if (FeaturePcdGet (PcdDxeIplSupportEfiDecompress)) {\r
+ //\r
+ // Add HOB for the EFI Decompress Protocol\r
+ //\r
+ BuildGuidDataHob (\r
+ &gEfiDecompressProtocolGuid,\r
+ (VOID *)&gEfiDecompress,\r
+ sizeof (gEfiDecompress)\r
+ );\r
+ }\r
+ if (FeaturePcdGet (PcdDxeIplSupportTianoDecompress)) {\r
+ //\r
+ // Add HOB for the Tiano Decompress Protocol\r
+ //\r
+ BuildGuidDataHob (\r
+ &gEfiTianoDecompressProtocolGuid,\r
+ (VOID *)&gTianoDecompress,\r
+ sizeof (gTianoDecompress)\r
+ );\r
+ }\r
+ if (FeaturePcdGet (PcdDxeIplSupportCustomDecompress)) {\r
+ //\r
+ // Add HOB for the user customized Decompress Protocol\r
+ //\r
+ BuildGuidDataHob (\r
+ &gEfiCustomizedDecompressProtocolGuid,\r
+ (VOID *)&gCustomDecompress,\r
+ sizeof (gCustomDecompress)\r
+ );\r
+ }\r
\r
//\r
// Add HOB for the PE/COFF Loader Protocol\r
(VOID *)&PeiEfiPeiPeCoffLoader,\r
sizeof (VOID *)\r
);\r
- //\r
- // Compute the top of the stack we were allocated. Pre-allocate a UINTN\r
- // for safety.\r
- //\r
- TopOfStack = BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - CPU_STACK_ALIGNMENT;\r
- TopOfStack = (EFI_PHYSICAL_ADDRESS) (UINTN) ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);\r
-\r
- SwitchIplStacks (\r
- (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,\r
- HobList.Raw,\r
- NULL,\r
- (VOID *) (UINTN) TopOfStack,\r
- (VOID *) (UINTN) BspStore\r
- );\r
- } \r
+ }\r
+\r
+ DEBUG ((EFI_D_INFO, "DXE Core Entry\n"));\r
+ HandOffToDxeCore (DxeCoreEntryPoint, HobList);\r
//\r
// If we get here, then the DXE Core returned. This is an error\r
// Dxe Core should not return.\r