TemplateSec.c revision 2ef2b01e07c02db339f34004445734a2dbdd80e1
1/** @file
2
3  Copyright (c) 2008-2009, Apple Inc. All rights reserved.
4
5  All rights reserved. This program and the accompanying materials
6  are licensed and made available under the terms and conditions of the BSD License
7  which accompanies this distribution.  The full text of the license may be found at
8  http://opensource.org/licenses/bsd-license.php
9
10  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13**/
14
15#include <PiPei.h>
16
17#include <Library/DebugLib.h>
18#include <Library/PrePiLib.h>
19#include <Library/PcdLib.h>
20
21#include <Ppi/GuidedSectionExtraction.h>
22
23VOID
24_ModuleEntryPoint (
25  VOID
26  )
27{
28}
29
30VOID
31CEntryPoint (
32  VOID    *MemoryBase,
33  UINTN   MemorySize,
34  VOID    *StackBase,
35  UINTN   StackSize
36  )
37{
38  EFI_PHYSICAL_ADDRESS  MemoryBegin;
39  UINT64                MemoryLength;
40  VOID                  *HobBase;
41
42  //
43  // Boot strap the C environment so the other library services will work properly.
44  //
45  MemoryBegin  = (EFI_PHYSICAL_ADDRESS)(UINTN)MemoryBase;
46  MemoryLength = (UINT64)MemorySize;
47  HobBase      = (VOID *)(UINTN)(FixedPcdGet32(PcdEmbeddedFdBaseAddress) + FixedPcdGet32(PcdEmbeddedFdSize));
48  CreateHobList (MemoryBase, MemorySize, HobBase, StackBase);
49
50  MemoryBegin  = (EFI_PHYSICAL_ADDRESS)(UINTN)StackBase;
51  MemoryLength = (UINT64)StackSize;
52  UpdateStackHob (MemoryBegin, MemoryLength);
53
54  DEBUG ((DEBUG_ERROR, "CEntryPoint (%x,%x,%x,%x)\n", MemoryBase, MemorySize, StackBase, StackSize));
55
56  //
57  // Add your C code stuff here....
58  //
59
60
61  //
62  // Load the DXE Core and transfer control to it
63  //
64
65  // Give the DXE Core access to our DEBUG and ASSERT infrastructure so this will work prior
66  // to the DXE version being loaded. Thus we close the debugging gap between phases.
67  AddDxeCoreReportStatusCodeCallback ();
68
69  //BuildFvHobs (PcdBfvBase, PcdBfvSize, NULL);
70
71  LoadDxeCoreFromFv (NULL, 0);
72
73  // DXE Core should always load and never return
74  ASSERT (FALSE);
75}
76
77