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

Unified Diff: courgette/disassembler_win32.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « courgette/disassembler_elf_32_x86_unittest.cc ('k') | courgette/disassembler_win32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/disassembler_win32.h
diff --git a/courgette/disassembler_win32.h b/courgette/disassembler_win32.h
index 42dc2fef3ada8367c6871a1fdf49c9850a68c326..31b32638d8f6842f92d0b5ffe55921ad014de752 100644
--- a/courgette/disassembler_win32.h
+++ b/courgette/disassembler_win32.h
@@ -49,12 +49,17 @@ class DisassemblerWin32 : public Disassembler {
static std::string SectionName(const Section* section);
protected:
+ // Returns true if a valid executable is detected using only quick checks.
+ // Derived classes should inject |magic| corresponding to their architecture,
+ // which will be checked against the detected one.
+ static bool QuickDetect(const uint8_t* start, size_t length, uint16_t magic);
+
// Disassembler interfaces.
RvaVisitor* CreateAbs32TargetRvaVisitor() override;
RvaVisitor* CreateRel32TargetRvaVisitor() override;
void RemoveUnusedRel32Locations(AssemblyProgram* program) override;
- DisassemblerWin32(const void* start, size_t length);
+ DisassemblerWin32(const uint8_t* start, size_t length);
CheckBool ParseFile(AssemblyProgram* target) WARN_UNUSED_RESULT;
bool ParseAbs32Relocs();
« no previous file with comments | « courgette/disassembler_elf_32_x86_unittest.cc ('k') | courgette/disassembler_win32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698