1 /** @file 2 EBC-specific functionality for DxeLoad. 3 4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> 5 SPDX-License-Identifier: BSD-2-Clause-Patent 6 7 **/ 8 9 #include "DxeIpl.h" 10 11 12 13 /** 14 Transfers control to DxeCore. 15 16 This function performs a CPU architecture specific operations to execute 17 the entry point of DxeCore with the parameters of HobList. 18 It also installs EFI_END_OF_PEI_PPI to signal the end of PEI phase. 19 20 @param DxeCoreEntryPoint The entry point of DxeCore. 21 @param HobList The start of HobList passed to DxeCore. 22 23 **/ 24 VOID HandOffToDxeCore(IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,IN EFI_PEI_HOB_POINTERS HobList)25HandOffToDxeCore ( 26 IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint, 27 IN EFI_PEI_HOB_POINTERS HobList 28 ) 29 { 30 VOID *BaseOfStack; 31 VOID *TopOfStack; 32 EFI_STATUS Status; 33 34 // 35 // Allocate 128KB for the Stack 36 // 37 BaseOfStack = AllocatePages (EFI_SIZE_TO_PAGES (STACK_SIZE)); 38 ASSERT (BaseOfStack != NULL); 39 40 // 41 // Compute the top of the stack we were allocated. Pre-allocate a UINTN 42 // for safety. 43 // 44 TopOfStack = (VOID *) ((UINTN) BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - CPU_STACK_ALIGNMENT); 45 TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT); 46 47 // 48 // End of PEI phase signal 49 // 50 Status = PeiServicesInstallPpi (&gEndOfPeiSignalPpi); 51 ASSERT_EFI_ERROR (Status); 52 53 // 54 // Update the contents of BSP stack HOB to reflect the real stack info passed to DxeCore. 55 // 56 UpdateStackHob ((EFI_PHYSICAL_ADDRESS)(UINTN) BaseOfStack, STACK_SIZE); 57 58 // 59 // Transfer the control to the entry point of DxeCore. 60 // 61 SwitchStack ( 62 (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint, 63 HobList.Raw, 64 NULL, 65 TopOfStack 66 ); 67 } 68