]> git.proxmox.com Git - mirror_edk2.git/blame - EdkModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c
Optimize to preallocate big bigs to avoid latter allocations.
[mirror_edk2.git] / EdkModulePkg / Core / DxeIplPeim / X64 / DxeLoadFunc.c
CommitLineData
657d3918 1/*++\r
2\r
3Copyright (c) 2006, Intel Corporation\r
4All rights reserved. This program and the accompanying materials\r
5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11\r
12Module Name:\r
13\r
14 DxeLoadFunc.c\r
15\r
16Abstract:\r
17\r
18 Ia32-specifc functionality for DxeLoad.\r
19\r
20--*/\r
21\r
22#include "DxeIpl.h"\r
23\r
24VOID\r
25HandOffToDxeCore (\r
26 IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,\r
3d109491 27 IN EFI_PEI_HOB_POINTERS HobList,\r
28 IN EFI_PEI_PPI_DESCRIPTOR *EndOfPeiSignal\r
657d3918 29 )\r
30{\r
31 VOID *BaseOfStack;\r
32 VOID *TopOfStack;\r
33\r
34 //\r
35 // Allocate 128KB for the Stack\r
36 //\r
37 BaseOfStack = AllocatePages (EFI_SIZE_TO_PAGES (STACK_SIZE));\r
38 ASSERT (BaseOfStack != NULL);\r
39\r
40 //\r
41 // Compute the top of the stack we were allocated. Pre-allocate a UINTN\r
42 // for safety.\r
43 //\r
44 TopOfStack = (VOID *) ((UINTN) BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - CPU_STACK_ALIGNMENT);\r
45 TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);\r
46\r
3d109491 47 //\r
48 // End of PEI phase singal\r
49 //\r
50 Status = PeiServicesInstallPpi (EndOfPeiSignal);\r
51 ASSERT_EFI_ERROR (Status);\r
52\r
657d3918 53 SwitchStack (\r
54 (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,\r
55 HobList.Raw,\r
56 NULL,\r
57 TopOfStack\r
58 );\r
59}\r