Ia32/CpuAsm.asm | MSFT\r
Ia32/CpuAsm.asm | INTEL\r
Ia32/CpuAsm.S | GCC\r
+ Ia32/MpAsm.asm | MSFT\r
+ Ia32/MpAsm.asm | INTEL\r
+ Ia32/MpAsm.nasm | GCC\r
\r
[Sources.X64]\r
X64/CpuAsm.asm | MSFT\r
X64/CpuAsm.asm | INTEL\r
X64/CpuAsm.S | GCC\r
+ X64/MpAsm.asm | MSFT\r
+ X64/MpAsm.asm | INTEL\r
+ X64/MpAsm.nasm | GCC\r
\r
[Protocols]\r
gEfiCpuArchProtocolGuid ## PRODUCES\r
#include "CpuDxe.h"\r
#include "CpuMp.h"\r
\r
+VOID *mCommonStack = 0;\r
+VOID *mTopOfApCommonStack = 0;\r
+\r
+\r
/**\r
Application Processor C code entry point.\r
\r
VOID\r
);\r
\r
+/**\r
+ The AP entry point that the Startup-IPI target code will jump to.\r
+\r
+ The processor jumps to this code in flat mode, but the processor's\r
+ stack is not initialized.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+AsmApEntryPoint (\r
+ VOID\r
+ );\r
+\r
+/**\r
+ Releases the lock preventing other APs from using the shared AP\r
+ stack.\r
+\r
+ Once the AP has transitioned to using a new stack, it can call this\r
+ function to allow another AP to proceed with using the shared stack.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+AsmApDoneWithCommonStack (\r
+ VOID\r
+ );\r
+\r
#endif // _CPU_MP_H_\r
\r
--- /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
--- /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
+extern ASM_PFX(mTopOfApCommonStack)\r
+extern ASM_PFX(ApEntryPointInC)\r
+\r
+SECTION .data\r
+\r
+;\r
+; This lock only allows one AP to use the mTopOfApCommonStack stack at a time\r
+;\r
+ApStackLock:\r
+ dd 0\r
+\r
+SECTION .text\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; AsmApEntryPoint (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+global ASM_PFX(AsmApEntryPoint)\r
+ASM_PFX(AsmApEntryPoint):\r
+ cli\r
+AsmApEntryPointAcquireLock:\r
+lock bts dword [ApStackLock], 0\r
+ pause\r
+ jc AsmApEntryPointAcquireLock\r
+\r
+ mov esp, [ASM_PFX(mTopOfApCommonStack)]\r
+ call ASM_PFX(ApEntryPointInC)\r
+\r
+ cli\r
+\r
+lock btc dword [ApStackLock], 0\r
+\r
+ mov eax, 0x100\r
+AsmApEntryPointShareLock:\r
+ pause\r
+ dec eax\r
+ jnz AsmApEntryPointShareLock\r
+\r
+ jmp ASM_PFX(AsmApEntryPoint)\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; AsmApDoneWithCommonStack (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+global ASM_PFX(AsmApDoneWithCommonStack)\r
+ASM_PFX(AsmApDoneWithCommonStack):\r
+lock btc dword [ApStackLock], 0\r
+ ret\r
+\r
--- /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
+#include <Base.h>\r
+\r
+extern ASM_PFX(mTopOfApCommonStack):QWORD\r
+extern ASM_PFX(ApEntryPointInC):PROC\r
+\r
+.data\r
+\r
+;\r
+; This lock only allows one AP to use the mTopOfApCommonStack stack at a time\r
+;\r
+ApStackLock:\r
+ dd 0\r
+\r
+.code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; AsmApEntryPoint (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+ASM_PFX(AsmApEntryPoint) PROC PUBLIC\r
+\r
+ cli\r
+AsmApEntryPointAcquireLock:\r
+lock bts dword ptr [ApStackLock], 0\r
+ pause\r
+ jc AsmApEntryPointAcquireLock\r
+\r
+ mov rsp, [ASM_PFX(mTopOfApCommonStack)]\r
+ call ASM_PFX(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 ASM_PFX(AsmApEntryPoint)\r
+\r
+ASM_PFX(AsmApEntryPoint) ENDP\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; AsmApDoneWithCommonStack (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+ASM_PFX(AsmApDoneWithCommonStack) PROC PUBLIC\r
+\r
+lock btc dword ptr [ApStackLock], 0\r
+ ret\r
+\r
+ASM_PFX(AsmApDoneWithCommonStack) ENDP\r
+\r
+END\r
+\r
--- /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
+extern ASM_PFX(mTopOfApCommonStack)\r
+extern ASM_PFX(ApEntryPointInC)\r
+\r
+DEFAULT REL\r
+\r
+SECTION .data\r
+\r
+;\r
+; This lock only allows one AP to use the mTopOfApCommonStack stack at a time\r
+;\r
+ApStackLock:\r
+ dd 0\r
+\r
+SECTION .text\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; AsmApEntryPoint (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+global ASM_PFX(AsmApEntryPoint)\r
+ASM_PFX(AsmApEntryPoint):\r
+ cli\r
+AsmApEntryPointAcquireLock:\r
+lock bts dword [ApStackLock], 0\r
+ pause\r
+ jc AsmApEntryPointAcquireLock\r
+\r
+ mov rsp, [ASM_PFX(mTopOfApCommonStack)]\r
+ call ASM_PFX(ApEntryPointInC)\r
+\r
+ cli\r
+\r
+lock btc dword [ApStackLock], 0\r
+\r
+ mov eax, 0x100\r
+AsmApEntryPointShareLock:\r
+ pause\r
+ dec eax\r
+ jnz AsmApEntryPointShareLock\r
+\r
+ jmp ASM_PFX(AsmApEntryPoint)\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; AsmApDoneWithCommonStack (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+global ASM_PFX(AsmApDoneWithCommonStack)\r
+ASM_PFX(AsmApDoneWithCommonStack):\r
+lock btc dword [ApStackLock], 0\r
+ ret\r
+\r