1;------------------------------------------------------------------------------ 2; 3; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR> 4; SPDX-License-Identifier: BSD-2-Clause-Patent 5; 6; Module Name: 7; 8; SwitchStack.Asm 9; 10; Abstract: 11; 12;------------------------------------------------------------------------------ 13 14 DEFAULT REL 15 SECTION .text 16 17;------------------------------------------------------------------------------ 18; Routine Description: 19; 20; Routine for switching stacks with 2 parameters 21; 22; Arguments: 23; 24; (rcx) EntryPoint - Entry point with new stack. 25; (rdx) Context1 - Parameter1 for entry point. 26; (r8) Context2 - Parameter2 for entry point. 27; (r9) NewStack - The pointer to new stack. 28; 29; Returns: 30; 31; None 32; 33;------------------------------------------------------------------------------ 34global ASM_PFX(InternalSwitchStack) 35ASM_PFX(InternalSwitchStack): 36 mov rax, rcx 37 mov rcx, rdx 38 mov rdx, r8 39 ; 40 ; Reserve space for register parameters (rcx, rdx, r8 & r9) on the stack, 41 ; in case the callee wishes to spill them. 42 ; 43 lea rsp, [r9 - 0x20] 44 call rax 45 46