Skip to content

Commit d0d3870

Browse files
committed
GetSystemInfo
1 parent 50c6f31 commit d0d3870

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/fn_call.rs

+17
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,23 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a,
588588
// pretend these do not exist/nothing happened, by returning zero
589589
this.write_null(dest)?;
590590
},
591+
"GetSystemInfo" => {
592+
let system_info = this.deref_operand(args[0])?;
593+
let system_info_ptr = system_info.ptr.to_ptr()?;
594+
// initialize with 0
595+
this.memory_mut().get_mut(system_info_ptr.alloc_id)?
596+
.write_repeat(tcx, system_info_ptr, 0, system_info.layout.size)?;
597+
// set number of processors to 1
598+
let dword_size = Size::from_bytes(4);
599+
let offset = 2*dword_size + 3*tcx.pointer_size();
600+
this.memory_mut().get_mut(system_info_ptr.alloc_id)?
601+
.write_scalar(
602+
tcx,
603+
system_info_ptr.offset(offset, tcx)?,
604+
Scalar::from_int(1, dword_size).into(),
605+
dword_size,
606+
)?;
607+
}
591608

592609
"TlsAlloc" => {
593610
// This just creates a key; Windows does not natively support TLS dtors.

0 commit comments

Comments
 (0)