MCPcopy Index your code
hub / github.com/encounter/objdiff / scan_instructions_internal

Method scan_instructions_internal

objdiff-core/src/arch/mips.rs:208–229  ·  view source on GitHub ↗
(
        &self,
        address: u64,
        code: &[u8],
        _section_index: usize,
        _relocations: &[Relocation],
        diff_config: &DiffObjConfig,
    )

Source from the content-addressed store, hash-verified

206
207impl Arch for ArchMips {
208 fn scan_instructions_internal(
209 &self,
210 address: u64,
211 code: &[u8],
212 _section_index: usize,
213 _relocations: &[Relocation],
214 diff_config: &DiffObjConfig,
215 ) -> Result<Vec<InstructionRef>> {
216 let instruction_flags = self.instruction_flags(diff_config);
217 let mut ops = Vec::<InstructionRef>::with_capacity(code.len() / 4);
218 let mut cur_addr = address as u32;
219 for chunk in code.chunks_exact(4) {
220 let code = self.endianness.read_u32_bytes(chunk.try_into()?);
221 let instruction =
222 rabbitizer::Instruction::new(code, Vram::new(cur_addr), instruction_flags);
223 let opcode = instruction.opcode() as u16;
224 let branch_dest = instruction.get_branch_vram_generic().map(|v| v.inner() as u64);
225 ops.push(InstructionRef { address: cur_addr as u64, size: 4, opcode, branch_dest });
226 cur_addr += 4;
227 }
228 Ok(ops)
229 }
230
231 fn display_instruction(
232 &self,

Callers

nothing calls this directly

Calls 3

instruction_flagsMethod · 0.80
opcodeMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected