@@ -3,41 +3,44 @@ use crate::{
3
3
obj:: { FlowAnalysisResult , FlowAnalysisValue , Object , Relocation , Symbol } ,
4
4
util:: { RawDouble , RawFloat } ,
5
5
} ;
6
- use itertools:: Itertools ;
7
- use ppc750cl:: Simm ;
8
6
use alloc:: collections:: { BTreeMap , BTreeSet } ;
7
+ use alloc:: { boxed:: Box , format, string:: String , vec:: Vec } ;
9
8
use core:: ffi:: CStr ;
10
9
use core:: ops:: { Index , IndexMut } ;
10
+ use itertools:: Itertools ;
11
+ use ppc750cl:: Simm ;
11
12
12
13
fn is_store_instruction ( op : ppc750cl:: Opcode ) -> bool {
13
14
use ppc750cl:: Opcode ;
14
- matches ! ( op,
15
+ matches ! (
16
+ op,
15
17
Opcode :: Stbux
16
- | Opcode :: Stbx
17
- | Opcode :: Stfdux
18
- | Opcode :: Stfdx
19
- | Opcode :: Stfiwx
20
- | Opcode :: Stfsux
21
- | Opcode :: Stfsx
22
- | Opcode :: Sthbrx
23
- | Opcode :: Sthux
24
- | Opcode :: Sthx
25
- | Opcode :: Stswi
26
- | Opcode :: Stswx
27
- | Opcode :: Stwbrx
28
- | Opcode :: Stwcx_
29
- | Opcode :: Stwux
30
- | Opcode :: Stwx
31
- | Opcode :: Stwu
32
- | Opcode :: Stb
33
- | Opcode :: Stbu
34
- | Opcode :: Sth
35
- | Opcode :: Sthu
36
- | Opcode :: Stmw
37
- | Opcode :: Stfs
38
- | Opcode :: Stfsu
39
- | Opcode :: Stfd
40
- | Opcode :: Stfdu )
18
+ | Opcode :: Stbx
19
+ | Opcode :: Stfdux
20
+ | Opcode :: Stfdx
21
+ | Opcode :: Stfiwx
22
+ | Opcode :: Stfsux
23
+ | Opcode :: Stfsx
24
+ | Opcode :: Sthbrx
25
+ | Opcode :: Sthux
26
+ | Opcode :: Sthx
27
+ | Opcode :: Stswi
28
+ | Opcode :: Stswx
29
+ | Opcode :: Stwbrx
30
+ | Opcode :: Stwcx_
31
+ | Opcode :: Stwux
32
+ | Opcode :: Stwx
33
+ | Opcode :: Stwu
34
+ | Opcode :: Stb
35
+ | Opcode :: Stbu
36
+ | Opcode :: Sth
37
+ | Opcode :: Sthu
38
+ | Opcode :: Stmw
39
+ | Opcode :: Stfs
40
+ | Opcode :: Stfsu
41
+ | Opcode :: Stfd
42
+ | Opcode :: Stfdu
43
+ )
41
44
}
42
45
43
46
pub fn guess_data_type_from_load_store_inst_op ( inst_op : ppc750cl:: Opcode ) -> Option < DataType > {
@@ -379,8 +382,8 @@ pub fn ppc_data_flow_analysis(
379
382
code : & [ u8 ] ,
380
383
relocations : & [ Relocation ] ,
381
384
) -> Box < dyn FlowAnalysisResult > {
382
- use ppc750cl:: InsIter ;
383
385
use alloc:: collections:: VecDeque ;
386
+ use ppc750cl:: InsIter ;
384
387
let instructions = InsIter :: new ( code, func_symbol. address as u32 )
385
388
. map ( |( _addr, ins) | ( ins. op , ins. basic ( ) . args ) )
386
389
. collect_vec ( ) ;
@@ -454,7 +457,7 @@ pub fn ppc_data_flow_analysis(
454
457
// an infinite loop if we hit some kind of bad behavior.
455
458
failsafe_counter += 1 ;
456
459
if failsafe_counter > 256 {
457
- println ! ( "Analysis of {} failed to stabilize" , func_symbol. name) ;
460
+ // println!("Analysis of {} failed to stabilize", func_symbol.name);
458
461
return Box :: new ( PPCFlowAnalysisResult :: new ( ) ) ;
459
462
}
460
463
}
0 commit comments