@@ -600,9 +600,9 @@ pub struct FunctionLifterContext {
600600 pub blocks : Vec < Ref < BasicBlock < NativeBlock > > > ,
601601 pub no_return_calls : HashSet < Location > ,
602602 pub contextual_returns : HashMap < Location , bool > ,
603- // pub inline_remapping : HashMap<ArchAndAddr, ArchAndAddr> >,
604- // pub user_indirect_branches: HashMap<ArchAndAddr , HashSet<ArchAndAddr> >>,
605- // pub auto_indirect_branches: HashMap<ArchAndAddr , HashSet<ArchAndAddr> >>,
603+ pub inlined_remapping : HashMap < Location , Location > ,
604+ pub user_indirect_branches : HashMap < Location , HashSet < Location > > ,
605+ pub auto_indirect_branches : HashMap < Location , HashSet < Location > > ,
606606 //pub inlined_calls: HashSet<u64>,
607607}
608608
@@ -651,6 +651,43 @@ impl FunctionLifterContext {
651651 . zip ( raw_contextual_return_vals. iter ( ) . copied ( ) )
652652 . collect ( ) ;
653653
654+ let inlined_remapping: HashMap < Location , Location > = {
655+ let raw_inline_remap_locs: & [ BNArchitectureAndAddress ] = std:: slice:: from_raw_parts (
656+ flc_ref. inlinedRemappingKeys ,
657+ flc_ref. inlinedRemappingEntryCount ,
658+ ) ;
659+
660+ let raw_inline_remap_dests: & [ BNArchitectureAndAddress ] = std:: slice:: from_raw_parts (
661+ flc_ref. inlinedRemappingValues ,
662+ flc_ref. inlinedRemappingEntryCount ,
663+ ) ;
664+
665+ raw_inline_remap_locs
666+ . iter ( )
667+ . map ( Location :: from)
668+ . zip ( raw_inline_remap_dests. iter ( ) . map ( Location :: from) )
669+ . collect ( )
670+ } ;
671+
672+ let mut user_indirect_branches: HashMap < Location , HashSet < Location > > = HashMap :: new ( ) ;
673+ let mut auto_indirect_branches: HashMap < Location , HashSet < Location > > = HashMap :: new ( ) ;
674+ for i in 0 ..flc_ref. indirectBranchesCount {
675+ let entry = unsafe { * flc_ref. indirectBranches . add ( i) } ;
676+ let src = Location :: new ( Some ( CoreArchitecture :: from_raw ( entry. sourceArch ) ) , entry. sourceAddr ) ;
677+ let dest = Location :: new ( Some ( CoreArchitecture :: from_raw ( entry. destArch ) ) , entry. destAddr ) ;
678+ if entry. autoDefined {
679+ auto_indirect_branches
680+ . entry ( src)
681+ . or_insert_with ( HashSet :: new)
682+ . insert ( dest) ;
683+ } else {
684+ user_indirect_branches
685+ . entry ( src)
686+ . or_insert_with ( HashSet :: new)
687+ . insert ( dest) ;
688+ }
689+ }
690+
654691 FunctionLifterContext {
655692 handle,
656693 function : BNNewLowLevelILFunctionReference ( function) ,
@@ -659,6 +696,9 @@ impl FunctionLifterContext {
659696 blocks,
660697 no_return_calls,
661698 contextual_returns,
699+ inlined_remapping,
700+ user_indirect_branches,
701+ auto_indirect_branches,
662702 }
663703 }
664704
0 commit comments