1 ;------------------------------------------------------------------------------
3 ; Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
4 ; SPDX-License-Identifier: BSD-2-Clause-Patent
12 ; Switch the stack from temporary memory to permanent memory.
14 ;------------------------------------------------------------------------------
20 ;------------------------------------------------------------------------------
24 ; UINT32 TemporaryMemoryBase,
25 ; UINT32 PermenentMemoryBase
27 ;------------------------------------------------------------------------------
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 permanent
43 mov ebx, [esp + 20] ; Save the first parameter
44 mov ecx, [esp + 24] ; Save the second parameter
47 ; Save this function's return address into permanent memory at first.
48 ; Then, Fixup the esp point to permanent memory
53 mov edx, dword ptr [esp] ; copy pushed register's value to permanent memory
54 mov dword ptr [eax], edx
55 mov edx, dword ptr [esp + 4]
56 mov dword ptr [eax + 4], edx
57 mov edx, dword ptr [esp + 8]
58 mov dword ptr [eax + 8], edx
59 mov edx, dword ptr [esp + 12]
60 mov dword ptr [eax + 12], edx
61 mov edx, dword ptr [esp + 16] ; Update this function's return address into permanent memory
62 mov dword ptr [eax + 16], edx
63 mov esp, eax ; From now, esp is pointed to permanent memory
66 ; Fixup the ebp point to permanent memory
71 mov ebp, eax ; From now, ebp is pointed to permanent memory
74 ; Fixup callee's ebp point for PeiDispatch
76 mov eax, dword ptr [ebp]
79 mov dword ptr [ebp], eax ; From now, Temporary's PPI caller's stack is in permanent memory