]> git.proxmox.com Git - mirror_edk2.git/blob - InOsEmuPkg/Unix/Sec/X64/SwitchStack.S
Added generic EFIABI SEC to InOsEmuPkg. Add library to abstract FV cracking and remov...
[mirror_edk2.git] / InOsEmuPkg / Unix / Sec / X64 / SwitchStack.S
1 #------------------------------------------------------------------------------
2 #
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.
9 #
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.
12 #
13 #------------------------------------------------------------------------------
14
15
16 #------------------------------------------------------------------------------
17 # Routine Description:
18 #
19 # Routine for switching stacks with 3 parameters EFI ABI
20 # Convert UNIX to EFI ABI
21 #
22 # Arguments:
23 #
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) Context3 - Parameter3 for entry point. (r8)
28 # (r8) NewStack - The pointer to new stack.
29 #
30 # Returns:
31 #
32 # None
33 #
34 #------------------------------------------------------------------------------
35 ASM_GLOBAL ASM_PFX(PeiSwitchStacks)
36 ASM_PFX(PeiSwitchStacks):
37 pushq $0 // tells gdb to stop unwinding frame
38 movq %rsp, %rbp
39
40 movq %r8, %rsp
41
42 movq %rdi, %rax
43 movq %rsi, %rcx
44 movq %rcx, %r8
45
46 #
47 # Reserve space for register parameters (rcx, rdx, r8 & r9) on the stack,
48 # in case the callee wishes to spill them.
49 #
50 subq $32, %rsp // 32-byte shadow space plus alignment pad
51 call *%rax
52
53
54