Skip to content

Commit

Permalink
Add cfg if around cheri specific code
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-fink committed Feb 26, 2024
1 parent 8c24175 commit ea54c5e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions crates/runtime/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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! {
Expand Down

0 comments on commit ea54c5e

Please sign in to comment.