diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2019-02-06 00:08:22 +0000 |
---|---|---|
committer | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2019-02-12 22:49:20 +0100 |
commit | c0959b4426b2da45cdb8146a5116bb4fd9b86534 (patch) | |
tree | 57dc77caaa640ff716fcf690b9c55979a94e90fa /MdePkg/Library/BaseLib/Arm | |
parent | 1a35dd723bbf9333a11f6397dac77f1a5dadd3c5 (diff) | |
download | edk2-c0959b4426b2da45cdb8146a5116bb4fd9b86534.tar.gz edk2-c0959b4426b2da45cdb8146a5116bb4fd9b86534.tar.bz2 edk2-c0959b4426b2da45cdb8146a5116bb4fd9b86534.zip |
MdePkg/BaseLib: implement SpeculationBarrier() for ARM and AArch64
Replace the dummy C implementation of SpeculationBarrier() with
implementations consisting of the recommended DSB SY + ISB sequence,
as recommended by ARM in the whitepaper "Cache Speculation Side-channels"
version 2.4, dated October 2018.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Diffstat (limited to 'MdePkg/Library/BaseLib/Arm')
-rw-r--r-- | MdePkg/Library/BaseLib/Arm/SpeculationBarrier.S | 39 | ||||
-rw-r--r-- | MdePkg/Library/BaseLib/Arm/SpeculationBarrier.asm | 39 | ||||
-rw-r--r-- | MdePkg/Library/BaseLib/Arm/SpeculationBarrier.c | 30 |
3 files changed, 78 insertions, 30 deletions
diff --git a/MdePkg/Library/BaseLib/Arm/SpeculationBarrier.S b/MdePkg/Library/BaseLib/Arm/SpeculationBarrier.S new file mode 100644 index 0000000000..7857558aba --- /dev/null +++ b/MdePkg/Library/BaseLib/Arm/SpeculationBarrier.S @@ -0,0 +1,39 @@ +##------------------------------------------------------------------------------
+#
+# SpeculationBarrier() for AArch64
+#
+# Copyright (c) 2019, Linaro Ltd. All rights reserved.
+#
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php.
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##------------------------------------------------------------------------------
+
+.text
+.p2align 2
+
+GCC_ASM_EXPORT(SpeculationBarrier)
+
+
+#/**
+# Uses as a barrier to stop speculative execution.
+#
+# Ensures that no later instruction will execute speculatively, until all prior
+# instructions have completed.
+#
+#**/
+#VOID
+#EFIAPI
+#SpeculationBarrier (
+# VOID
+# );
+#
+ASM_PFX(SpeculationBarrier):
+ dsb
+ isb
+ bx lr
diff --git a/MdePkg/Library/BaseLib/Arm/SpeculationBarrier.asm b/MdePkg/Library/BaseLib/Arm/SpeculationBarrier.asm new file mode 100644 index 0000000000..425cd3de9e --- /dev/null +++ b/MdePkg/Library/BaseLib/Arm/SpeculationBarrier.asm @@ -0,0 +1,39 @@ +;------------------------------------------------------------------------------
+;
+; SpeculationBarrier() for AArch64
+;
+; Copyright (c) 2019, Linaro Ltd. All rights reserved.
+;
+; This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php.
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+;------------------------------------------------------------------------------
+
+ EXPORT SpeculationBarrier
+
+ AREA MemoryBarriers, CODE, READONLY
+
+;/**
+; Uses as a barrier to stop speculative execution.
+;
+; Ensures that no later instruction will execute speculatively, until all prior
+; instructions have completed.
+;
+;**/
+;VOID
+;EFIAPI
+;SpeculationBarrier (
+; VOID
+; );
+;
+SpeculationBarrier
+ dsb
+ isb
+ bx lr
+
+ END
diff --git a/MdePkg/Library/BaseLib/Arm/SpeculationBarrier.c b/MdePkg/Library/BaseLib/Arm/SpeculationBarrier.c deleted file mode 100644 index 8a6165a102..0000000000 --- a/MdePkg/Library/BaseLib/Arm/SpeculationBarrier.c +++ /dev/null @@ -1,30 +0,0 @@ -/** @file
- SpeculationBarrier() function for ARM.
-
- Copyright (C) 2018, Intel Corporation. All rights reserved.<BR>
-
- This program and the accompanying materials are licensed and made available
- under the terms and conditions of the BSD License which accompanies this
- distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
- WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-
-/**
- Uses as a barrier to stop speculative execution.
-
- Ensures that no later instruction will execute speculatively, until all prior
- instructions have completed.
-
-**/
-VOID
-EFIAPI
-SpeculationBarrier (
- VOID
- )
-{
-}
|