@@ -5,6 +5,7 @@ use rustc_target::abi::Size;
5
5
6
6
use crate :: * ;
7
7
use helpers:: check_arg_count;
8
+ use shims:: windows:: sync:: EvalContextExt as _;
8
9
9
10
impl < ' mir , ' tcx : ' mir > EvalContextExt < ' mir , ' tcx > for crate :: MiriEvalContext < ' mir , ' tcx > { }
10
11
pub trait EvalContextExt < ' mir , ' tcx : ' mir > : crate :: MiriEvalContextExt < ' mir , ' tcx > {
@@ -207,6 +208,34 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
207
208
this. write_scalar ( Scalar :: from_i32 ( result) , dest) ?;
208
209
}
209
210
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
+
210
239
// Dynamic symbol loading
211
240
"GetProcAddress" => {
212
241
#[ allow( non_snake_case) ]
@@ -285,6 +314,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
285
314
// Any non zero value works for the stdlib. This is just used for stack overflows anyway.
286
315
this. write_scalar ( Scalar :: from_machine_usize ( 1 , this) , dest) ?;
287
316
}
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
+ }
288
323
| "InitializeCriticalSection"
289
324
| "EnterCriticalSection"
290
325
| "LeaveCriticalSection"
0 commit comments