From d0d38706fa6877bc8bd9468c7e98841fc148365d Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 19 Dec 2018 14:34:23 +0100 Subject: [PATCH] GetSystemInfo --- src/fn_call.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/fn_call.rs b/src/fn_call.rs index 5ee094bbf8..16d18dbfe6 100644 --- a/src/fn_call.rs +++ b/src/fn_call.rs @@ -588,6 +588,23 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a, // pretend these do not exist/nothing happened, by returning zero this.write_null(dest)?; }, + "GetSystemInfo" => { + let system_info = this.deref_operand(args[0])?; + let system_info_ptr = system_info.ptr.to_ptr()?; + // initialize with 0 + this.memory_mut().get_mut(system_info_ptr.alloc_id)? + .write_repeat(tcx, system_info_ptr, 0, system_info.layout.size)?; + // set number of processors to 1 + let dword_size = Size::from_bytes(4); + let offset = 2*dword_size + 3*tcx.pointer_size(); + this.memory_mut().get_mut(system_info_ptr.alloc_id)? + .write_scalar( + tcx, + system_info_ptr.offset(offset, tcx)?, + Scalar::from_int(1, dword_size).into(), + dword_size, + )?; + } "TlsAlloc" => { // This just creates a key; Windows does not natively support TLS dtors.