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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "courgette/assembly_program.h" | 11 #include "courgette/assembly_program.h" |
12 #include "courgette/courgette.h" | 12 #include "courgette/courgette.h" |
13 | 13 |
14 namespace courgette { | 14 namespace courgette { |
15 | 15 |
16 CheckBool DisassemblerElf32X86::TypedRVAX86::ComputeRelativeTarget( | 16 CheckBool DisassemblerElf32X86::TypedRVAX86::ComputeRelativeTarget( |
17 const uint8_t* op_pointer) { | 17 const uint8_t* op_pointer) { |
18 set_relative_target(Read32LittleEndian(op_pointer) + 4); | 18 set_relative_target(Read32LittleEndian(op_pointer) + 4); |
19 return true; | 19 return true; |
20 } | 20 } |
21 | 21 |
22 CheckBool DisassemblerElf32X86::TypedRVAX86::EmitInstruction( | 22 CheckBool DisassemblerElf32X86::TypedRVAX86::EmitInstruction( |
23 AssemblyProgram* program, | 23 AssemblyProgram* program, |
24 RVA target_rva) { | 24 Label* label) { |
25 return program->EmitRel32(program->FindOrMakeRel32Label(target_rva)); | 25 return program->EmitRel32(label); |
26 } | 26 } |
27 | 27 |
28 uint16_t DisassemblerElf32X86::TypedRVAX86::op_size() const { | 28 uint16_t DisassemblerElf32X86::TypedRVAX86::op_size() const { |
29 return 4; | 29 return 4; |
30 } | 30 } |
31 | 31 |
32 DisassemblerElf32X86::DisassemblerElf32X86(const void* start, size_t length) | 32 DisassemblerElf32X86::DisassemblerElf32X86(const void* start, size_t length) |
33 : DisassemblerElf32(start, length) { | 33 : DisassemblerElf32(start, length) { |
34 } | 34 } |
35 | 35 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 continue; | 193 continue; |
194 } | 194 } |
195 } | 195 } |
196 p += 1; | 196 p += 1; |
197 } | 197 } |
198 | 198 |
199 return true; | 199 return true; |
200 } | 200 } |
201 | 201 |
202 } // namespace courgette | 202 } // namespace courgette |
OLD | NEW |