diff options
author | 2020-11-20 21:48:33 +0000 | |
---|---|---|
committer | 2020-11-20 21:48:33 +0000 | |
commit | 429c0bf0e4dd57d54829e413534395372b04eaf0 (patch) | |
tree | 4de90ce7d263fbe2d61edb9639326e99bca0a6b5 | |
parent | remove an unused struct (diff) | |
download | wireguard-openbsd-429c0bf0e4dd57d54829e413534395372b04eaf0.tar.xz wireguard-openbsd-429c0bf0e4dd57d54829e413534395372b04eaf0.zip |
Restructure cache flush operations to avoid repeated barriers. Specifically
restructure them so that all of the data cache operations are performed before
any instruction cache operations. Then we only need one barrier between the
data and instruction cache operations and one barrier after the instruction
cache operations.
From FreeBSD
ok kettenis@
-rw-r--r-- | sys/arch/arm64/arm64/cpufunc_asm.S | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/sys/arch/arm64/arm64/cpufunc_asm.S b/sys/arch/arm64/arm64/cpufunc_asm.S index b36dbc94465..c243f6141fd 100644 --- a/sys/arch/arm64/arm64/cpufunc_asm.S +++ b/sys/arch/arm64/arm64/cpufunc_asm.S @@ -1,4 +1,4 @@ -/* $OpenBSD: cpufunc_asm.S,v 1.6 2019/03/15 05:42:38 kevlo Exp $ */ +/* $OpenBSD: cpufunc_asm.S,v 1.7 2020/11/20 21:48:33 patrick Exp $ */ /*- * Copyright (c) 2014 Robin Randhawa * Copyright (c) 2015 The FreeBSD Foundation @@ -43,7 +43,7 @@ /* * Macro to handle the cache. This takes the start address in x0, length - * in x1. It will corrupt x0, x1, x2, and x3. + * in x1. It will corrupt x0, x1, x2, x3, and x4. */ .macro cache_handle_range dcop = 0, ic = 0, icop = 0 .if \ic == 0 @@ -56,17 +56,23 @@ and x2, x0, x4 /* Get the low bits of the address */ add x1, x1, x2 /* Add these to the size */ bic x0, x0, x4 /* Clear the low bit of the address */ -1: - dc \dcop, x0 - dsb ish .if \ic != 0 - ic \icop, x0 - dsb ish + mov x2, x0 /* Save the address */ + mov x4, x1 /* Save the size */ .endif +1: + dc \dcop, x0 add x0, x0, x3 /* Move to the next line */ subs x1, x1, x3 /* Reduce the size */ b.hi 1b /* Check if we are done */ + dsb ish .if \ic != 0 +2: + ic \icop, x2 + add x2, x2, x3 /* Move to the next line */ + subs x4, x4, x3 /* Reduce the size */ + b.hi 2b /* Check if we are done */ + dsb ish isb .endif .endm |