]> git.proxmox.com Git - mirror_edk2.git/blame - EmulatorPkg/Sec/Ia32/TempRam.c
EmbeddedPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / EmulatorPkg / Sec / Ia32 / TempRam.c
CommitLineData
afa99fac
GL
1/*++ @file\r
2 Temp RAM PPI\r
3\r
4Copyright (c) 2011, Apple Inc. All rights reserved.<BR>\r
5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include <PiPei.h>\r
16#include <Library/DebugLib.h>\r
17#include <Library/BaseMemoryLib.h>\r
18\r
19#include <Ppi/TemporaryRamSupport.h>\r
20\r
21VOID\r
22EFIAPI\r
23SecSwitchStack (\r
24 UINT32 TemporaryMemoryBase,\r
25 UINT32 PermenentMemoryBase\r
26 );\r
27\r
28\r
29EFI_STATUS\r
30EFIAPI\r
31SecTemporaryRamSupport (\r
32 IN CONST EFI_PEI_SERVICES **PeiServices,\r
33 IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,\r
34 IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,\r
35 IN UINTN CopySize\r
36 )\r
37{\r
38 //\r
39 // Migrate the whole temporary memory to permanent memory.\r
40 //\r
41 CopyMem (\r
42 (VOID*)(UINTN)PermanentMemoryBase,\r
43 (VOID*)(UINTN)TemporaryMemoryBase,\r
44 CopySize\r
45 );\r
46\r
47 //\r
48 // SecSwitchStack function must be invoked after the memory migration\r
49 // immediately, also we need fixup the stack change caused by new call into\r
50 // permanent memory.\r
51 //\r
52 SecSwitchStack ((UINT32) TemporaryMemoryBase, (UINT32) PermanentMemoryBase);\r
53\r
54 //\r
55 // We need *not* fix the return address because currently,\r
56 // The PeiCore is executed in flash.\r
57 //\r
58\r
59 //\r
60 // Simulate to invalid temporary memory, terminate temporary memory\r
61 //\r
62 //ZeroMem ((VOID*)(UINTN)TemporaryMemoryBase, CopySize);\r
63\r
64 return EFI_SUCCESS;\r
65}\r