summaryrefslogtreecommitdiffstats
path: root/courgette/disassembler.h
diff options
context:
space:
mode:
Diffstat (limited to 'courgette/disassembler.h')
-rw-r--r--courgette/disassembler.h35
1 files changed, 2 insertions, 33 deletions
diff --git a/courgette/disassembler.h b/courgette/disassembler.h
index 0154ec4..abbec3a 100644
--- a/courgette/disassembler.h
+++ b/courgette/disassembler.h
@@ -8,19 +8,12 @@
#include "base/basictypes.h"
#include "courgette/courgette.h"
-
-// COURGETTE_HISTOGRAM_TARGETS prints out a histogram of how frequently
-// different target addresses are referenced. Purely for debugging.
-#define COURGETTE_HISTOGRAM_TARGETS 0
+#include "courgette/image_utils.h"
namespace courgette {
class AssemblyProgram;
-// A Relative Virtual Address is the address in the image file after it is
-// loaded into memory relative to the image load address.
-typedef uint32 RVA;
-
class Disassembler {
public:
virtual ~Disassembler();
@@ -59,31 +52,6 @@ class Disassembler {
return offset <= length() && elements <= (length() - offset) / element_size;
}
- // These helper functions avoid the need for casts in the main code.
- uint16 ReadU16(const uint8* address, size_t offset) {
- return *reinterpret_cast<const uint16*>(address + offset);
- }
-
- uint32 ReadU32(const uint8* address, size_t offset) {
- return *reinterpret_cast<const uint32*>(address + offset);
- }
-
- uint64 ReadU64(const uint8* address, size_t offset) {
- return *reinterpret_cast<const uint64*>(address + offset);
- }
-
- static uint32 Read32LittleEndian(const void* address) {
- return *reinterpret_cast<const uint32*>(address);
- }
-
- static uint64 Read64LittleEndian(const void* address) {
- return *reinterpret_cast<const uint64*>(address);
- }
-
- static uint16 Read16LittleEndian(const void* address) {
- return *reinterpret_cast<const uint16*>(address);
- }
-
// Reduce the length of the image in memory. Does not actually free
// (or realloc) any memory. Usually only called via ParseHeader()
void ReduceLength(size_t reduced_length);
@@ -104,4 +72,5 @@ class Disassembler {
};
} // namespace courgette
+
#endif // COURGETTE_DISASSEMBLER_H_