]> git.proxmox.com Git - mirror_edk2.git/blob - EmulatorPkg/Sec/Ia32/TempRam.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / EmulatorPkg / Sec / Ia32 / TempRam.c
1 /*++ @file
2 Temp RAM PPI
3
4 Copyright (c) 2011, Apple Inc. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include <PiPei.h>
10 #include <Library/DebugLib.h>
11 #include <Library/BaseMemoryLib.h>
12
13 #include <Ppi/TemporaryRamSupport.h>
14
15 VOID
16 EFIAPI
17 SecSwitchStack (
18 UINT32 TemporaryMemoryBase,
19 UINT32 PermenentMemoryBase
20 );
21
22 EFI_STATUS
23 EFIAPI
24 SecTemporaryRamSupport (
25 IN CONST EFI_PEI_SERVICES **PeiServices,
26 IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,
27 IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,
28 IN UINTN CopySize
29 )
30 {
31 //
32 // Migrate the whole temporary memory to permanent memory.
33 //
34 CopyMem (
35 (VOID *)(UINTN)PermanentMemoryBase,
36 (VOID *)(UINTN)TemporaryMemoryBase,
37 CopySize
38 );
39
40 //
41 // SecSwitchStack function must be invoked after the memory migration
42 // immediately, also we need fixup the stack change caused by new call into
43 // permanent memory.
44 //
45 SecSwitchStack ((UINT32)TemporaryMemoryBase, (UINT32)PermanentMemoryBase);
46
47 //
48 // We need *not* fix the return address because currently,
49 // The PeiCore is executed in flash.
50 //
51
52 //
53 // Simulate to invalid temporary memory, terminate temporary memory
54 //
55 // ZeroMem ((VOID*)(UINTN)TemporaryMemoryBase, CopySize);
56
57 return EFI_SUCCESS;
58 }