Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Unified Diff: courgette/disassembler_elf_32_arm.cc

Issue 2462993003: [Courgette] Refactor: Add and use Instruction*Receptor classes; call ParseFile() in 2 passes. (Closed)
Patch Set: Fix comments. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « courgette/disassembler_elf_32_arm.h ('k') | courgette/disassembler_elf_32_x86.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/disassembler_elf_32_arm.cc
diff --git a/courgette/disassembler_elf_32_arm.cc b/courgette/disassembler_elf_32_arm.cc
index 4106e283a98a14f0a9ad5da80296bced682af19f..0d9f340b70f79a34b289e4a09c8f8d898ffdbc33 100644
--- a/courgette/disassembler_elf_32_arm.cc
+++ b/courgette/disassembler_elf_32_arm.cc
@@ -100,7 +100,7 @@ CheckBool DisassemblerElf32ARM::Compress(ARM_RVA type,
temp |= (S << 24) | (i1 << 23) | (i2 << 22);
- if (temp & 0x01000000) // sign extension
+ if (temp & 0x01000000) // sign extension
temp |= 0xFE000000;
uint32_t prefetch;
if (toARM) {
@@ -299,9 +299,9 @@ CheckBool DisassemblerElf32ARM::TypedRVAARM::ComputeRelativeTarget(
}
CheckBool DisassemblerElf32ARM::TypedRVAARM::EmitInstruction(
- AssemblyProgram* program,
- Label* label) {
- return program->EmitRel32ARM(c_op(), label, arm_op_, op_size());
+ Label* label,
+ InstructionReceptor* receptor) {
+ return receptor->EmitRel32ARM(c_op(), label, arm_op_, op_size());
}
DisassemblerElf32ARM::DisassemblerElf32ARM(const uint8_t* start, size_t length)
@@ -332,7 +332,7 @@ CheckBool DisassemblerElf32ARM::RelToRVA(Elf32_Rel rel, RVA* result) const {
CheckBool DisassemblerElf32ARM::ParseRelocationSection(
const Elf32_Shdr* section_header,
- AssemblyProgram* program) {
+ InstructionReceptor* receptor) const {
// This method compresses a contiguous stretch of R_ARM_RELATIVE entries in
// the relocation table with a Courgette relocation table instruction.
// It skips any entries at the beginning that appear in a section that
@@ -372,9 +372,8 @@ CheckBool DisassemblerElf32ARM::ParseRelocationSection(
if (section_relocs_iter->r_offset == *reloc_iter)
break;
- if (!ParseSimpleRegion(file_offset,
- file_offset + sizeof(Elf32_Rel),
- program)) {
+ if (!ParseSimpleRegion(file_offset, file_offset + sizeof(Elf32_Rel),
+ receptor)) {
return false;
}
@@ -395,12 +394,12 @@ CheckBool DisassemblerElf32ARM::ParseRelocationSection(
if (match) {
// Skip over relocation tables
- if (!program->EmitElfARMRelocationInstruction())
+ if (!receptor->EmitElfARMRelocation())
return false;
}
}
- return ParseSimpleRegion(file_offset, section_end, program);
+ return ParseSimpleRegion(file_offset, section_end, receptor);
}
// TODO(huangs): Detect and avoid overlap with abs32 addresses.
« no previous file with comments | « courgette/disassembler_elf_32_arm.h ('k') | courgette/disassembler_elf_32_x86.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698