]>
Commit | Line | Data |
---|---|---|
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 | #include <Base.h>\r | |
15 | \r | |
16 | extern ASM_PFX(mTopOfApCommonStack):QWORD\r | |
17 | extern ASM_PFX(ApEntryPointInC):PROC\r | |
18 | \r | |
19 | .data\r | |
20 | \r | |
21 | ;\r | |
22 | ; This lock only allows one AP to use the mTopOfApCommonStack stack at a time\r | |
23 | ;\r | |
24 | ApStackLock:\r | |
25 | 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 | |
36 | ASM_PFX(AsmApEntryPoint) PROC PUBLIC\r | |
37 | \r | |
38 | cli\r | |
39 | AsmApEntryPointAcquireLock:\r | |
40 | lock bts dword ptr [ApStackLock], 0\r | |
41 | pause\r | |
42 | jc AsmApEntryPointAcquireLock\r | |
43 | \r | |
44 | mov rsp, [ASM_PFX(mTopOfApCommonStack)]\r | |
45 | call ASM_PFX(ApEntryPointInC)\r | |
46 | \r | |
47 | cli\r | |
48 | \r | |
49 | lock btc dword ptr [ApStackLock], 0\r | |
50 | \r | |
51 | mov eax, 100h\r | |
52 | AsmApEntryPointShareLock:\r | |
53 | pause\r | |
54 | dec eax\r | |
55 | jnz AsmApEntryPointShareLock\r | |
56 | \r | |
57 | jmp ASM_PFX(AsmApEntryPoint)\r | |
58 | \r | |
59 | ASM_PFX(AsmApEntryPoint) ENDP\r | |
60 | \r | |
61 | ;------------------------------------------------------------------------------\r | |
62 | ; VOID\r | |
63 | ; EFIAPI\r | |
64 | ; AsmApDoneWithCommonStack (\r | |
65 | ; VOID\r | |
66 | ; );\r | |
67 | ;------------------------------------------------------------------------------\r | |
68 | ASM_PFX(AsmApDoneWithCommonStack) PROC PUBLIC\r | |
69 | \r | |
70 | lock btc dword ptr [ApStackLock], 0\r | |
71 | ret\r | |
72 | \r | |
73 | ASM_PFX(AsmApDoneWithCommonStack) ENDP\r | |
74 | \r | |
75 | END\r | |
76 | \r |