]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.nasm
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / InternalSwitchStack.nasm
1 ;------------------------------------------------------------------------------
2 ;
3 ; Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
4 ; Portions copyright (c) 2011, Apple Inc. All rights reserved.<BR>
5 ; SPDX-License-Identifier: BSD-2-Clause-Patent
6 ;
7 ; Module Name:
8 ;
9 ; InternalSwitchStack.nasm
10 ;
11 ; Abstract:
12 ;
13 ; Implementation of a stack switch on IA-32.
14 ;
15 ;------------------------------------------------------------------------------
16
17 SECTION .text
18
19 ;------------------------------------------------------------------------------
20 ; VOID
21 ; EFIAPI
22 ; InternalSwitchStack (
23 ; IN SWITCH_STACK_ENTRY_POINT EntryPoint,
24 ; IN VOID *Context1, OPTIONAL
25 ; IN VOID *Context2, OPTIONAL
26 ; IN VOID *NewStack
27 ; );
28 ;------------------------------------------------------------------------------
29 global ASM_PFX(InternalSwitchStack)
30 ASM_PFX(InternalSwitchStack):
31 push ebp
32 mov ebp, esp
33
34 mov esp, [ebp + 20] ; switch stack
35 sub esp, 8
36 mov eax, [ebp + 16]
37 mov [esp + 4], eax
38 mov eax, [ebp + 12]
39 mov [esp], eax
40 push 0 ; keeps gdb from unwinding stack
41 jmp dword [ebp + 8] ; call and never return