let [pid, cpusetsize, mask] =
this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
this.read_scalar(pid)?.to_i32()?;
- this.read_scalar(cpusetsize)?.to_machine_usize(this)?;
+ this.read_machine_usize(cpusetsize)?;
this.deref_operand(mask)?;
// FIXME: we just return an error; `num_cpus` then falls back to `sysconf`.
- let einval = this.eval_libc("EINVAL")?;
+ let einval = this.eval_libc("EINVAL");
this.set_last_error(einval)?;
this.write_scalar(Scalar::from_i32(-1), dest)?;
}
// Querying system information
"pthread_get_stackaddr_np" => {
let [thread] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
- this.read_scalar(thread)?.to_machine_usize(this)?;
+ this.read_machine_usize(thread)?;
- let stack_addr = Scalar::from_uint(STACK_ADDR, this.pointer_size());
+ let stack_addr = Scalar::from_uint(this.machine.stack_addr, this.pointer_size());
this.write_scalar(stack_addr, dest)?;
}
"pthread_get_stacksize_np" => {
let [thread] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
- this.read_scalar(thread)?.to_machine_usize(this)?;
+ this.read_machine_usize(thread)?;
- let stack_size = Scalar::from_uint(STACK_SIZE, this.pointer_size());
+ let stack_size = Scalar::from_uint(this.machine.stack_size, this.pointer_size());
this.write_scalar(stack_size, dest)?;
}
"HeapAlloc" => {
let [handle, flags, size] =
this.check_shim(abi, Abi::System { unwind: false }, link_name, args)?;
- this.read_scalar(handle)?.to_machine_isize(this)?;
+ this.read_machine_isize(handle)?;
let flags = this.read_scalar(flags)?.to_u32()?;
- let size = this.read_scalar(size)?.to_machine_usize(this)?;
+ let size = this.read_machine_usize(size)?;
- let zero_init = (flags & 0x00000008) != 0; // HEAP_ZERO_MEMORY
+ let heap_zero_memory = 0x00000008; // HEAP_ZERO_MEMORY
+ let zero_init = (flags & heap_zero_memory) == heap_zero_memory;
let res = this.malloc(size, zero_init, MiriMemoryKind::WinHeap)?;
this.write_pointer(res, dest)?;
}