1 #------------------------------------------------------------------------------
3 # Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
4 # SPDX-License-Identifier: BSD-2-Clause-Patent
12 # Switch the stack from temporary memory to permenent memory.
14 #------------------------------------------------------------------------------
19 //------------------------------------------------------------------------------
23 // UINT32 TemporaryMemoryBase,
24 // UINT32 PermenentMemoryBase
26 //------------------------------------------------------------------------------
27 ASM_GLOBAL ASM_PFX(SecSwitchStack)
28 ASM_PFX(SecSwitchStack):
30 # Save three register: eax, ebx, ecx
38 # !!CAUTION!! this function address's is pushed into stack after
39 # migration of whole temporary memory, so need save it to permenent
43 movl 20(%esp), %ebx # Save the first parameter
44 movl 24(%esp), %ecx # Save the second parameter
47 # Save this function's return address into permenent memory at first.
48 # Then, Fixup the esp point to permenent memory
54 movl (%esp), %edx # copy pushed register's value to permenent memory
64 movl %eax, %esp # From now, esp is pointed to permenent memory
67 # Fixup the ebp point to permenent memory
73 movl %eax, %ebp # From now, ebp is pointed to permenent memory
76 # Fixup callee's ebp point for PeiDispatch
81 movl %eax, (%ebp) # From now, Temporary's PPI caller's stack is in permenent memory