]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/CpuDxe/Ia32/MpAsm.asm
UefiCpuPkg/CpuDxe: Add stackless assembly AP entry points
[mirror_edk2.git] / UefiCpuPkg / CpuDxe / Ia32 / MpAsm.asm
CommitLineData
fab82c18
JJ
1;------------------------------------------------------------------------------\r
2;\r
3; Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
4; This program and the accompanying materials\r
5; are licensed and made available under the terms and conditions of the BSD License\r
6; which accompanies this distribution. The full text of the license may be found at\r
7; http://opensource.org/licenses/bsd-license.php.\r
8;\r
9; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11;\r
12;------------------------------------------------------------------------------\r
13\r
14.586p\r
15.model flat, C\r
16\r
17extern mTopOfApCommonStack:DWORD\r
18extern ApEntryPointInC:PROC\r
19\r
20.code\r
21\r
22;\r
23; This lock only allows one AP to use the mTopOfApCommonStack stack at a time\r
24;\r
25ApStackLock dd 0\r
26\r
27;.code\r
28\r
29;------------------------------------------------------------------------------\r
30; VOID\r
31; EFIAPI\r
32; AsmApEntryPoint (\r
33; VOID\r
34; );\r
35;------------------------------------------------------------------------------\r
36AsmApEntryPoint PROC\r
37\r
38 cli\r
39AsmApEntryPointAcquireLock:\r
40lock bts dword ptr [ApStackLock], 0\r
41 pause\r
42 jc AsmApEntryPointAcquireLock\r
43\r
44 mov esp, [mTopOfApCommonStack]\r
45 call ApEntryPointInC\r
46\r
47 cli\r
48\r
49lock btc dword ptr [ApStackLock], 0\r
50\r
51 mov eax, 100h\r
52AsmApEntryPointShareLock:\r
53 pause\r
54 dec eax\r
55 jnz AsmApEntryPointShareLock\r
56\r
57 jmp AsmApEntryPoint\r
58\r
59AsmApEntryPoint ENDP\r
60\r
61;------------------------------------------------------------------------------\r
62; VOID\r
63; EFIAPI\r
64; AsmApDoneWithCommonStack (\r
65; VOID\r
66; );\r
67;------------------------------------------------------------------------------\r
68AsmApDoneWithCommonStack PROC PUBLIC\r
69\r
70lock btc dword ptr [ApStackLock], 0\r
71 ret\r
72\r
73AsmApDoneWithCommonStack ENDP\r
74\r
75END\r