@@ -5,6 +5,7 @@ use rustc_target::abi::Size;
55
66use crate :: * ;
77use helpers:: check_arg_count;
8+ use shims:: windows:: sync:: EvalContextExt as _;
89
910impl < ' mir , ' tcx : ' mir > EvalContextExt < ' mir , ' tcx > for crate :: MiriEvalContext < ' mir , ' tcx > { }
1011pub trait EvalContextExt < ' mir , ' tcx : ' mir > : crate :: MiriEvalContextExt < ' mir , ' tcx > {
@@ -207,6 +208,34 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
207208 this. write_scalar ( Scalar :: from_i32 ( result) , dest) ?;
208209 }
209210
211+ // Synchronization primitives
212+ "AcquireSRWLockExclusive" => {
213+ let & [ ptr] = check_arg_count ( args) ?;
214+ this. AcquireSRWLockExclusive ( ptr) ?;
215+ }
216+ "ReleaseSRWLockExclusive" => {
217+ let & [ ptr] = check_arg_count ( args) ?;
218+ this. ReleaseSRWLockExclusive ( ptr) ?;
219+ }
220+ "TryAcquireSRWLockExclusive" => {
221+ let & [ ptr] = check_arg_count ( args) ?;
222+ let ret = this. TryAcquireSRWLockExclusive ( ptr) ?;
223+ this. write_scalar ( Scalar :: from_u8 ( ret) , dest) ?;
224+ }
225+ "AcquireSRWLockShared" => {
226+ let & [ ptr] = check_arg_count ( args) ?;
227+ this. AcquireSRWLockShared ( ptr) ?;
228+ }
229+ "ReleaseSRWLockShared" => {
230+ let & [ ptr] = check_arg_count ( args) ?;
231+ this. ReleaseSRWLockShared ( ptr) ?;
232+ }
233+ "TryAcquireSRWLockShared" => {
234+ let & [ ptr] = check_arg_count ( args) ?;
235+ let ret = this. TryAcquireSRWLockShared ( ptr) ?;
236+ this. write_scalar ( Scalar :: from_u8 ( ret) , dest) ?;
237+ }
238+
210239 // Dynamic symbol loading
211240 "GetProcAddress" => {
212241 #[ allow( non_snake_case) ]
@@ -285,6 +314,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
285314 // Any non zero value works for the stdlib. This is just used for stack overflows anyway.
286315 this. write_scalar ( Scalar :: from_machine_usize ( 1 , this) , dest) ?;
287316 }
317+ "SetThreadStackGuarantee" if this. frame ( ) . instance . to_string ( ) . starts_with ( "std::sys::windows::" ) => {
318+ #[ allow( non_snake_case) ]
319+ let & [ _StackSizeInBytes] = check_arg_count ( args) ?;
320+ // Any non zero value works for the stdlib. This is just used for stack overflows anyway.
321+ this. write_scalar ( Scalar :: from_u32 ( 1 ) , dest) ?;
322+ }
288323 | "InitializeCriticalSection"
289324 | "EnterCriticalSection"
290325 | "LeaveCriticalSection"
0 commit comments