]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add Memory fence for ARM Architecture (32 and 64 bit)
authorOlivier Martin <olivier.martin@arm.com>
Mon, 2 Sep 2013 09:02:16 +0000 (09:02 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 2 Sep 2013 09:02:16 +0000 (09:02 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14615 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Library/BaseLib/AArch64/MemoryFence.S [new file with mode: 0644]
MdePkg/Library/BaseLib/Arm/MemoryFence.S [new file with mode: 0644]
MdePkg/Library/BaseLib/Arm/MemoryFence.asm [new file with mode: 0644]
MdePkg/Library/BaseLib/BaseLib.inf

diff --git a/MdePkg/Library/BaseLib/AArch64/MemoryFence.S b/MdePkg/Library/BaseLib/AArch64/MemoryFence.S
new file mode 100644 (file)
index 0000000..5c69e08
--- /dev/null
@@ -0,0 +1,39 @@
+##------------------------------------------------------------------------------\r
+#\r
+# MemoryFence() for AArch64\r
+#\r
+# Copyright (c) 2013, ARM Ltd. All rights reserved.\r
+#\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
+.p2align 2\r
+\r
+GCC_ASM_EXPORT(MemoryFence)\r
+\r
+\r
+#/**\r
+#  Used to serialize load and store operations.\r
+#\r
+#  All loads and stores that proceed calls to this function are guaranteed to be\r
+#  globally visible when this function returns.\r
+#\r
+#**/\r
+#VOID\r
+#EFIAPI\r
+#MemoryFence (\r
+#  VOID\r
+#  );\r
+#\r
+ASM_PFX(MemoryFence):\r
+    // System wide Data Memory Barrier.\r
+    dmb sy\r
+    ret\r
diff --git a/MdePkg/Library/BaseLib/Arm/MemoryFence.S b/MdePkg/Library/BaseLib/Arm/MemoryFence.S
new file mode 100644 (file)
index 0000000..a2284ba
--- /dev/null
@@ -0,0 +1,39 @@
+##------------------------------------------------------------------------------\r
+#\r
+# MemoryFence() for AArch64\r
+#\r
+# Copyright (c) 2013, ARM Ltd. All rights reserved.\r
+#\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
+.p2align 2\r
+\r
+GCC_ASM_EXPORT(MemoryFence)\r
+\r
+\r
+#/**\r
+#  Used to serialize load and store operations.\r
+#\r
+#  All loads and stores that proceed calls to this function are guaranteed to be\r
+#  globally visible when this function returns.\r
+#\r
+#**/\r
+#VOID\r
+#EFIAPI\r
+#MemoryFence (\r
+#  VOID\r
+#  );\r
+#\r
+ASM_PFX(MemoryFence):\r
+    // System wide Data Memory Barrier.\r
+    dmb\r
+    bx   lr\r
diff --git a/MdePkg/Library/BaseLib/Arm/MemoryFence.asm b/MdePkg/Library/BaseLib/Arm/MemoryFence.asm
new file mode 100644 (file)
index 0000000..8f3d05f
--- /dev/null
@@ -0,0 +1,39 @@
+;------------------------------------------------------------------------------\r
+;\r
+; MemoryFence() for AArch64\r
+;\r
+; Copyright (c) 2013, ARM Ltd. All rights reserved.\r
+;\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
+    EXPORT MemoryFence\r
+\r
+    AREA MemoryBarriers, CODE, READONLY\r
+\r
+;/**\r
+;  Used to serialize load and store operations.\r
+;\r
+;  All loads and stores that proceed calls to this function are guaranteed to be\r
+;  globally visible when this function returns.\r
+;\r
+;**/\r
+;VOID\r
+;EFIAPI\r
+;MemoryFence (\r
+;  VOID\r
+;  );\r
+;\r
+MemoryFence FUNCTION\r
+    dmb\r
+    bx      lr\r
+    ENDFUNC\r
+\r
+    END\r
index 3e47b55d19877f3d338646fd7104310e70628831..d431ff0c0e40a52b3a823f6abd4928d34ae2b05c 100644 (file)
   Arm/GetInterruptsState.asm | RVCT\r
   Arm/CpuPause.asm           | RVCT\r
   Arm/CpuBreakpoint.asm      | RVCT\r
+  Arm/MemoryFence.asm        | RVCT\r
  \r
   Arm/Math64.S                  | GCC\r
   Arm/SwitchStack.S             | GCC\r
   Arm/GetInterruptsState.S      | GCC\r
   Arm/SetJumpLongJump.S         | GCC\r
   Arm/CpuBreakpoint.S           | GCC\r
+  Arm/MemoryFence.S             | GCC\r
 \r
 [Sources.AARCH64]\r
   Arm/InternalSwitchStack.c\r
   Arm/Unaligned.c\r
   Math64.c\r
 \r
+  AArch64/MemoryFence.S             | GCC\r
   AArch64/SwitchStack.S             | GCC\r
   AArch64/EnableInterrupts.S        | GCC\r
   AArch64/DisableInterrupts.S       | GCC\r