]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseLib/AArch64/SwitchStack.S
MdePkg/BaseLib: Added ARM Aarch64 architecture support
[mirror_edk2.git] / MdePkg / Library / BaseLib / AArch64 / SwitchStack.S
diff --git a/MdePkg/Library/BaseLib/AArch64/SwitchStack.S b/MdePkg/Library/BaseLib/AArch64/SwitchStack.S
new file mode 100644 (file)
index 0000000..207a569
--- /dev/null
@@ -0,0 +1,68 @@
+//------------------------------------------------------------------------------\r
+//\r
+// Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+// Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
+// Portions copyright (c) 2011 - 2013, ARM Limited. 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
+.text\r
+.align 5\r
+\r
+ASM_GLOBAL ASM_PFX(InternalSwitchStackAsm)\r
+ASM_GLOBAL ASM_PFX(CpuPause)\r
+\r
+/**\r
+//\r
+//  This allows the caller to switch the stack and goes to the new entry point\r
+//\r
+// @param      EntryPoint   The pointer to the location to enter\r
+// @param      Context      Parameter to pass in\r
+// @param      Context2     Parameter2 to pass in\r
+// @param      NewStack     New Location of the stack\r
+//\r
+// @return     Nothing. Goes to the Entry Point passing in the new parameters\r
+//\r
+VOID\r
+EFIAPI\r
+InternalSwitchStackAsm (\r
+  SWITCH_STACK_ENTRY_POINT EntryPoint,\r
+  VOID  *Context,\r
+  VOID  *Context2,\r
+  VOID  *NewStack\r
+  );\r
+**/\r
+ASM_PFX(InternalSwitchStackAsm):\r
+    mov   x30, x0\r
+    mov   sp, x3\r
+    mov   x0, x1\r
+    mov   x1, x2\r
+    ret\r
+\r
+/**\r
+//\r
+//  Requests CPU to pause for a short period of time.\r
+//\r
+//  Requests CPU to pause for a short period of time. Typically used in MP\r
+//  systems to prevent memory starvation while waiting for a spin lock.\r
+//\r
+VOID\r
+EFIAPI\r
+CpuPause (\r
+  VOID\r
+  )\r
+**/\r
+ASM_PFX(CpuPause):\r
+    nop\r
+    nop\r
+    nop\r
+    nop\r
+    nop\r
+    ret\r