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