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

Side by Side Diff: courgette/disassembler_win32_x86.cc

Issue 2008253004: Refactor rel32 searching process for x64 to make it more similar to x86. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Correct far away ptr in rel32_x64_03.txt test case Created 4 years, 6 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_win32_x64.cc ('k') | courgette/rel32_finder.h » ('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) 2011 The Chromium Authors. All rights reserved. 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 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_win32_x86.h" 5 #include "courgette/disassembler_win32_x86.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "courgette/assembly_program.h" 10 #include "courgette/assembly_program.h"
11 #include "courgette/courgette.h" 11 #include "courgette/courgette.h"
12 #include "courgette/rel32_finder_win32_x86.h" 12 #include "courgette/rel32_finder_x86.h"
13 13
14 #if COURGETTE_HISTOGRAM_TARGETS 14 #if COURGETTE_HISTOGRAM_TARGETS
15 #include <iostream> 15 #include <iostream>
16 #endif 16 #endif
17 17
18 namespace courgette { 18 namespace courgette {
19 19
20 DisassemblerWin32X86::DisassemblerWin32X86(const void* start, size_t length) 20 DisassemblerWin32X86::DisassemblerWin32X86(const void* start, size_t length)
21 : DisassemblerWin32(start, length) {} 21 : DisassemblerWin32(start, length) {}
22 22
(...skipping 20 matching lines...) Expand all
43 43
44 FileOffset start_file_offset = section->file_offset_of_raw_data; 44 FileOffset start_file_offset = section->file_offset_of_raw_data;
45 FileOffset end_file_offset = start_file_offset + section->size_of_raw_data; 45 FileOffset end_file_offset = start_file_offset + section->size_of_raw_data;
46 46
47 const uint8_t* start_pointer = FileOffsetToPointer(start_file_offset); 47 const uint8_t* start_pointer = FileOffsetToPointer(start_file_offset);
48 const uint8_t* end_pointer = FileOffsetToPointer(end_file_offset); 48 const uint8_t* end_pointer = FileOffsetToPointer(end_file_offset);
49 49
50 RVA start_rva = FileOffsetToRVA(start_file_offset); 50 RVA start_rva = FileOffsetToRVA(start_file_offset);
51 RVA end_rva = start_rva + section->virtual_size; 51 RVA end_rva = start_rva + section->virtual_size;
52 52
53 Rel32FinderWin32X86_Basic finder( 53 Rel32FinderX86 finder(
54 base_relocation_table().address_, 54 base_relocation_table().address_,
55 base_relocation_table().address_ + base_relocation_table().size_); 55 base_relocation_table().address_ + base_relocation_table().size_);
56 finder.Find(start_pointer, end_pointer, start_rva, end_rva, abs32_locations_); 56 finder.Find(start_pointer, end_pointer, start_rva, end_rva, abs32_locations_);
57 finder.SwapRel32Locations(&rel32_locations_); 57 finder.SwapRel32Locations(&rel32_locations_);
58 58
59 #if COURGETTE_HISTOGRAM_TARGETS 59 #if COURGETTE_HISTOGRAM_TARGETS
60 DCHECK(rel32_target_rvas_.empty()); 60 DCHECK(rel32_target_rvas_.empty());
61 finder.SwapRel32TargetRVAs(&rel32_target_rvas_); 61 finder.SwapRel32TargetRVAs(&rel32_target_rvas_);
62 #endif 62 #endif
63 } 63 }
64 64
65 } // namespace courgette 65 } // namespace courgette
OLDNEW
« no previous file with comments | « courgette/disassembler_win32_x64.cc ('k') | courgette/rel32_finder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698