diff --git a/crates/runtime/src/instance.rs b/crates/runtime/src/instance.rs index b7e26e4924da..32601e3bae5d 100644 --- a/crates/runtime/src/instance.rs +++ b/crates/runtime/src/instance.rs @@ -344,10 +344,14 @@ impl Instance { } unsafe fn write_defined_memory(&self, mem_ptr: *mut VMMemoryDefinition, mem: VMMemoryDefinition) { - // First we write the whole thing. If we are on cheri, we then need to write the capability - // carrying pointer using inline assembly - let base = mem.base; - let current_length = mem.current_length.load(Ordering::Acquire); + cfg_if::cfg_if! { + if #[cfg(all(target_arch = "aarch64", feature = "cheri"))] { + // First we write the whole thing. If we are on cheri, we then need to write the capability + // carrying pointer using inline assembly + let base = mem.base; + let current_length = mem.current_length.load(Ordering::Acquire); + } + } ptr::write(mem_ptr, mem); cfg_if::cfg_if! {