| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "courgette/disassembler_elf_32_x86.h" | 5 #include "courgette/disassembler_elf_32_x86.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "courgette/assembly_program.h" | 12 #include "courgette/assembly_program.h" |
| 13 #include "courgette/courgette.h" | 13 #include "courgette/courgette.h" |
| 14 | 14 |
| 15 namespace courgette { | 15 namespace courgette { |
| 16 | 16 |
| 17 CheckBool DisassemblerElf32X86::TypedRVAX86::ComputeRelativeTarget( | 17 CheckBool DisassemblerElf32X86::TypedRVAX86::ComputeRelativeTarget( |
| 18 const uint8_t* op_pointer) { | 18 const uint8_t* op_pointer) { |
| 19 set_relative_target(Read32LittleEndian(op_pointer) + 4); | 19 set_relative_target(Read32LittleEndian(op_pointer) + 4); |
| 20 return true; | 20 return true; |
| 21 } | 21 } |
| 22 | 22 |
| 23 CheckBool DisassemblerElf32X86::TypedRVAX86::EmitInstruction( | 23 CheckBool DisassemblerElf32X86::TypedRVAX86::EmitInstruction( |
| 24 AssemblyProgram* program, | 24 AssemblyProgram* program, |
| 25 RVA target_rva) { | 25 Label* label) { |
| 26 return program->EmitRel32(program->FindOrMakeRel32Label(target_rva)); | 26 return program->EmitRel32(label); |
| 27 } | 27 } |
| 28 | 28 |
| 29 uint16_t DisassemblerElf32X86::TypedRVAX86::op_size() const { | 29 uint16_t DisassemblerElf32X86::TypedRVAX86::op_size() const { |
| 30 return 4; | 30 return 4; |
| 31 } | 31 } |
| 32 | 32 |
| 33 DisassemblerElf32X86::DisassemblerElf32X86(const void* start, size_t length) | 33 DisassemblerElf32X86::DisassemblerElf32X86(const void* start, size_t length) |
| 34 : DisassemblerElf32(start, length) { | 34 : DisassemblerElf32(start, length) { |
| 35 } | 35 } |
| 36 | 36 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 continue; | 194 continue; |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 p += 1; | 197 p += 1; |
| 198 } | 198 } |
| 199 | 199 |
| 200 return true; | 200 return true; |
| 201 } | 201 } |
| 202 | 202 |
| 203 } // namespace courgette | 203 } // namespace courgette |
| OLD | NEW |