+++ /dev/null
-#------------------------------------------------------------------------------\r
-#\r
-# Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>\r
-# SPDX-License-Identifier: BSD-2-Clause-Patent\r
-#\r
-# Abstract:\r
-#\r
-# Switch the stack from temporary memory to permenent memory.\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-ASM_GLOBAL ASM_PFX(SecSwitchStack)\r
-\r
-#------------------------------------------------------------------------------\r
-# VOID\r
-# EFIAPI\r
-# SecSwitchStack (\r
-# UINT32 TemporaryMemoryBase,\r
-# UINT32 PermenentMemoryBase\r
-# )\r
-#------------------------------------------------------------------------------\r
-ASM_GLOBAL ASM_PFX(SecSwitchStack)\r
-ASM_PFX(SecSwitchStack):\r
-#\r
-# Save four registers: eax, ebx, ecx, edx\r
-#\r
- pushl %eax\r
- pushl %ebx\r
- pushl %ecx\r
- pushl %edx\r
-\r
-#\r
-# !!CAUTION!! this function address's is pushed into stack after\r
-# migration of whole temporary memory, so need save it to permenent\r
-# memory at first!\r
-#\r
-\r
- movl 20(%esp), %ebx # Save the first parameter\r
- movl 24(%esp), %ecx # Save the second parameter\r
-\r
-#\r
-# Save this function's return address into permenent memory at first.\r
-# Then, Fixup the esp point to permenent memory\r
-#\r
-\r
- movl %esp, %eax\r
- subl %ebx, %eax\r
- addl %ecx, %eax\r
- movl (%esp), %edx # copy pushed register's value to permenent memory\r
- movl %edx, (%eax)\r
- movl 4(%esp), %edx\r
- movl %edx, 4(%eax)\r
- movl 8(%esp), %edx\r
- movl %edx, 8(%eax)\r
- movl 12(%esp), %edx\r
- movl %edx, 12(%eax)\r
- movl 16(%esp), %edx # Update this function's return address into permenent memory\r
- movl %edx, 16(%eax)\r
- movl %eax, %esp # From now, esp is pointed to permenent memory\r
-\r
-#\r
-# Fixup the ebp point to permenent memory\r
-#\r
- movl %ebp, %eax\r
- subl %ebx, %eax\r
- addl %ecx, %eax\r
- movl %eax, %ebp # From now, ebp is pointed to permenent memory\r
-\r
-#\r
-# Fixup callee's ebp point for PeiDispatch\r
-#\r
-# movl %ebp, %eax\r
-# subl %ebx, %eax\r
-# addl %ecx, %eax\r
-# movl %eax, %ebp # From now, ebp is pointed to permenent memory\r
- popl %edx\r
- popl %ecx\r
- popl %ebx\r
- popl %eax \r
- ret
\ No newline at end of file