shims: add FIXME for missing direct tests
This commit is contained in:
parent
255b483f2e
commit
c367dfde69
8 changed files with 81 additions and 1 deletions
|
|
@ -28,21 +28,25 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
match link_name.as_str() {
|
||||
// File related shims
|
||||
"stat" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [path, buf] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
let result = this.stat(path, buf)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"lstat" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [path, buf] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
let result = this.lstat(path, buf)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"readdir" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [dirp] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
let result = this.readdir64("dirent", dirp)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"pread64" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [fd, buf, count, offset] = this.check_shim_sig(
|
||||
shim_sig!(extern "C" fn(i32, *mut _, usize, libc::off64_t) -> isize),
|
||||
link_name,
|
||||
|
|
@ -56,6 +60,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.read(fd, buf, count, Some(offset), dest)?;
|
||||
}
|
||||
"pwrite64" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [fd, buf, n, offset] = this.check_shim_sig(
|
||||
shim_sig!(extern "C" fn(i32, *const _, usize, libc::off64_t) -> isize),
|
||||
link_name,
|
||||
|
|
@ -70,6 +75,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write(fd, buf, count, Some(offset), dest)?;
|
||||
}
|
||||
"lseek64" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [fd, offset, whence] = this.check_shim_sig(
|
||||
shim_sig!(extern "C" fn(i32, libc::off64_t, i32) -> libc::off64_t),
|
||||
link_name,
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"getcwd" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [buf, size] = this.check_shim_sig(
|
||||
shim_sig!(extern "C" fn(*mut _, usize) -> *mut _),
|
||||
link_name,
|
||||
|
|
@ -153,6 +154,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_pointer(result, dest)?;
|
||||
}
|
||||
"chdir" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [path] = this.check_shim_sig(
|
||||
shim_sig!(extern "C" fn(*const _) -> i32),
|
||||
link_name,
|
||||
|
|
@ -209,6 +211,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write(fd, buf, count, None, dest)?;
|
||||
}
|
||||
"pread" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [fd, buf, count, offset] = this.check_shim_sig(
|
||||
shim_sig!(extern "C" fn(i32, *mut _, usize, libc::off_t) -> isize),
|
||||
link_name,
|
||||
|
|
@ -222,6 +225,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.read(fd, buf, count, Some(offset), dest)?;
|
||||
}
|
||||
"pwrite" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [fd, buf, n, offset] = this.check_shim_sig(
|
||||
shim_sig!(extern "C" fn(i32, *const _, usize, libc::off_t) -> isize),
|
||||
link_name,
|
||||
|
|
@ -299,6 +303,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"unlink" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [path] = this.check_shim_sig(
|
||||
shim_sig!(extern "C" fn(*const _) -> i32),
|
||||
link_name,
|
||||
|
|
@ -309,6 +314,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"symlink" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [target, linkpath] = this.check_shim_sig(
|
||||
shim_sig!(extern "C" fn(*const _, *const _) -> i32),
|
||||
link_name,
|
||||
|
|
@ -324,6 +330,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"rename" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [oldpath, newpath] = this.check_shim_sig(
|
||||
shim_sig!(extern "C" fn(*const _, *const _) -> i32),
|
||||
link_name,
|
||||
|
|
@ -334,6 +341,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"mkdir" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [path, mode] = this.check_shim_sig(
|
||||
shim_sig!(extern "C" fn(*const _, libc::mode_t) -> i32),
|
||||
link_name,
|
||||
|
|
@ -344,6 +352,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"rmdir" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [path] = this.check_shim_sig(
|
||||
shim_sig!(extern "C" fn(*const _) -> i32),
|
||||
link_name,
|
||||
|
|
@ -354,6 +363,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"opendir" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [name] = this.check_shim_sig(
|
||||
shim_sig!(extern "C" fn(*const _) -> *mut _),
|
||||
link_name,
|
||||
|
|
@ -364,6 +374,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"closedir" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [dirp] = this.check_shim_sig(
|
||||
shim_sig!(extern "C" fn(*mut _) -> i32),
|
||||
link_name,
|
||||
|
|
@ -374,6 +385,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"lseek" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [fd, offset, whence] = this.check_shim_sig(
|
||||
shim_sig!(extern "C" fn(i32, libc::off_t, i32) -> libc::off_t),
|
||||
link_name,
|
||||
|
|
@ -398,6 +410,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"fsync" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [fd] = this.check_shim_sig(
|
||||
shim_sig!(extern "C" fn(i32) -> i32),
|
||||
link_name,
|
||||
|
|
@ -408,6 +421,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"fdatasync" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [fd] = this.check_shim_sig(
|
||||
shim_sig!(extern "C" fn(i32) -> i32),
|
||||
link_name,
|
||||
|
|
@ -659,6 +673,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_null(dest)?;
|
||||
}
|
||||
"pthread_key_delete" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [key] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
let key = this.read_scalar(key)?.to_bits(key.layout.size)?;
|
||||
this.machine.tls.delete_tls_key(key)?;
|
||||
|
|
@ -666,6 +681,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_null(dest)?;
|
||||
}
|
||||
"pthread_getspecific" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [key] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
let key = this.read_scalar(key)?.to_bits(key.layout.size)?;
|
||||
let active_thread = this.active_thread();
|
||||
|
|
@ -673,6 +689,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(ptr, dest)?;
|
||||
}
|
||||
"pthread_setspecific" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [key, new_ptr] =
|
||||
this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
let key = this.read_scalar(key)?.to_bits(key.layout.size)?;
|
||||
|
|
@ -833,6 +850,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(res, dest)?;
|
||||
}
|
||||
"sched_yield" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
this.sched_yield()?;
|
||||
this.write_null(dest)?;
|
||||
|
|
@ -941,6 +959,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"pthread_atfork" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [prepare, parent, child] =
|
||||
this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
this.read_pointer(prepare)?;
|
||||
|
|
|
|||
|
|
@ -139,11 +139,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
// For those, we both intercept `func` and `call@FBSD_1.0` symbols cases
|
||||
// since freebsd 12 the former form can be expected.
|
||||
"stat" | "stat@FBSD_1.0" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [path, buf] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
let result = this.stat(path, buf)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"lstat" | "lstat@FBSD_1.0" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [path, buf] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
let result = this.lstat(path, buf)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
|
|
@ -154,6 +156,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"readdir" | "readdir@FBSD_1.0" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [dirp] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
let result = this.readdir64("dirent", dirp)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"pread64" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [fd, buf, count, offset] = this.check_shim_sig(
|
||||
shim_sig!(extern "C" fn(i32, *mut _, usize, libc::off64_t) -> isize),
|
||||
link_name,
|
||||
|
|
@ -58,6 +59,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.read(fd, buf, count, Some(offset), dest)?;
|
||||
}
|
||||
"pwrite64" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [fd, buf, n, offset] = this.check_shim_sig(
|
||||
shim_sig!(extern "C" fn(i32, *const _, usize, libc::off64_t) -> isize),
|
||||
link_name,
|
||||
|
|
@ -72,6 +74,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write(fd, buf, count, Some(offset), dest)?;
|
||||
}
|
||||
"lseek64" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [fd, offset, whence] = this.check_shim_sig(
|
||||
shim_sig!(extern "C" fn(i32, libc::off64_t, i32) -> libc::off64_t),
|
||||
link_name,
|
||||
|
|
@ -111,6 +114,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"readdir64" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [dirp] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
let result = this.readdir64("dirent64", dirp)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
|
|
@ -122,6 +126,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"statx" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [dirfd, pathname, flags, mask, statxbuf] =
|
||||
this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
let result = this.linux_statx(dirfd, pathname, flags, mask, statxbuf)?;
|
||||
|
|
|
|||
|
|
@ -47,11 +47,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"stat" | "stat$INODE64" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [path, buf] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
let result = this.stat(path, buf)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"lstat" | "lstat$INODE64" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [path, buf] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
let result = this.lstat(path, buf)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
|
|
@ -62,11 +64,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"opendir$INODE64" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [name] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
let result = this.opendir(name)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"readdir_r" | "readdir_r$INODE64" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [dirp, entry, result] =
|
||||
this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
let result = this.macos_readdir_r(dirp, entry, result)?;
|
||||
|
|
@ -87,6 +91,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
|
||||
// Environment related shims
|
||||
"_NSGetEnviron" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
let environ = this.machine.env_vars.unix().environ();
|
||||
this.write_pointer(environ, dest)?;
|
||||
|
|
@ -111,6 +116,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
}
|
||||
|
||||
"mach_timebase_info" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [info] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
let result = this.mach_timebase_info(info)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
|
|
@ -118,14 +124,17 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
|
||||
// Access to command-line arguments
|
||||
"_NSGetArgc" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
this.write_pointer(this.machine.argc.expect("machine must be initialized"), dest)?;
|
||||
}
|
||||
"_NSGetArgv" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
this.write_pointer(this.machine.argv.expect("machine must be initialized"), dest)?;
|
||||
}
|
||||
"_NSGetExecutablePath" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [buf, bufsize] =
|
||||
this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
this.check_no_isolation("`_NSGetExecutablePath`")?;
|
||||
|
|
@ -168,12 +177,14 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
|
||||
// Querying system information
|
||||
"pthread_get_stackaddr_np" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [thread] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
this.read_target_usize(thread)?;
|
||||
let stack_addr = Scalar::from_uint(this.machine.stack_addr, this.pointer_size());
|
||||
this.write_scalar(stack_addr, dest)?;
|
||||
}
|
||||
"pthread_get_stacksize_np" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [thread] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
this.read_target_usize(thread)?;
|
||||
let stack_size = Scalar::from_uint(this.machine.stack_size, this.pointer_size());
|
||||
|
|
|
|||
|
|
@ -91,16 +91,19 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
|
||||
// File related shims
|
||||
"stat" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [path, buf] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
let result = this.stat(path, buf)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"lstat" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [path, buf] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
let result = this.lstat(path, buf)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"readdir" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [dirp] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
let result = this.readdir64("dirent", dirp)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
|
|
@ -122,6 +125,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
}
|
||||
|
||||
"stack_getbounds" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [stack] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
let stack = this.deref_pointer_as(stack, this.libc_ty_layout("stack_t"))?;
|
||||
|
||||
|
|
@ -140,6 +144,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
}
|
||||
|
||||
"pset_info" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [pset, tpe, cpus, list] =
|
||||
this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
|
||||
// We do not need to handle the current process cpu mask, available_parallelism
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
match link_name.as_str() {
|
||||
// Environment related shims
|
||||
"GetEnvironmentVariableW" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [name, buf, size] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(*const _, *mut _, u32) -> u32),
|
||||
link_name,
|
||||
|
|
@ -158,6 +159,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"SetEnvironmentVariableW" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [name, value] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(*const _, *const _) -> winapi::BOOL),
|
||||
link_name,
|
||||
|
|
@ -168,6 +170,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"GetEnvironmentStringsW" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn() -> *mut _),
|
||||
link_name,
|
||||
|
|
@ -178,6 +181,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_pointer(result, dest)?;
|
||||
}
|
||||
"FreeEnvironmentStringsW" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [env_block] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(*mut _) -> winapi::BOOL),
|
||||
link_name,
|
||||
|
|
@ -188,6 +192,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"GetCurrentDirectoryW" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [size, buf] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(u32, *mut _) -> u32),
|
||||
link_name,
|
||||
|
|
@ -198,6 +203,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"SetCurrentDirectoryW" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [path] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(*const _) -> winapi::BOOL),
|
||||
link_name,
|
||||
|
|
@ -208,6 +214,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"GetUserProfileDirectoryW" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [token, buf, size] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(winapi::HANDLE, *mut _, *mut _) -> winapi::BOOL),
|
||||
link_name,
|
||||
|
|
@ -218,6 +225,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"GetCurrentProcessId" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn() -> u32),
|
||||
link_name,
|
||||
|
|
@ -314,6 +322,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
)?;
|
||||
}
|
||||
"GetFullPathNameW" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [filename, size, buffer, filepart] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(*const _, u32, *mut _, *mut _) -> u32),
|
||||
link_name,
|
||||
|
|
@ -445,6 +454,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
|
||||
// Allocation
|
||||
"HeapAlloc" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [handle, flags, size] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(winapi::HANDLE, u32, usize) -> *mut _),
|
||||
link_name,
|
||||
|
|
@ -472,6 +482,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_pointer(ptr, dest)?;
|
||||
}
|
||||
"HeapFree" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [handle, flags, ptr] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(winapi::HANDLE, u32, *mut _) -> winapi::BOOL),
|
||||
link_name,
|
||||
|
|
@ -489,6 +500,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(Scalar::from_i32(1), dest)?;
|
||||
}
|
||||
"HeapReAlloc" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [handle, flags, old_ptr, size] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(winapi::HANDLE, u32, *mut _, usize) -> *mut _),
|
||||
link_name,
|
||||
|
|
@ -514,6 +526,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_pointer(new_ptr, dest)?;
|
||||
}
|
||||
"LocalFree" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [ptr] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(winapi::HLOCAL) -> winapi::HLOCAL),
|
||||
link_name,
|
||||
|
|
@ -577,6 +590,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
|
||||
// Querying system information
|
||||
"GetSystemInfo" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
// Also called from `page_size` crate.
|
||||
let [system_info] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(*mut _) -> ()),
|
||||
|
|
@ -658,6 +672,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
|
||||
// Access to command-line arguments
|
||||
"GetCommandLineW" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn() -> *mut _),
|
||||
link_name,
|
||||
|
|
@ -672,6 +687,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
|
||||
// Time related shims
|
||||
"GetSystemTimeAsFileTime" | "GetSystemTimePreciseAsFileTime" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [filetime] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(*mut _) -> ()),
|
||||
link_name,
|
||||
|
|
@ -681,6 +697,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.GetSystemTimeAsFileTime(link_name.as_str(), filetime)?;
|
||||
}
|
||||
"QueryPerformanceCounter" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [performance_count] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(*mut _) -> winapi::BOOL),
|
||||
link_name,
|
||||
|
|
@ -691,6 +708,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"QueryPerformanceFrequency" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [frequency] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(*mut _) -> winapi::BOOL),
|
||||
link_name,
|
||||
|
|
@ -701,6 +719,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"Sleep" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [timeout] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(u32) -> ()),
|
||||
link_name,
|
||||
|
|
@ -711,6 +730,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.Sleep(timeout)?;
|
||||
}
|
||||
"CreateWaitableTimerExW" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [attributes, name, flags, access] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(*mut _, *const _, u32, u32) -> winapi::HANDLE),
|
||||
link_name,
|
||||
|
|
@ -748,6 +768,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"WaitOnAddress" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [ptr_op, compare_op, size_op, timeout_op] = this.check_shim_sig(
|
||||
// First pointer is volatile
|
||||
shim_sig!(extern "system" fn(*mut _, *mut _, usize, u32) -> winapi::BOOL),
|
||||
|
|
@ -759,6 +780,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.WaitOnAddress(ptr_op, compare_op, size_op, timeout_op, dest)?;
|
||||
}
|
||||
"WakeByAddressSingle" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [ptr_op] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(*mut _) -> ()),
|
||||
link_name,
|
||||
|
|
@ -769,6 +791,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.WakeByAddressSingle(ptr_op)?;
|
||||
}
|
||||
"WakeByAddressAll" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [ptr_op] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(*mut _) -> ()),
|
||||
link_name,
|
||||
|
|
@ -781,6 +804,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
|
||||
// Dynamic symbol loading
|
||||
"GetProcAddress" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [module, proc_name] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(winapi::HMODULE, *const _) -> winapi::FARPROC),
|
||||
link_name,
|
||||
|
|
@ -936,6 +960,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
|
||||
// Miscellaneous
|
||||
"ExitProcess" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [code] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(u32) -> ()),
|
||||
link_name,
|
||||
|
|
@ -962,6 +987,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(Scalar::from_bool(true), dest)?;
|
||||
}
|
||||
"ProcessPrng" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
// used by `std`
|
||||
let [ptr, len] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(*mut _, usize) -> winapi::BOOL),
|
||||
|
|
@ -1014,6 +1040,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_null(dest)?; // STATUS_SUCCESS
|
||||
}
|
||||
"GetConsoleScreenBufferInfo" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
// `term` needs this, so we fake it.
|
||||
let [console, buffer_info] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(winapi::HANDLE, *mut _) -> winapi::BOOL),
|
||||
|
|
@ -1029,6 +1056,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_null(dest)?;
|
||||
}
|
||||
"GetStdHandle" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [which] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(u32) -> winapi::HANDLE),
|
||||
link_name,
|
||||
|
|
@ -1080,6 +1108,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_scalar(ret, dest)?;
|
||||
}
|
||||
"GetModuleFileNameW" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [handle, filename, size] = this.check_shim_sig(
|
||||
shim_sig!(extern "system" fn(winapi::HMODULE, *mut _, u32) -> u32),
|
||||
link_name,
|
||||
|
|
@ -1118,6 +1147,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
}
|
||||
}
|
||||
"FormatMessageW" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
let [flags, module, message_id, language_id, buffer, size, arguments] = this
|
||||
.check_shim_sig(
|
||||
shim_sig!(
|
||||
|
|
@ -1159,6 +1189,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
}
|
||||
|
||||
"_Unwind_RaiseException" => {
|
||||
// FIXME: This does not have a direct test (#3179).
|
||||
// This is not formally part of POSIX, but it is very wide-spread on POSIX systems.
|
||||
// It was originally specified as part of the Itanium C++ ABI:
|
||||
// https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html#base-throw.
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use windows_sys::Win32::System::Threading::{INFINITE, WaitForSingleObject};
|
|||
|
||||
// XXX HACK: This is how miri represents the handle for thread 0.
|
||||
// This value can be "legitimately" obtained by using `GetCurrentThread` with `DuplicateHandle`
|
||||
// but miri does not implement `DuplicateHandle` yet.
|
||||
// but miri does not implement `DuplicateHandle` yet. (FIXME: it does now.)
|
||||
const MAIN_THREAD: HANDLE = (2i32 << 29) as HANDLE;
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue