@@ -123,19 +123,34 @@ pub trait Architecture: 'static + Sized + AsRef<CoreArchitecture> {
123123
124124 fn associated_arch_by_addr ( & self , addr : u64 ) -> CoreArchitecture ;
125125
126+ /// Returns the [`InstructionInfo`] at the given virtual address with `data`.
127+ ///
128+ /// The [`InstructionInfo`] object should always fill the proper length and branches if not, the
129+ /// next instruction will likely be incorrect.
126130 fn instruction_info ( & self , data : & [ u8 ] , addr : u64 ) -> Option < InstructionInfo > ;
131+
127132 fn instruction_text (
128133 & self ,
129134 data : & [ u8 ] ,
130135 addr : u64 ,
131136 ) -> Option < ( usize , Vec < InstructionTextToken > ) > ;
137+
138+ // TODO: Why do we need to return a boolean here? Does `None` not represent the same thing?
139+ /// Appends arbitrary low-level il instructions to `il`.
140+ ///
141+ /// If `None` is returned, no instructions were appended and the data is invalid. If `Some` is returned,
142+ /// the instructions consumed length is returned (necessary for variable length instruction decoding).
132143 fn instruction_llil (
133144 & self ,
134145 data : & [ u8 ] ,
135146 addr : u64 ,
136147 il : & LowLevelILMutableFunction ,
137148 ) -> Option < ( usize , bool ) > ;
138149
150+ /// Performs basic block recovery and commits the results to the function analysis.
151+ ///
152+ /// NOTE: Only implement this method if function-level analysis is required. Otherwise, do not
153+ /// implement to let default basic block analysis take place.
139154 fn analyze_basic_blocks (
140155 & self ,
141156 function : & mut Function ,
@@ -147,7 +162,7 @@ pub trait Architecture: 'static + Sized + AsRef<CoreArchitecture> {
147162 }
148163
149164 /// Fallback flag value calculation path. This method is invoked when the core is unable to
150- /// recover flag use semantics, and resorts to emitting instructions that explicitly set each
165+ /// recover the flag using semantics and resorts to emitting instructions that explicitly set each
151166 /// observed flag to the value of an expression returned by this function.
152167 ///
153168 /// This function *MUST NOT* append instructions that have side effects.
@@ -166,11 +181,10 @@ pub trait Architecture: 'static + Sized + AsRef<CoreArchitecture> {
166181 Some ( get_default_flag_write_llil ( self , role, op, il) )
167182 }
168183
169- /// Determines what flags need to be examined in order to attempt automatic recovery of the
170- /// semantics of this flag use.
184+ /// Determines what flags need to be examined to attempt automatic recovery of the flag uses semantics.
171185 ///
172- /// If automatic recovery is not possible, the ` flag_cond_llil` method will be invoked to give
173- /// this `Architecture` implementation arbitrary control over the expression to be evaluated.
186+ /// If automatic recovery is not possible, the [`Architecture:: flag_cond_llil`] method will be invoked
187+ /// to give this [ `Architecture`] implementation arbitrary control over the expression to be evaluated.
174188 fn flags_required_for_flag_condition (
175189 & self ,
176190 _condition : FlagCondition ,
0 commit comments