]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseLib/X64/SwitchStack.nasm
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseLib / X64 / SwitchStack.nasm
CommitLineData
ed1e7222
JJ
1;------------------------------------------------------------------------------\r
2;\r
3; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
9344f092 4; SPDX-License-Identifier: BSD-2-Clause-Patent\r
ed1e7222
JJ
5;\r
6; Module Name:\r
7;\r
8; SwitchStack.Asm\r
9;\r
10; Abstract:\r
11;\r
12;------------------------------------------------------------------------------\r
13\r
14 DEFAULT REL\r
15 SECTION .text\r
16\r
17;------------------------------------------------------------------------------\r
18; Routine Description:\r
19;\r
20; Routine for switching stacks with 2 parameters\r
21;\r
22; Arguments:\r
23;\r
24; (rcx) EntryPoint - Entry point with new stack.\r
25; (rdx) Context1 - Parameter1 for entry point.\r
26; (r8) Context2 - Parameter2 for entry point.\r
27; (r9) NewStack - The pointer to new stack.\r
28;\r
29; Returns:\r
30;\r
31; None\r
32;\r
33;------------------------------------------------------------------------------\r
34global ASM_PFX(InternalSwitchStack)\r
35ASM_PFX(InternalSwitchStack):\r
36 mov rax, rcx\r
37 mov rcx, rdx\r
38 mov rdx, r8\r
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 lea rsp, [r9 - 0x20]\r
44 call rax\r
45\r