1 #------------------------------------------------------------------------------
3 # Copyright (c) 2008 - 2009, Intel Corporation
4 # Portions copyright (c) 2008-2009 Apple Inc.
5 # All rights reserved. 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.
19 # Switch the stack from temporary memory to permenent memory.
21 #------------------------------------------------------------------------------
23 #------------------------------------------------------------------------------
27 # UINT32 TemporaryMemoryBase,
28 # UINT32 PermenentMemoryBase
30 #------------------------------------------------------------------------------
32 #include <ProcessorBind.h>
34 ASM_GLOBAL ASM_PFX(SecSwitchStack)
35 ASM_PFX(SecSwitchStack):
37 # Save three register: eax, ebx, ecx
45 # !!CAUTION!! this function address's is pushed into stack after
46 # migration of whole temporary memory, so need save it to permenent
50 movl 20(%esp), %ebx # Save the first parameter
51 movl 24(%esp), %ecx # Save the second parameter
54 # Save this function's return address into permenent memory at first.
55 # Then, Fixup the esp point to permenent memory
61 movl (%esp), %edx # copy pushed register's value to permenent memory
71 movl %eax, %esp # From now, esp is pointed to permenent memory
74 # Fixup the ebp point to permenent memory
80 movl %eax, %ebp # From now, ebp is pointed to permenent memory
83 # Fixup callee's ebp point for PeiDispatch
88 movl %eax, (%ebp) # From now, Temporary's PPI caller's stack is in permenent memory