@@ -19,30 +19,40 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
1919 ) -> InterpResult < ' tcx , ThreadId > {
2020 let this = self . eval_context_mut ( ) ;
2121
22- if !this. ptr_is_null ( this. read_pointer ( security_op) ?) ? {
23- throw_unsup_format ! ( "non-null `lpThreadAttributes` in `CreateThread`" )
24- }
22+ let security = this. read_pointer ( security_op) ?;
2523
2624 // stacksize is ignored, but still needs to be a valid usize
2725 let _ = this. read_scalar ( stacksize_op) ?. to_machine_usize ( this) ?;
2826
27+ let start_routine = this. read_pointer ( start_op) ?;
28+
29+ let func_arg = this. read_immediate ( arg_op) ?;
30+
2931 let flags = this. read_scalar ( flags_op) ?. to_u32 ( ) ?;
3032
33+ let thread = if this. ptr_is_null ( this. read_pointer ( thread_op) ?) ? {
34+ None
35+ } else {
36+ let thread_info_place = this. deref_operand ( thread_op) ?;
37+ Some ( thread_info_place)
38+ } ;
39+
3140 let stack_size_param_is_a_reservation =
3241 this. eval_windows ( "c" , "STACK_SIZE_PARAM_IS_A_RESERVATION" ) ?. to_u32 ( ) ?;
3342
3443 if flags != 0 && flags != stack_size_param_is_a_reservation {
3544 throw_unsup_format ! ( "unsupported `dwCreationFlags` {} in `CreateThread`" , flags)
3645 }
3746
38- let thread =
39- if this. ptr_is_null ( this. read_pointer ( thread_op) ?) ? { None } else { Some ( thread_op) } ;
47+ if !this. ptr_is_null ( security) ? {
48+ throw_unsup_format ! ( "non-null `lpThreadAttributes` in `CreateThread`" )
49+ }
4050
4151 this. start_thread (
4252 thread,
43- start_op ,
53+ start_routine ,
4454 Abi :: System { unwind : false } ,
45- arg_op ,
55+ func_arg ,
4656 this. layout_of ( this. tcx . types . u32 ) ?,
4757 )
4858 }
0 commit comments