]> git.proxmox.com Git - mirror_edk2.git/blob - EdkModulePkg/Core/DxeIplPeim/Ipf/DxeLoadFunc.c
• Set the default value of PcdDxeIplSwitchToLongMode to TRUE.
[mirror_edk2.git] / EdkModulePkg / Core / DxeIplPeim / Ipf / DxeLoadFunc.c
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 IpfDxeLoad.c
15
16 Abstract:
17
18 Ipf-specifc functionality for DxeLoad.
19
20 --*/
21
22 #include "DxeIpl.h"
23
24 VOID
25 HandOffToDxeCore (
26 IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,
27 IN EFI_PEI_HOB_POINTERS HobList
28 )
29 {
30 VOID *BaseOfStack;
31 VOID *TopOfStack;
32 VOID *BspStore;
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 // Allocate 16KB for the BspStore
42 //
43 BspStore = AllocatePages (EFI_SIZE_TO_PAGES (BSP_STORE_SIZE));
44 ASSERT (BspStore != NULL);
45 //
46 // Build BspStoreHob
47 //
48 BuildBspStoreHob ((EFI_PHYSICAL_ADDRESS) (UINTN) BspStore, BSP_STORE_SIZE, EfiBootServicesData);
49
50 //
51 // Compute the top of the stack we were allocated. Pre-allocate a UINTN
52 // for safety.
53 //
54 TopOfStack = (VOID *) ((UINTN) BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - CPU_STACK_ALIGNMENT);
55 TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);
56
57 AsmSwitchStackAndBackingStore (
58 (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,
59 HobList.Raw,
60 NULL,
61 TopOfStack,
62 BspStore
63 );
64 }