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