4 Copyright (c) 2011, Apple Inc. All rights reserved.<BR>
5 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
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.
16 #include <Library/DebugLib.h>
17 #include <Library/BaseMemoryLib.h>
19 #include <Ppi/TemporaryRamSupport.h>
24 UINT32 TemporaryMemoryBase
,
25 UINT32 PermenentMemoryBase
31 SecTemporaryRamSupport (
32 IN CONST EFI_PEI_SERVICES
**PeiServices
,
33 IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase
,
34 IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase
,
39 // Migrate the whole temporary memory to permanent memory.
42 (VOID
*)(UINTN
)PermanentMemoryBase
,
43 (VOID
*)(UINTN
)TemporaryMemoryBase
,
48 // SecSwitchStack function must be invoked after the memory migration
49 // immediately, also we need fixup the stack change caused by new call into
52 SecSwitchStack ((UINT32
) TemporaryMemoryBase
, (UINT32
) PermanentMemoryBase
);
55 // We need *not* fix the return address because currently,
56 // The PeiCore is executed in flash.
60 // Simulate to invalid temporary memory, terminate temporary memory
62 //ZeroMem ((VOID*)(UINTN)TemporaryMemoryBase, CopySize);