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

Unified Diff: courgette/rel32_finder_win32_x86.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: Improve rel32_finder doc 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_win32_x86.h
diff --git a/courgette/rel32_finder_win32_x86.h b/courgette/rel32_finder_win32_x86.h
deleted file mode 100644
index 98ebd9825a471d9aba01a75635cd4058e710dbc9..0000000000000000000000000000000000000000
--- a/courgette/rel32_finder_win32_x86.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2015 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_
-
-#include <stdint.h>
-
-#include <map>
-#include <vector>
-
-#include "courgette/image_utils.h"
-
-namespace courgette {
-
-// A helper class to scan through a section of code to extract RVAs.
-class Rel32FinderWin32X86 {
- public:
- Rel32FinderWin32X86(RVA relocs_start_rva, RVA relocs_end_rva);
- virtual ~Rel32FinderWin32X86();
-
- // Swaps data in |rel32_locations_| with |dest|.
- void SwapRel32Locations(std::vector<RVA>* dest);
-
-#if COURGETTE_HISTOGRAM_TARGETS
- // Swaps data in |rel32_target_rvas_| with |dest|.
- void SwapRel32TargetRVAs(std::map<RVA, int>* dest);
-#endif
-
- // Scans through [|start_pointer|, |end_pointer|) for rel32 addresses. Seeks
- // RVAs that satisfy the following:
- // - Do not overlap with |abs32_locations| (assumed sorted).
- // - Do not overlap with [relocs_start_rva, relocs_end_rva).
- // - Whose targets are in [|start_rva|, |end_rva|).
- // The sorted results are written to |rel32_locations_|.
- virtual void Find(const uint8_t* start_pointer,
- const uint8_t* end_pointer,
- RVA start_rva,
- RVA end_rva,
- const std::vector<RVA>& abs32_locations) = 0;
-
- protected:
- const RVA relocs_start_rva_;
- const RVA relocs_end_rva_;
-
- std::vector<RVA> rel32_locations_;
-
-#if COURGETTE_HISTOGRAM_TARGETS
- std::map<RVA, int> rel32_target_rvas_;
-#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_

Powered by Google App Engine
This is Rietveld 408576698