OLD | NEW |
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 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 | 555 |
556 const uint8* p = start_pointer; | 556 const uint8* p = start_pointer; |
557 | 557 |
558 while (ok && p < end_pointer) { | 558 while (ok && p < end_pointer) { |
559 RVA current_rva = static_cast<RVA>(p - adjust_pointer_to_rva); | 559 RVA current_rva = static_cast<RVA>(p - adjust_pointer_to_rva); |
560 | 560 |
561 // The base relocation table is usually in the .relocs section, but it could | 561 // The base relocation table is usually in the .relocs section, but it could |
562 // actually be anywhere. Make sure we skip it because we will regenerate it | 562 // actually be anywhere. Make sure we skip it because we will regenerate it |
563 // during assembly. | 563 // during assembly. |
564 if (current_rva == relocs_start_rva) { | 564 if (current_rva == relocs_start_rva) { |
565 ok = program->EmitMakeRelocsInstruction(); | 565 ok = program->EmitPeRelocsInstruction(); |
566 if (!ok) | 566 if (!ok) |
567 break; | 567 break; |
568 uint32 relocs_size = base_relocation_table().size_; | 568 uint32 relocs_size = base_relocation_table().size_; |
569 if (relocs_size) { | 569 if (relocs_size) { |
570 p += relocs_size; | 570 p += relocs_size; |
571 continue; | 571 continue; |
572 } | 572 } |
573 } | 573 } |
574 | 574 |
575 while (abs32_pos != abs32_locations_.end() && *abs32_pos < current_rva) | 575 while (abs32_pos != abs32_locations_.end() && *abs32_pos < current_rva) |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 directory->size_ = static_cast<uint32>(size); | 726 directory->size_ = static_cast<uint32>(size); |
727 return true; | 727 return true; |
728 } else { | 728 } else { |
729 directory->address_ = 0; | 729 directory->address_ = 0; |
730 directory->size_ = 0; | 730 directory->size_ = 0; |
731 return true; | 731 return true; |
732 } | 732 } |
733 } | 733 } |
734 | 734 |
735 } // namespace courgette | 735 } // namespace courgette |
OLD | NEW |