1 #------------------------------------------------------------------------------
3 # Copyright (c) 2014, 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 #------------------------------------------------------------------------------
13 #------------------------------------------------------------------------------
17 # UINT32 TemporaryMemoryBase,
18 # UINT32 PermenentMemoryBase
20 #------------------------------------------------------------------------------
21 ASM_GLOBAL ASM_PFX (SecSwitchStack)
22 ASM_PFX(SecSwitchStack):
24 # Save standard registers so they can be used to change stack
32 # !!CAUTION!! this function address's is pushed into stack after
33 # migration of whole temporary memory, so need save it to permenent
36 movl 20(%esp), %ebx # Save the first parameter
37 movl 24(%esp), %ecx # Save the second parameter
40 # Save this function's return address into permenent memory at first.
41 # Then, Fixup the esp point to permenent memory
46 movl 0(%esp), %edx # copy pushed register's value to permenent memory
54 movl 16(%esp), %edx # Update this function's return address into permenent memory
56 movl %eax, %esp # From now, esp is pointed to permenent memory
59 # Fixup the ebp point to permenent memory
64 movl %eax, %ebp # From now, ebp is pointed to permenent memory