Skip to content

Commit

Permalink
Ensure the I-Cache is correctly handled in arm64_icache_sync_range
Browse files Browse the repository at this point in the history
The cache_handle_range macro to handle the arm64 instruction and data
cache operations would return when it was complete. This causes problems
for arm64_icache_sync_range and arm64_icache_sync_range_checked as they
assume they can execute the i-cache handling instruction after it has been
called.

Fix this by making this assumption correct.

While here add missing instruction barriers and adjust the style to
match the rest of the assembly.

Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D18838
  • Loading branch information
zxombie committed Jan 15, 2019
1 parent 0eaad9c commit 10d58df
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sys/arm64/arm64/cpufunc_asm.S
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ __FBSDID("$FreeBSD$");
.if \ic != 0
isb
.endif
ret
.endm

ENTRY(arm64_nullop)
Expand Down Expand Up @@ -112,13 +111,15 @@ END(arm64_tlb_flushID)
*/
ENTRY(arm64_dcache_wb_range)
cache_handle_range dcop = cvac
ret
END(arm64_dcache_wb_range)

/*
* void arm64_dcache_wbinv_range(vm_offset_t, vm_size_t)
*/
ENTRY(arm64_dcache_wbinv_range)
cache_handle_range dcop = civac
ret
END(arm64_dcache_wbinv_range)

/*
Expand All @@ -129,13 +130,15 @@ END(arm64_dcache_wbinv_range)
*/
ENTRY(arm64_dcache_inv_range)
cache_handle_range dcop = ivac
ret
END(arm64_dcache_inv_range)

/*
* void arm64_idcache_wbinv_range(vm_offset_t, vm_size_t)
*/
ENTRY(arm64_idcache_wbinv_range)
cache_handle_range dcop = civac, ic = 1, icop = ivau
ret
END(arm64_idcache_wbinv_range)

/*
Expand All @@ -150,6 +153,8 @@ ENTRY(arm64_icache_sync_range)
cache_handle_range dcop = cvau
ic ialluis
dsb ish
isb
ret
END(arm64_icache_sync_range)

/*
Expand All @@ -161,7 +166,8 @@ ENTRY(arm64_icache_sync_range_checked)
/* XXX: See comment in arm64_icache_sync_range */
cache_handle_range dcop = cvau
ic ialluis
dsb ish
dsb ish
isb
SET_FAULT_HANDLER(xzr, x6)
mov x0, #0
ret
Expand Down

0 comments on commit 10d58df

Please sign in to comment.