1 #------------------------------------------------------------------------------
3 # Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
4 # This program and the accompanying materials
5 # are licensed and made available under the terms and conditions of the BSD License
6 # which accompanies this distribution. The full text of the license may be found at
7 # http://opensource.org/licenses/bsd-license.php.
9 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #------------------------------------------------------------------------------
21 #------------------------------------------------------------------------------
22 # Routine Description:
24 # Routine for switching stacks with 3 parameters EFI ABI
25 # Convert UNIX to EFI ABI
29 # (rdi) EntryPoint - Entry point with new stack.
30 # (rsi) Context1 - Parameter1 for entry point. (rcx)
31 # (rdx) Context2 - Parameter2 for entry point. (rdx)
32 # (rcx) Context3 - Parameter3 for entry point. (r8)
33 # (r8) NewStack - The pointer to new stack.
39 #------------------------------------------------------------------------------
40 ASM_GLOBAL ASM_PFX(PeiSwitchStacks)
41 ASM_PFX(PeiSwitchStacks):
42 pushq %rbp // stack frame is for the debugger
52 # Reserve space for register parameters (rcx, rdx, r8 & r9) on the stack,
53 # in case the callee wishes to spill them.
55 subq $32, %rsp // 32-byte shadow space plus alignment pad
59 #------------------------------------------------------------------------------
60 # Routine Description:
62 # Routine for switching stacks with 3 parameters UNIX ABI
66 # (rdi) EntryPoint - Entry point with new stack.
67 # (rsi) Context1 - Parameter1 for entry point.
68 # (rdx) Context2 - Parameter2 for entry point.
69 # (rcx) Context3 - Parameter3 for entry point.
70 # (r8) NewStack - The pointer to new stack.
76 #------------------------------------------------------------------------------
77 ASM_GLOBAL ASM_PFX(UnixPeiSwitchStacks)
78 ASM_PFX(UnixPeiSwitchStacks):
79 pushq %rbp // stack frame is for the debugger
90 # Reserve space for redzone on the stack,
91 # in case the callee wishes to spill them.
98 #------------------------------------------------------------------------------
102 # UINT32 TemporaryMemoryBase, // Rcx, Rdi
103 # UINT32 PermenentMemoryBase // Rdx, Rsi
105 #------------------------------------------------------------------------------
106 ASM_GLOBAL ASM_PFX(SecSwitchStack)
107 ASM_PFX(SecSwitchStack):
108 pushq %rbp // stack frame is for the debugger