Skip to content

Commit ef8410c

Browse files
wakabatCensoredUsername
authored andcommitted
Fix so all cache control functions only exist for RISC-V on unix
1 parent f9a0067 commit ef8410c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

runtime/src/cache_control.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub fn prepare_for_execution(slice: &[u8]) {
1313
{
1414
aarch64::prepare_for_execution()
1515
}
16-
#[cfg(any(target_arch="riscv64", target_arch="riscv32"))]
16+
#[cfg(all(unix, any(target_arch="riscv64", target_arch="riscv32")))]
1717
{
1818
riscv::enforce_ordering_dcache_icache(slice, true);
1919
}
@@ -165,7 +165,7 @@ mod aarch64 {
165165
}
166166
}
167167

168-
#[cfg(any(target_arch="riscv64", target_arch="riscv32"))]
168+
#[cfg(all(unix, any(target_arch="riscv64", target_arch="riscv32")))]
169169
mod riscv {
170170
// On risc-v, the story about how we synchronize caches is confused.
171171
// The data sheet states that we ought to do the following.
@@ -185,7 +185,6 @@ mod riscv {
185185
// we have.
186186
use std::ffi::{c_void, c_long, c_int};
187187

188-
#[cfg(unix)]
189188
extern "C" {
190189
#[link_name="__riscv_flush_icache"]
191190
fn riscv_flush_icache(start: *const c_void, end: *const c_void, flags: c_long) -> c_int;

0 commit comments

Comments
 (0)