]> git.proxmox.com Git - mirror_edk2.git/blame - EmulatorPkg/Unix/Host/X64/SwitchStack.S
EmulatorPkg/Unix: Fix various typos
[mirror_edk2.git] / EmulatorPkg / Unix / Host / X64 / SwitchStack.S
CommitLineData
949f388f 1#------------------------------------------------------------------------------\r
2#\r
3# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
26cfe2c6 4# Portions copyright (c) 2011, Apple Inc. All rights reserved.\r
e3ba31da 5# SPDX-License-Identifier: BSD-2-Clause-Patent\r
949f388f 6#\r
7#------------------------------------------------------------------------------\r
8\r
9\r
10#------------------------------------------------------------------------------\r
11# Routine Description:\r
12#\r
d59326d3 13# Routine for switching stacks with 2 parameters EFI ABI\r
949f388f 14# Convert UNIX to EFI ABI\r
15#\r
16# Arguments:\r
17#\r
18# (rdi) EntryPoint - Entry point with new stack.\r
19# (rsi) Context1 - Parameter1 for entry point. (rcx)\r
d18d8a1d 20# (rdx) Context2 - Parameter2 for entry point. (rdx)\r
d59326d3 21# (rcx) NewStack - The pointer to new stack.\r
949f388f 22#\r
23# Returns:\r
24#\r
25# None\r
26#\r
27#------------------------------------------------------------------------------\r
28ASM_GLOBAL ASM_PFX(PeiSwitchStacks)\r
29ASM_PFX(PeiSwitchStacks):\r
30 pushq $0 // tells gdb to stop unwinding frame\r
31 movq %rsp, %rbp\r
32\r
d59326d3 33 movq %rcx, %rsp // update stack pointer\r
d18d8a1d 34\r
d59326d3 35 movq %rdi, %rax // entry point to %rax\r
36 movq %rsi, %rcx // Adjust Context1\r
37 // Context2 already in the rigth spot\r
d18d8a1d 38\r
949f388f 39 #\r
40 # Reserve space for register parameters (rcx, rdx, r8 & r9) on the stack,\r
41 # in case the callee wishes to spill them.\r
42 #\r
43 subq $32, %rsp // 32-byte shadow space plus alignment pad\r
44 call *%rax\r
45\r
d18d8a1d 46\r
949f388f 47\r