Skip to content

Commit e74f2b9

Browse files
DillonbCensoredUsername
authored andcommitted
Call sys_icache_invalidate on MacOS arm64 instead of aarch64::synchronize_icache
1 parent d3446db commit e74f2b9

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

runtime/src/cache_control.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,22 @@ pub fn prepare_for_execution(slice: &[u8]) {
2525
#[inline(always)]
2626
#[allow(unused_variables)]
2727
pub fn synchronize_icache(slice: &[u8]) {
28-
#[cfg(target_arch="aarch64")]
28+
#[cfg(all(target_arch="aarch64", not(target_os="macos")))]
2929
{
3030
aarch64::synchronize_icache(slice);
3131
}
32+
#[cfg(all(target_arch="aarch64", target_os="macos"))]
33+
{
34+
extern "C" {
35+
pub fn sys_icache_invalidate(
36+
start: *const std::ffi::c_void,
37+
size: usize,
38+
);
39+
}
40+
unsafe {
41+
sys_icache_invalidate(slice.as_ptr() as *const std::ffi::c_void, slice.len());
42+
}
43+
}
3244
}
3345

3446
#[cfg(target_arch="aarch64")]

0 commit comments

Comments
 (0)