]> git.lizzy.rs Git - rust.git/commitdiff
Interpret system call numbers relative to target architecture
authorAaron Hill <aa1ronham@gmail.com>
Tue, 9 Apr 2019 02:37:58 +0000 (22:37 -0400)
committerAaron Hill <aa1ronham@gmail.com>
Tue, 9 Apr 2019 02:37:58 +0000 (22:37 -0400)
src/fn_call.rs

index 0f1814a0c42c17790f6d15714f1e016ca375df04..94e1f11ccf79369ae8cc7cf411c01292c5be05ad 100644 (file)
@@ -216,9 +216,9 @@ fn emulate_foreign_item(
                 //
                 // `libc::syscall(NR_GETRANDOM, buf.as_mut_ptr(), buf.len(), GRND_NONBLOCK)`
                 // is called if a `HashMap` is created the regular way (e.g. HashMap<K, V>).
-                match this.read_scalar(args[0])?.to_usize(this)? as i64 {
+                match (this.read_scalar(args[0])?.to_usize(this)? as i64, tcx.data_layout.pointer_size.bits()) {
                     // SYS_getrandom on x86_64 and x86 respectively
-                    318 | 355 => {
+                    (318, 64) | (355, 32) => {
                         let ptr = this.read_scalar(args[1])?.to_ptr()?;
                         let len = this.read_scalar(args[2])?.to_usize(this)?;
 
@@ -232,7 +232,7 @@ fn emulate_foreign_item(
 
                         this.write_scalar(Scalar::from_uint(len, dest.layout.size), dest)?;
                     }
-                    id => {
+                    (id, _size) => {
                         return err!(Unimplemented(
                             format!("miri does not support syscall ID {}", id),
                         ))