-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> Reviewed-by: Liming Gao <[email protected]> Reviewed-by: Leif Lindholm <[email protected]>
- Loading branch information
Ard Biesheuvel
committed
Feb 12, 2019
1 parent
1a35dd7
commit c0959b4
Showing
6 changed files
with
160 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 sy | ||
isb | ||
ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
;------------------------------------------------------------------------------ | ||
; | ||
; 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 BaseLib_LowLevel, 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 sy | ||
isb | ||
ret | ||
|
||
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters