| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef COURGETTE_DISASSEMBLER_WIN32_H_ | 5 #ifndef COURGETTE_DISASSEMBLER_WIN32_H_ |
| 6 #define COURGETTE_DISASSEMBLER_WIN32_H_ | 6 #define COURGETTE_DISASSEMBLER_WIN32_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 const Section* RVAToSection(RVA rva) const; | 49 const Section* RVAToSection(RVA rva) const; |
| 50 | 50 |
| 51 static std::string SectionName(const Section* section); | 51 static std::string SectionName(const Section* section); |
| 52 | 52 |
| 53 protected: | 53 protected: |
| 54 // Returns true if a valid executable is detected using only quick checks. | 54 // Returns true if a valid executable is detected using only quick checks. |
| 55 // Derived classes should inject |magic| corresponding to their architecture, | 55 // Derived classes should inject |magic| corresponding to their architecture, |
| 56 // which will be checked against the detected one. | 56 // which will be checked against the detected one. |
| 57 static bool QuickDetect(const uint8_t* start, size_t length, uint16_t magic); | 57 static bool QuickDetect(const uint8_t* start, size_t length, uint16_t magic); |
| 58 | 58 |
| 59 bool ParseAbs32Relocs(); |
| 60 void ParseRel32RelocsFromSections(); |
| 61 |
| 59 // Disassembler interfaces. | 62 // Disassembler interfaces. |
| 60 RvaVisitor* CreateAbs32TargetRvaVisitor() override; | 63 RvaVisitor* CreateAbs32TargetRvaVisitor() override; |
| 61 RvaVisitor* CreateRel32TargetRvaVisitor() override; | 64 RvaVisitor* CreateRel32TargetRvaVisitor() override; |
| 62 void RemoveUnusedRel32Locations(AssemblyProgram* program) override; | 65 void RemoveUnusedRel32Locations(AssemblyProgram* program) override; |
| 63 | 66 |
| 64 DisassemblerWin32(const uint8_t* start, size_t length); | 67 DisassemblerWin32(const uint8_t* start, size_t length); |
| 65 | 68 |
| 66 CheckBool ParseFile(AssemblyProgram* target, | 69 CheckBool ParseFile(AssemblyProgram* target, |
| 67 InstructionReceptor* receptor) const WARN_UNUSED_RESULT; | 70 InstructionReceptor* receptor) const WARN_UNUSED_RESULT; |
| 68 bool ParseAbs32Relocs(); | |
| 69 void ParseRel32RelocsFromSections(); | |
| 70 virtual void ParseRel32RelocsFromSection(const Section* section) = 0; | 71 virtual void ParseRel32RelocsFromSection(const Section* section) = 0; |
| 71 | 72 |
| 72 CheckBool ParseNonSectionFileRegion(FileOffset start_file_offset, | 73 CheckBool ParseNonSectionFileRegion(FileOffset start_file_offset, |
| 73 FileOffset end_file_offset, | 74 FileOffset end_file_offset, |
| 74 InstructionReceptor* receptor) const | 75 InstructionReceptor* receptor) const |
| 75 WARN_UNUSED_RESULT; | 76 WARN_UNUSED_RESULT; |
| 76 CheckBool ParseFileRegion(const Section* section, | 77 CheckBool ParseFileRegion(const Section* section, |
| 77 FileOffset start_file_offset, | 78 FileOffset start_file_offset, |
| 78 FileOffset end_file_offset, | 79 FileOffset end_file_offset, |
| 79 AssemblyProgram* program, | 80 AssemblyProgram* program, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 std::map<RVA, int> rel32_target_rvas_; | 147 std::map<RVA, int> rel32_target_rvas_; |
| 147 #endif | 148 #endif |
| 148 | 149 |
| 149 private: | 150 private: |
| 150 DISALLOW_COPY_AND_ASSIGN(DisassemblerWin32); | 151 DISALLOW_COPY_AND_ASSIGN(DisassemblerWin32); |
| 151 }; | 152 }; |
| 152 | 153 |
| 153 } // namespace courgette | 154 } // namespace courgette |
| 154 | 155 |
| 155 #endif // COURGETTE_DISASSEMBLER_WIN32_H_ | 156 #endif // COURGETTE_DISASSEMBLER_WIN32_H_ |
| OLD | NEW |