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 ;------------------------------------------------------------------------------
16 ;------------------------------------------------------------------------------
20 ; UINT32 TemporaryMemoryBase,
21 ; UINT32 PermenentMemoryBase
23 ;------------------------------------------------------------------------------
26 ; Save three register: eax, ebx, ecx
34 ; !!CAUTION!! this function address's is pushed into stack after
35 ; migration of whole temporary memory, so need save it to permenent
39 mov ebx, [esp + 20] ; Save the first parameter
40 mov ecx, [esp + 24] ; Save the second parameter
43 ; Save this function's return address into permenent memory at first.
44 ; Then, Fixup the esp point to permenent memory
49 mov edx, dword ptr [esp] ; copy pushed register's value to permenent memory
50 mov dword ptr [eax], edx
51 mov edx, dword ptr [esp + 4]
52 mov dword ptr [eax + 4], edx
53 mov edx, dword ptr [esp + 8]
54 mov dword ptr [eax + 8], edx
55 mov edx, dword ptr [esp + 12]
56 mov dword ptr [eax + 12], edx
57 mov edx, dword ptr [esp + 16] ; Update this function's return address into permenent memory
58 mov dword ptr [eax + 16], edx
59 mov esp, eax ; From now, esp is pointed to permenent memory
62 ; Fixup the ebp point to permenent memory
67 mov ebp, eax ; From now, ebp is pointed to permenent memory