11use rustc_middle:: mir;
22use rustc_target:: spec:: abi:: Abi ;
33
4- use log:: trace;
5-
64use crate :: * ;
7- use helpers:: { check_abi, check_arg_count} ;
8- use shims:: windows:: sync:: EvalContextExt as _;
5+ use helpers:: check_abi;
96
107#[ derive( Debug , Copy , Clone ) ]
118pub enum Dlsym {
12- AcquireSRWLockExclusive ,
13- ReleaseSRWLockExclusive ,
14- TryAcquireSRWLockExclusive ,
15- AcquireSRWLockShared ,
16- ReleaseSRWLockShared ,
17- TryAcquireSRWLockShared ,
189}
1910
2011impl Dlsym {
2112 // Returns an error for unsupported symbols, and None if this symbol
2213 // should become a NULL pointer (pretend it does not exist).
2314 pub fn from_str ( name : & str ) -> InterpResult < ' static , Option < Dlsym > > {
2415 Ok ( match name {
25- "AcquireSRWLockExclusive" => Some ( Dlsym :: AcquireSRWLockExclusive ) ,
26- "ReleaseSRWLockExclusive" => Some ( Dlsym :: ReleaseSRWLockExclusive ) ,
27- "TryAcquireSRWLockExclusive" => Some ( Dlsym :: TryAcquireSRWLockExclusive ) ,
28- "AcquireSRWLockShared" => Some ( Dlsym :: AcquireSRWLockShared ) ,
29- "ReleaseSRWLockShared" => Some ( Dlsym :: ReleaseSRWLockShared ) ,
30- "TryAcquireSRWLockShared" => Some ( Dlsym :: TryAcquireSRWLockShared ) ,
3116 "GetSystemTimePreciseAsFileTime" => None ,
3217 _ => throw_unsup_format ! ( "unsupported Windows dlsym: {}" , name) ,
3318 } )
@@ -40,46 +25,15 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
4025 & mut self ,
4126 dlsym : Dlsym ,
4227 abi : Abi ,
43- args : & [ OpTy < ' tcx , Tag > ] ,
28+ _args : & [ OpTy < ' tcx , Tag > ] ,
4429 ret : Option < ( PlaceTy < ' tcx , Tag > , mir:: BasicBlock ) > ,
4530 ) -> InterpResult < ' tcx > {
4631 let this = self . eval_context_mut ( ) ;
47- let ( dest , ret ) = ret. expect ( "we don't support any diverging dlsym" ) ;
32+ let ( _dest , _ret ) = ret. expect ( "we don't support any diverging dlsym" ) ;
4833 assert ! ( this. tcx. sess. target. os == "windows" ) ;
4934
5035 check_abi ( abi, Abi :: System ) ?;
5136
52- match dlsym {
53- Dlsym :: AcquireSRWLockExclusive => {
54- let & [ ptr] = check_arg_count ( args) ?;
55- this. AcquireSRWLockExclusive ( ptr) ?;
56- }
57- Dlsym :: ReleaseSRWLockExclusive => {
58- let & [ ptr] = check_arg_count ( args) ?;
59- this. ReleaseSRWLockExclusive ( ptr) ?;
60- }
61- Dlsym :: TryAcquireSRWLockExclusive => {
62- let & [ ptr] = check_arg_count ( args) ?;
63- let ret = this. TryAcquireSRWLockExclusive ( ptr) ?;
64- this. write_scalar ( Scalar :: from_u8 ( ret) , dest) ?;
65- }
66- Dlsym :: AcquireSRWLockShared => {
67- let & [ ptr] = check_arg_count ( args) ?;
68- this. AcquireSRWLockShared ( ptr) ?;
69- }
70- Dlsym :: ReleaseSRWLockShared => {
71- let & [ ptr] = check_arg_count ( args) ?;
72- this. ReleaseSRWLockShared ( ptr) ?;
73- }
74- Dlsym :: TryAcquireSRWLockShared => {
75- let & [ ptr] = check_arg_count ( args) ?;
76- let ret = this. TryAcquireSRWLockShared ( ptr) ?;
77- this. write_scalar ( Scalar :: from_u8 ( ret) , dest) ?;
78- }
79- }
80-
81- trace ! ( "{:?}" , this. dump_place( * dest) ) ;
82- this. go_to_block ( ret) ;
83- Ok ( ( ) )
37+ match dlsym { }
8438 }
8539}
0 commit comments