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

Unified Diff: courgette/rel32_finder.h

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: Rollback to original courgette algorithm and improve unittests Created 4 years, 7 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
Index: courgette/rel32_finder.h
diff --git a/courgette/rel32_finder_win32_x86.h b/courgette/rel32_finder.h
similarity index 57%
rename from courgette/rel32_finder_win32_x86.h
rename to courgette/rel32_finder.h
index 98ebd9825a471d9aba01a75635cd4058e710dbc9..d2e3ec670ab2a7eeae1cb8c66557b9394057e3e7 100644
--- a/courgette/rel32_finder_win32_x86.h
+++ b/courgette/rel32_finder.h
@@ -1,9 +1,9 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef COURGETTE_REL32_FINDER_WIN32_X86_H_
-#define COURGETTE_REL32_FINDER_WIN32_X86_H_
+#ifndef COURGETTE_REL32_FINDER_H_
+#define COURGETTE_REL32_FINDER_H_
#include <stdint.h>
@@ -15,10 +15,11 @@
namespace courgette {
// A helper class to scan through a section of code to extract RVAs.
-class Rel32FinderWin32X86 {
+class Rel32Finder {
public:
- Rel32FinderWin32X86(RVA relocs_start_rva, RVA relocs_end_rva);
- virtual ~Rel32FinderWin32X86();
+ Rel32Finder() = default;
huangs 2016/05/26 22:40:55 If the default constructor is unused (perhaps by s
etiennep 2016/05/27 18:12:34 Done.
+ Rel32Finder(RVA relocs_start_rva, RVA relocs_end_rva);
+ virtual ~Rel32Finder() = default;
// Swaps data in |rel32_locations_| with |dest|.
void SwapRel32Locations(std::vector<RVA>* dest);
@@ -38,11 +39,12 @@ class Rel32FinderWin32X86 {
const uint8_t* end_pointer,
RVA start_rva,
RVA end_rva,
+ uint32_t size_of_image_,
huangs 2016/05/26 22:11:17 |size_of_image|. Trailing underscore is for priva
etiennep 2016/05/27 18:12:34 Done.
const std::vector<RVA>& abs32_locations) = 0;
protected:
- const RVA relocs_start_rva_;
- const RVA relocs_end_rva_;
+ const RVA relocs_start_rva_ = 0;
huangs 2016/05/26 22:40:55 Remove " = 0" if we remove default constructor.
etiennep 2016/05/27 18:12:33 Done.
+ const RVA relocs_end_rva_ = 0;
std::vector<RVA> rel32_locations_;
@@ -51,21 +53,6 @@ class Rel32FinderWin32X86 {
#endif
};
-// The basic implementation performs naive scan for rel32 JMP and Jcc opcodes
-// (excluding JPO/JPE) disregarding instruction alignment.
-class Rel32FinderWin32X86_Basic : public Rel32FinderWin32X86 {
- public:
- Rel32FinderWin32X86_Basic(RVA relocs_start_rva, RVA relocs_end_rva);
- virtual ~Rel32FinderWin32X86_Basic();
-
- // Rel32FinderWin32X86 implementation.
- void Find(const uint8_t* start_pointer,
- const uint8_t* end_pointer,
- RVA start_rva,
- RVA end_rva,
- const std::vector<RVA>& abs32_locations) override;
-};
-
} // namespace courgette
-#endif // COURGETTE_REL32_FINDER_WIN32_X86_H_
+#endif // COURGETTE_REL32_FINDER_H_

Powered by Google App Engine
This is Rietveld 408576698