Skip to content

Commit 32c2df8

Browse files
committed
Add support for the volatile_set_memory intrinsic
Runtime behaviour and soundness requirements are identical to `write_bytes`.
1 parent 19691b2 commit 32c2df8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/shims/intrinsics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
6666
this.copy_op(dest, &place.into())?;
6767
}
6868

69-
"write_bytes" => {
69+
"write_bytes" | "volatile_set_memory" => {
7070
let &[ref ptr, ref val_byte, ref count] = check_arg_count(args)?;
7171
let ty = instance.substs.type_at(0);
7272
let ty_layout = this.layout_of(ty)?;
7373
let val_byte = this.read_scalar(val_byte)?.to_u8()?;
7474
let ptr = this.read_pointer(ptr)?;
7575
let count = this.read_scalar(count)?.to_machine_usize(this)?;
7676
let byte_count = ty_layout.size.checked_mul(count, this).ok_or_else(|| {
77-
err_ub_format!("overflow computing total size of `write_bytes`")
77+
err_ub_format!("overflow computing total size of `{}`", intrinsic_name)
7878
})?;
7979
this.memory
8080
.write_bytes(ptr, iter::repeat(val_byte).take(byte_count.bytes() as usize))?;

0 commit comments

Comments
 (0)