From 2b637b698c76e43c9cf729e868cf7618d5327cc8 Mon Sep 17 00:00:00 2001 From: "paulgazz@chromium.org" Date: Thu, 1 Aug 2013 00:11:24 +0000 Subject: Support for ARM 32-bit ELF binaries in Courgette Notes for reviewers: dgarrett: courgette correctness, ARM benchan: style, correctness BUG=258640,258645,258653 Review URL: https://chromiumcodereview.appspot.com/20099004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214873 0039d316-1c4b-4281-b951-d872f2087c98 --- courgette/disassembler_elf_32_arm.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'courgette/disassembler_elf_32_arm.h') diff --git a/courgette/disassembler_elf_32_arm.h b/courgette/disassembler_elf_32_arm.h index 57e750e..08b8db8 100644 --- a/courgette/disassembler_elf_32_arm.h +++ b/courgette/disassembler_elf_32_arm.h @@ -18,6 +18,8 @@ enum ARM_RVA { ARM_OFF8, ARM_OFF11, ARM_OFF24, + ARM_OFF25, + ARM_OFF21, }; class DisassemblerElf32ARM : public DisassemblerElf32 { @@ -26,10 +28,22 @@ class DisassemblerElf32ARM : public DisassemblerElf32 { public: TypedRVAARM(ARM_RVA type, RVA rva) : TypedRVA(rva), type_(type) { } - virtual CheckBool ComputeRelativeTarget(const uint8* op_pointer) OVERRIDE; + uint16 c_op() const { + return c_op_; + } + + virtual CheckBool ComputeRelativeTarget(const uint8* op_pointer); + + virtual CheckBool EmitInstruction(AssemblyProgram* program, + RVA target_rva); + + virtual uint16 op_size() const; private: ARM_RVA type_; + + uint16 c_op_; // set by ComputeRelativeTarget() + const uint8* arm_op_; }; explicit DisassemblerElf32ARM(const void* start, size_t length); @@ -38,6 +52,12 @@ class DisassemblerElf32ARM : public DisassemblerElf32 { virtual e_machine_values ElfEM() { return EM_ARM; } + static CheckBool Compress(ARM_RVA type, uint32 arm_op, RVA rva, + uint16* c_op /* out */, uint32* addr /* out */); + + static CheckBool Decompress(ARM_RVA type, uint16 c_op, uint32 addr, + uint32* arm_op /* out */); + protected: virtual CheckBool RelToRVA(Elf32_Rel rel, RVA* result) -- cgit v1.1