1
- use crate :: machine:: Mapping ;
1
+ use crate :: machine:: { Mapping , PAGE_SIZE } ;
2
2
use crate :: shims:: unix:: fs:: EvalContextExt as _;
3
3
use crate :: * ;
4
4
use rustc_target:: abi:: { Align , Size } ;
5
5
6
- const PAGE_SIZE : u64 = 4096 ;
7
-
8
6
impl < ' mir , ' tcx : ' mir > EvalContextExt < ' mir , ' tcx > for crate :: MiriEvalContext < ' mir , ' tcx > { }
9
7
pub trait EvalContextExt < ' mir , ' tcx : ' mir > : crate :: MiriEvalContextExt < ' mir , ' tcx > {
10
8
fn mmap (
@@ -25,12 +23,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
25
23
let fd = this. read_scalar ( fd) ?. to_i32 ( ) ?;
26
24
let offset = this. read_scalar ( offset) ?. to_machine_usize ( this) ?;
27
25
28
- let print_args = || {
29
- eprintln ! (
30
- "mmap(addr: {addr}, length: {length}, prot: {prot:x}, flags: {flags:0x}, fd: {fd}, offset: {offset})"
31
- ) ;
32
- } ;
33
-
34
26
let prot_read = this. eval_libc_i32 ( "PROT_READ" ) ?;
35
27
let prot_write = this. eval_libc_i32 ( "PROT_WRITE" ) ?;
36
28
let map_private = this. eval_libc_i32 ( "MAP_PRIVATE" ) ?;
@@ -46,22 +38,18 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
46
38
}
47
39
48
40
if prot & this. eval_libc_i32 ( "PROT_EXEC" ) ? > 0 {
49
- print_args ( ) ;
50
41
throw_unsup_format ! ( "Miri does not support mapping executable pages" ) ;
51
42
}
52
43
53
44
if offset != 0 {
54
- print_args ( ) ;
55
45
throw_unsup_format ! ( "Miri does not support non-zero offsets to mmap (yet)" ) ;
56
46
}
57
47
58
48
if !this. ptr_is_null ( addr) ? {
59
- print_args ( ) ;
60
49
throw_unsup_format ! ( "Miri does not support non-null pointers to mmap" ) ;
61
50
}
62
51
63
52
if length == 0 {
64
- print_args ( ) ;
65
53
this. set_last_error ( Scalar :: from_i32 ( this. eval_libc_i32 ( "EINVAL" ) ?) ) ?;
66
54
return Ok ( Pointer :: null ( ) ) ;
67
55
}
0 commit comments