]> git.proxmox.com Git - mirror_edk2.git/blame - 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
CommitLineData
949f388f 1#------------------------------------------------------------------------------\r
2#\r
3# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
4# Portitions copyright (c) 2011, Apple Inc. All rights reserved.\r
5# This program and the accompanying materials\r
6# are licensed and made available under the terms and conditions of the BSD License\r
7# which accompanies this distribution. The full text of the license may be found at\r
8# http://opensource.org/licenses/bsd-license.php.\r
9#\r
10# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12#\r
13#------------------------------------------------------------------------------\r
14\r
15\r
16#------------------------------------------------------------------------------\r
17# Routine Description:\r
18#\r
19# Routine for switching stacks with 3 parameters EFI ABI\r
20# Convert UNIX to EFI ABI\r
21#\r
22# Arguments:\r
23#\r
24# (rdi) EntryPoint - Entry point with new stack.\r
25# (rsi) Context1 - Parameter1 for entry point. (rcx)\r
26# (rdx) Context2 - Parameter2 for entry point. (rdx) \r
27# (rcx) Context3 - Parameter3 for entry point. (r8)\r
28# (r8) NewStack - The pointer to new stack.\r
29#\r
30# Returns:\r
31#\r
32# None\r
33#\r
34#------------------------------------------------------------------------------\r
35ASM_GLOBAL ASM_PFX(PeiSwitchStacks)\r
36ASM_PFX(PeiSwitchStacks):\r
37 pushq $0 // tells gdb to stop unwinding frame\r
38 movq %rsp, %rbp\r
39\r
40 movq %r8, %rsp\r
41 \r
42 movq %rdi, %rax\r
43 movq %rsi, %rcx\r
44 movq %rcx, %r8 \r
45 \r
46 #\r
47 # Reserve space for register parameters (rcx, rdx, r8 & r9) on the stack,\r
48 # in case the callee wishes to spill them.\r
49 #\r
50 subq $32, %rsp // 32-byte shadow space plus alignment pad\r
51 call *%rax\r
52\r
53 \r
54\r