@@ -29,34 +29,20 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
2929 // See `fn emulate_foreign_item_inner` in `shims/foreign_items.rs` for the general pattern.
3030
3131 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-
3932 // File related shims (but also see "syscall" below for statx)
4033 "readdir64" => {
4134 let [ dirp] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
4235 let result = this. linux_readdir64 ( dirp) ?;
4336 this. write_scalar ( result, dest) ?;
4437 }
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
5438 "sync_file_range" => {
5539 let [ fd, offset, nbytes, flags] =
5640 this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
5741 let result = this. sync_file_range ( fd, offset, nbytes, flags) ?;
5842 this. write_scalar ( result, dest) ?;
5943 }
44+
45+ // epoll, eventfd
6046 "epoll_create1" => {
6147 let [ flag] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
6248 let result = this. epoll_create1 ( flag) ?;
@@ -80,29 +66,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
8066 let result = this. eventfd ( val, flag) ?;
8167 this. write_scalar ( result, dest) ?;
8268 }
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- }
10669
10770 // Threading
10871 "pthread_condattr_setclock" => {
@@ -204,6 +167,34 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
204167 this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
205168 getrandom ( this, ptr, len, flags, dest) ?;
206169 }
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+ }
207198
208199 // Incomplete shims that we "stub out" just to get pre-main initialization code to work.
209200 // These shims are enabled only when the caller is in the standard library.
0 commit comments