1 #------------------------------------------------------------------------------
3 # Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
4 # Portitions copyright (c) 2011, Apple Inc. All rights reserved.
5 # SPDX-License-Identifier: BSD-2-Clause-Patent
7 #------------------------------------------------------------------------------
10 #------------------------------------------------------------------------------
11 # Routine Description:
13 # Routine for switching stacks with 2 parameters EFI ABI
14 # Convert UNIX to EFI ABI
18 # (rdi) EntryPoint - Entry point with new stack.
19 # (rsi) Context1 - Parameter1 for entry point. (rcx)
20 # (rdx) Context2 - Parameter2 for entry point. (rdx)
21 # (rcx) NewStack - The pointer to new stack.
27 #------------------------------------------------------------------------------
28 ASM_GLOBAL ASM_PFX(PeiSwitchStacks)
29 ASM_PFX(PeiSwitchStacks):
30 pushq $0 // tells gdb to stop unwinding frame
33 movq %rcx, %rsp // update stack pointer
35 movq %rdi, %rax // entry point to %rax
36 movq %rsi, %rcx // Adjust Context1
37 // Context2 already in the rigth spot
40 # Reserve space for register parameters (rcx, rdx, r8 & r9) on the stack,
41 # in case the callee wishes to spill them.
43 subq $32, %rsp // 32-byte shadow space plus alignment pad