1 #------------------------------------------------------------------------------
3 # Copyright (c) 2008, Intel Corporation
4 # All rights reserved. This program and the accompanying materials
5 # are licensed and made available under the terms and conditions of the BSD License
6 # which accompanies this distribution. The full text of the license may be found at
7 # http://opensource.org/licenses/bsd-license.php
9 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 # Switch the stack from temporary memory to permenent memory.
20 #------------------------------------------------------------------------------
22 #------------------------------------------------------------------------------
26 # UINT32 TemporaryMemoryBase,
27 # UINT32 PermenentMemoryBase
29 #------------------------------------------------------------------------------
31 #include <ProcessorBind.h>
33 ASM_GLOBAL ASM_PFX(SecSwitchStack)
34 ASM_PFX(SecSwitchStack):
36 # Save three register: eax, ebx, ecx
44 # !!CAUTION!! this function address's is pushed into stack after
45 # migration of whole temporary memory, so need save it to permenent
49 movl 20(%esp), %ebx # Save the first parameter
50 movl 24(%esp), %ecx # Save the second parameter
53 # Save this function's return address into permenent memory at first.
54 # Then, Fixup the esp point to permenent memory
60 movl (%esp), %edx # copy pushed register's value to permenent memory
70 movl %eax, %esp # From now, esp is pointed to permenent memory
73 # Fixup the ebp point to permenent memory
78 movl %eax, %ebp # From now, ebp is pointed to permenent memory
81 # Fixup callee's ebp point for PeiDispatch
86 movl %eax, (%ebp) # From now, Temporary's PPI caller's stack is in permenent memory