OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_arm.h" | 5 #include "courgette/disassembler_elf_32_arm.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 return false; | 297 return false; |
298 } | 298 } |
299 } | 299 } |
300 | 300 |
301 CheckBool DisassemblerElf32ARM::TypedRVAARM::EmitInstruction( | 301 CheckBool DisassemblerElf32ARM::TypedRVAARM::EmitInstruction( |
302 AssemblyProgram* program, | 302 AssemblyProgram* program, |
303 Label* label) { | 303 Label* label) { |
304 return program->EmitRel32ARM(c_op(), label, arm_op_, op_size()); | 304 return program->EmitRel32ARM(c_op(), label, arm_op_, op_size()); |
305 } | 305 } |
306 | 306 |
307 DisassemblerElf32ARM::DisassemblerElf32ARM(const void* start, size_t length) | 307 DisassemblerElf32ARM::DisassemblerElf32ARM(const uint8_t* start, size_t length) |
308 : DisassemblerElf32(start, length) { | 308 : DisassemblerElf32(start, length) {} |
309 } | |
310 | 309 |
311 // Convert an ELF relocation struction into an RVA. | 310 // Convert an ELF relocation struction into an RVA. |
312 CheckBool DisassemblerElf32ARM::RelToRVA(Elf32_Rel rel, RVA* result) const { | 311 CheckBool DisassemblerElf32ARM::RelToRVA(Elf32_Rel rel, RVA* result) const { |
313 // The rightmost byte of r_info is the type. | 312 // The rightmost byte of r_info is the type. |
314 elf32_rel_arm_type_values type = | 313 elf32_rel_arm_type_values type = |
315 static_cast<elf32_rel_arm_type_values>(rel.r_info & 0xFF); | 314 static_cast<elf32_rel_arm_type_values>(rel.r_info & 0xFF); |
316 | 315 |
317 // The other 3 bytes of r_info are the symbol. | 316 // The other 3 bytes of r_info are the symbol. |
318 uint32_t symbol = rel.r_info >> 8; | 317 uint32_t symbol = rel.r_info >> 8; |
319 | 318 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 // Move 2 bytes at a time, but track 32-bit boundaries | 520 // Move 2 bytes at a time, but track 32-bit boundaries |
522 p += 2; | 521 p += 2; |
523 on_32bit = ((on_32bit + 1) % 2) != 0; | 522 on_32bit = ((on_32bit + 1) % 2) != 0; |
524 } | 523 } |
525 } | 524 } |
526 | 525 |
527 return true; | 526 return true; |
528 } | 527 } |
529 | 528 |
530 } // namespace courgette | 529 } // namespace courgette |
OLD | NEW |