--- /dev/null
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+; This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution. The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php.\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+.586p\r
+.model flat, C\r
+\r
+extern mTopOfApCommonStack:DWORD\r
+extern ApEntryPointInC:PROC\r
+\r
+.code\r
+\r
+;\r
+; This lock only allows one AP to use the mTopOfApCommonStack stack at a time\r
+;\r
+ApStackLock dd 0\r
+\r
+;.code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; AsmApEntryPoint (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmApEntryPoint PROC\r
+\r
+ cli\r
+AsmApEntryPointAcquireLock:\r
+lock bts dword ptr [ApStackLock], 0\r
+ pause\r
+ jc AsmApEntryPointAcquireLock\r
+\r
+ mov esp, [mTopOfApCommonStack]\r
+ call ApEntryPointInC\r
+\r
+ cli\r
+\r
+lock btc dword ptr [ApStackLock], 0\r
+\r
+ mov eax, 100h\r
+AsmApEntryPointShareLock:\r
+ pause\r
+ dec eax\r
+ jnz AsmApEntryPointShareLock\r
+\r
+ jmp AsmApEntryPoint\r
+\r
+AsmApEntryPoint ENDP\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; AsmApDoneWithCommonStack (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmApDoneWithCommonStack PROC PUBLIC\r
+\r
+lock btc dword ptr [ApStackLock], 0\r
+ ret\r
+\r
+AsmApDoneWithCommonStack ENDP\r
+\r
+END\r