Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Side by Side Diff: courgette/disassembler_elf_32_x86.cc

Issue 2055343002: Courgette: Add static method QuickDetect() to optimize program detection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « courgette/disassembler_elf_32_x86.h ('k') | courgette/disassembler_elf_32_x86_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 12 matching lines...) Expand all
23 CheckBool DisassemblerElf32X86::TypedRVAX86::EmitInstruction( 23 CheckBool DisassemblerElf32X86::TypedRVAX86::EmitInstruction(
24 AssemblyProgram* program, 24 AssemblyProgram* program,
25 Label* label) { 25 Label* label) {
26 return program->EmitRel32(label); 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 uint8_t* start, size_t length)
34 : DisassemblerElf32(start, length) { 34 : DisassemblerElf32(start, length) {}
35 }
36 35
37 // Convert an ELF relocation struction into an RVA. 36 // Convert an ELF relocation struction into an RVA.
38 CheckBool DisassemblerElf32X86::RelToRVA(Elf32_Rel rel, RVA* result) const { 37 CheckBool DisassemblerElf32X86::RelToRVA(Elf32_Rel rel, RVA* result) const {
39 // The rightmost byte of r_info is the type. 38 // The rightmost byte of r_info is the type.
40 elf32_rel_386_type_values type = 39 elf32_rel_386_type_values type =
41 static_cast<elf32_rel_386_type_values>(rel.r_info & 0xFF); 40 static_cast<elf32_rel_386_type_values>(rel.r_info & 0xFF);
42 41
43 // The other 3 bytes of r_info are the symbol. 42 // The other 3 bytes of r_info are the symbol.
44 uint32_t symbol = rel.r_info >> 8; 43 uint32_t symbol = rel.r_info >> 8;
45 44
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 continue; 193 continue;
195 } 194 }
196 } 195 }
197 p += 1; 196 p += 1;
198 } 197 }
199 198
200 return true; 199 return true;
201 } 200 }
202 201
203 } // namespace courgette 202 } // namespace courgette
OLDNEW
« no previous file with comments | « courgette/disassembler_elf_32_x86.h ('k') | courgette/disassembler_elf_32_x86_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698