1 #------------------------------------------------------------------------------
3 # Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
4 # SPDX-License-Identifier: BSD-2-Clause-Patent
8 # Switch the stack from temporary memory to permenent memory.
10 #------------------------------------------------------------------------------
12 ASM_GLOBAL ASM_PFX(SecSwitchStack)
14 #------------------------------------------------------------------------------
18 # UINT32 TemporaryMemoryBase,
19 # UINT32 PermenentMemoryBase
21 #------------------------------------------------------------------------------
22 ASM_GLOBAL ASM_PFX(SecSwitchStack)
23 ASM_PFX(SecSwitchStack):
25 # Save four registers: eax, ebx, ecx, edx
33 # !!CAUTION!! this function address's is pushed into stack after
34 # migration of whole temporary memory, so need save it to permenent
38 movl 20(%esp), %ebx # Save the first parameter
39 movl 24(%esp), %ecx # Save the second parameter
42 # Save this function's return address into permenent memory at first.
43 # Then, Fixup the esp point to permenent memory
49 movl (%esp), %edx # copy pushed register's value to permenent memory
57 movl 16(%esp), %edx # Update this function's return address into permenent memory
59 movl %eax, %esp # From now, esp is pointed to permenent memory
62 # Fixup the ebp point to permenent memory
67 movl %eax, %ebp # From now, ebp is pointed to permenent memory
70 # Fixup callee's ebp point for PeiDispatch
75 # movl %eax, %ebp # From now, ebp is pointed to permenent memory