arm64: Implement array_index_mask_nospec()
authorRobin Murphy <robin.murphy@arm.com>
Mon, 5 Feb 2018 15:34:17 +0000 (15:34 +0000)
committerHaibo Chen <haibo.chen@nxp.com>
Thu, 12 Apr 2018 10:46:17 +0000 (18:46 +0800)
commit5a400a878f204fe7d037a2df4fabb080a61a078c
tree1914f2f2c868b37667e137cdaf2efe25ddd26ae5
parentd819a8ed63c2178d98c6051eff2ca0076a954cb9
arm64: Implement array_index_mask_nospec()

commit 022620eed3d0 upstream.

Provide an optimised, assembly implementation of array_index_mask_nospec()
for arm64 so that the compiler is not in a position to transform the code
in ways which affect its ability to inhibit speculation (e.g. by introducing
conditional branches).

This is similar to the sequence used by x86, modulo architectural differences
in the carry/borrow flags.

Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Alex Shi <alex.shi@linaro.org>
arch/arm64/include/asm/barrier.h