1 #------------------------------------------------------------------------------
3 # Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
4 # Portitions copyright (c) 2011, Apple Inc. All rights reserved.
5 # This program and the accompanying materials
6 # are licensed and made available under the terms and conditions of the BSD License
7 # which accompanies this distribution. The full text of the license may be found at
8 # http://opensource.org/licenses/bsd-license.php.
10 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 #------------------------------------------------------------------------------
16 #------------------------------------------------------------------------------
17 # Routine Description:
19 # Routine for switching stacks with 2 parameters EFI ABI
20 # Convert UNIX to EFI ABI
24 # (rdi) EntryPoint - Entry point with new stack.
25 # (rsi) Context1 - Parameter1 for entry point. (rcx)
26 # (rdx) Context2 - Parameter2 for entry point. (rdx)
27 # (rcx) NewStack - The pointer to new stack.
33 #------------------------------------------------------------------------------
34 ASM_GLOBAL ASM_PFX(PeiSwitchStacks)
35 ASM_PFX(PeiSwitchStacks):
36 pushq $0 // tells gdb to stop unwinding frame
39 movq %rcx, %rsp // update stack pointer
41 movq %rdi, %rax // entry point to %rax
42 movq %rsi, %rcx // Adjust Context1
43 // Context2 already in the rigth spot
46 # Reserve space for register parameters (rcx, rdx, r8 & r9) on the stack,
47 # in case the callee wishes to spill them.
49 subq $32, %rsp // 32-byte shadow space plus alignment pad