[AndroidWebViewShell] Replace rebaseline script with a new version using test_runner.py
[chromium-blink-merge.git] / courgette / disassembler_elf_32_x86.h
blob913e93f98c7f44924c8eedfc55090d29b5222eb4
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COURGETTE_DISASSEMBLER_ELF_32_X86_H_
6 #define COURGETTE_DISASSEMBLER_ELF_32_X86_H_
8 #include "base/basictypes.h"
9 #include "courgette/disassembler_elf_32.h"
10 #include "courgette/memory_allocator.h"
11 #include "courgette/types_elf.h"
13 namespace courgette {
15 class AssemblyProgram;
17 class DisassemblerElf32X86 : public DisassemblerElf32 {
18 public:
19 class TypedRVAX86 : public TypedRVA {
20 public:
21 explicit TypedRVAX86(RVA rva) : TypedRVA(rva) {
24 CheckBool ComputeRelativeTarget(const uint8* op_pointer) override {
25 set_relative_target(Read32LittleEndian(op_pointer) + 4);
26 return true;
29 CheckBool EmitInstruction(AssemblyProgram* program,
30 RVA target_rva) override {
31 return program->EmitRel32(program->FindOrMakeRel32Label(target_rva));
34 uint16 op_size() const override { return 4; }
37 explicit DisassemblerElf32X86(const void* start, size_t length);
39 virtual ExecutableType kind() { return EXE_ELF_32_X86; }
41 virtual e_machine_values ElfEM() { return EM_386; }
43 protected:
44 virtual CheckBool RelToRVA(Elf32_Rel rel, RVA* result)
45 const WARN_UNUSED_RESULT;
47 virtual CheckBool ParseRelocationSection(
48 const Elf32_Shdr *section_header,
49 AssemblyProgram* program) WARN_UNUSED_RESULT;
51 virtual CheckBool ParseRel32RelocsFromSection(
52 const Elf32_Shdr* section) WARN_UNUSED_RESULT;
54 #if COURGETTE_HISTOGRAM_TARGETS
55 std::map<RVA, int> rel32_target_rvas_;
56 #endif
58 DISALLOW_COPY_AND_ASSIGN(DisassemblerElf32X86);
61 } // namespace courgette
63 #endif // COURGETTE_DISASSEMBLER_ELF_32_X86_H_