4 Copyright (c) 2011, Apple Inc. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include <Library/DebugLib.h>
11 #include <Library/BaseMemoryLib.h>
13 #include <Ppi/TemporaryRamSupport.h>
18 UINT32 TemporaryMemoryBase
,
19 UINT32 PermenentMemoryBase
24 SecTemporaryRamSupport (
25 IN CONST EFI_PEI_SERVICES
**PeiServices
,
26 IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase
,
27 IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase
,
32 // Migrate the whole temporary memory to permanent memory.
35 (VOID
*)(UINTN
)PermanentMemoryBase
,
36 (VOID
*)(UINTN
)TemporaryMemoryBase
,
41 // SecSwitchStack function must be invoked after the memory migration
42 // immediately, also we need fixup the stack change caused by new call into
45 SecSwitchStack ((UINT32
)TemporaryMemoryBase
, (UINT32
)PermanentMemoryBase
);
48 // We need *not* fix the return address because currently,
49 // The PeiCore is executed in flash.
53 // Simulate to invalid temporary memory, terminate temporary memory
55 // ZeroMem ((VOID*)(UINTN)TemporaryMemoryBase, CopySize);