]>
Commit | Line | Data |
---|---|---|
96226baa | 1 | /** @file\r |
91d92e25 | 2 | x64-specifc functionality for DxeLoad.\r |
95276127 | 3 | \r |
cd5ebaa0 HT |
4 | Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r |
5 | This program and the accompanying materials\r | |
95276127 | 6 | are licensed and made available under the terms and conditions of the BSD License\r |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
96226baa | 13 | **/\r |
95276127 | 14 | \r |
95276127 | 15 | #include "DxeIpl.h"\r |
f3b33289 | 16 | #include "X64/VirtualMemory.h"\r |
95276127 | 17 | \r |
91d92e25 | 18 | \r |
19 | \r | |
20 | /**\r | |
21 | Transfers control to DxeCore.\r | |
22 | \r | |
23 | This function performs a CPU architecture specific operations to execute\r | |
24 | the entry point of DxeCore with the parameters of HobList.\r | |
48557c65 | 25 | It also installs EFI_END_OF_PEI_PPI to signal the end of PEI phase.\r |
91d92e25 | 26 | \r |
48557c65 | 27 | @param DxeCoreEntryPoint The entry point of DxeCore.\r |
91d92e25 | 28 | @param HobList The start of HobList passed to DxeCore.\r |
91d92e25 | 29 | \r |
30 | **/\r | |
95276127 | 31 | VOID\r |
32 | HandOffToDxeCore (\r | |
33 | IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,\r | |
9b937a73 | 34 | IN EFI_PEI_HOB_POINTERS HobList\r |
95276127 | 35 | )\r |
36 | {\r | |
37 | VOID *BaseOfStack;\r | |
38 | VOID *TopOfStack;\r | |
39 | EFI_STATUS Status;\r | |
f3b33289 | 40 | UINTN PageTables;\r |
95276127 | 41 | \r |
42 | //\r | |
43 | // Allocate 128KB for the Stack\r | |
44 | //\r | |
45 | BaseOfStack = AllocatePages (EFI_SIZE_TO_PAGES (STACK_SIZE));\r | |
46 | ASSERT (BaseOfStack != NULL);\r | |
47 | \r | |
48 | //\r | |
49 | // Compute the top of the stack we were allocated. Pre-allocate a UINTN\r | |
50 | // for safety.\r | |
51 | //\r | |
52 | TopOfStack = (VOID *) ((UINTN) BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - CPU_STACK_ALIGNMENT);\r | |
53 | TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);\r | |
54 | \r | |
d042796c | 55 | PageTables = 0;\r |
e47f0da4 | 56 | if (FeaturePcdGet (PcdDxeIplBuildPageTables)) {\r |
57 | //\r | |
58 | // Create page table and save PageMapLevel4 to CR3\r | |
59 | //\r | |
60 | PageTables = CreateIdentityMappingPageTables ();\r | |
61 | }\r | |
62 | \r | |
95276127 | 63 | //\r |
48557c65 | 64 | // End of PEI phase signal\r |
95276127 | 65 | //\r |
9b937a73 | 66 | Status = PeiServicesInstallPpi (&gEndOfPeiSignalPpi);\r |
95276127 | 67 | ASSERT_EFI_ERROR (Status);\r |
68 | \r | |
e47f0da4 | 69 | if (FeaturePcdGet (PcdDxeIplBuildPageTables)) {\r |
70 | AsmWriteCr3 (PageTables);\r | |
71 | }\r | |
f3b33289 | 72 | \r |
30c8f861 | 73 | //\r |
74 | // Update the contents of BSP stack HOB to reflect the real stack info passed to DxeCore.\r | |
75 | // \r | |
189575e8 | 76 | UpdateStackHob ((EFI_PHYSICAL_ADDRESS)(UINTN) BaseOfStack, STACK_SIZE);\r |
30c8f861 | 77 | \r |
b98da1b1 | 78 | //\r |
79 | // Transfer the control to the entry point of DxeCore.\r | |
80 | //\r | |
95276127 | 81 | SwitchStack (\r |
82 | (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,\r | |
83 | HobList.Raw,\r | |
84 | NULL,\r | |
85 | TopOfStack\r | |
86 | );\r | |
87 | }\r |