@@ -29,34 +29,20 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
29
29
// See `fn emulate_foreign_item_inner` in `shims/foreign_items.rs` for the general pattern.
30
30
31
31
match link_name. as_str ( ) {
32
- // errno
33
- "__errno_location" => {
34
- let [ ] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
35
- let errno_place = this. last_error_place ( ) ?;
36
- this. write_scalar ( errno_place. to_ref ( this) . to_scalar ( ) , dest) ?;
37
- }
38
-
39
32
// File related shims (but also see "syscall" below for statx)
40
33
"readdir64" => {
41
34
let [ dirp] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
42
35
let result = this. linux_readdir64 ( dirp) ?;
43
36
this. write_scalar ( result, dest) ?;
44
37
}
45
- "mmap64" => {
46
- let [ addr, length, prot, flags, fd, offset] =
47
- this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
48
- let offset = this. read_scalar ( offset) ?. to_i64 ( ) ?;
49
- let ptr = this. mmap ( addr, length, prot, flags, fd, offset. into ( ) ) ?;
50
- this. write_scalar ( ptr, dest) ?;
51
- }
52
-
53
- // Linux-only
54
38
"sync_file_range" => {
55
39
let [ fd, offset, nbytes, flags] =
56
40
this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
57
41
let result = this. sync_file_range ( fd, offset, nbytes, flags) ?;
58
42
this. write_scalar ( result, dest) ?;
59
43
}
44
+
45
+ // epoll, eventfd
60
46
"epoll_create1" => {
61
47
let [ flag] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
62
48
let result = this. epoll_create1 ( flag) ?;
@@ -80,29 +66,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
80
66
let result = this. eventfd ( val, flag) ?;
81
67
this. write_scalar ( result, dest) ?;
82
68
}
83
- "mremap" => {
84
- let [ old_address, old_size, new_size, flags] =
85
- this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
86
- let ptr = this. mremap ( old_address, old_size, new_size, flags) ?;
87
- this. write_scalar ( ptr, dest) ?;
88
- }
89
- "socketpair" => {
90
- let [ domain, type_, protocol, sv] =
91
- this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
92
-
93
- let result = this. socketpair ( domain, type_, protocol, sv) ?;
94
- this. write_scalar ( result, dest) ?;
95
- }
96
- "__libc_current_sigrtmin" => {
97
- let [ ] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
98
-
99
- this. write_scalar ( Scalar :: from_i32 ( SIGRTMIN ) , dest) ?;
100
- }
101
- "__libc_current_sigrtmax" => {
102
- let [ ] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
103
-
104
- this. write_scalar ( Scalar :: from_i32 ( SIGRTMAX ) , dest) ?;
105
- }
106
69
107
70
// Threading
108
71
"pthread_condattr_setclock" => {
@@ -204,6 +167,34 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
204
167
this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
205
168
getrandom ( this, ptr, len, flags, dest) ?;
206
169
}
170
+ "mmap64" => {
171
+ let [ addr, length, prot, flags, fd, offset] =
172
+ this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
173
+ let offset = this. read_scalar ( offset) ?. to_i64 ( ) ?;
174
+ let ptr = this. mmap ( addr, length, prot, flags, fd, offset. into ( ) ) ?;
175
+ this. write_scalar ( ptr, dest) ?;
176
+ }
177
+ "mremap" => {
178
+ let [ old_address, old_size, new_size, flags] =
179
+ this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
180
+ let ptr = this. mremap ( old_address, old_size, new_size, flags) ?;
181
+ this. write_scalar ( ptr, dest) ?;
182
+ }
183
+ "__errno_location" => {
184
+ let [ ] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
185
+ let errno_place = this. last_error_place ( ) ?;
186
+ this. write_scalar ( errno_place. to_ref ( this) . to_scalar ( ) , dest) ?;
187
+ }
188
+ "__libc_current_sigrtmin" => {
189
+ let [ ] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
190
+
191
+ this. write_scalar ( Scalar :: from_i32 ( SIGRTMIN ) , dest) ?;
192
+ }
193
+ "__libc_current_sigrtmax" => {
194
+ let [ ] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
195
+
196
+ this. write_scalar ( Scalar :: from_i32 ( SIGRTMAX ) , dest) ?;
197
+ }
207
198
208
199
// Incomplete shims that we "stub out" just to get pre-main initialization code to work.
209
200
// These shims are enabled only when the caller is in the standard library.
0 commit comments