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