Skip to content

Commit 5f99764

Browse files
committed
Interpret system call numbers relative to target architecture
1 parent 858e82b commit 5f99764

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/fn_call.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
216216
//
217217
// `libc::syscall(NR_GETRANDOM, buf.as_mut_ptr(), buf.len(), GRND_NONBLOCK)`
218218
// is called if a `HashMap` is created the regular way (e.g. HashMap<K, V>).
219-
match this.read_scalar(args[0])?.to_usize(this)? as i64 {
219+
match (this.read_scalar(args[0])?.to_usize(this)? as i64, tcx.data_layout.pointer_size.bits()) {
220220
// SYS_getrandom on x86_64 and x86 respectively
221-
318 | 355 => {
221+
(318, 64) | (355, 32) => {
222222
let ptr = this.read_scalar(args[1])?.to_ptr()?;
223223
let len = this.read_scalar(args[2])?.to_usize(this)?;
224224

@@ -232,7 +232,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
232232

233233
this.write_scalar(Scalar::from_uint(len, dest.layout.size), dest)?;
234234
}
235-
id => {
235+
(id, _size) => {
236236
return err!(Unimplemented(
237237
format!("miri does not support syscall ID {}", id),
238238
))

0 commit comments

Comments
 (0)