-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmemory_trace.h
58 lines (51 loc) · 1.44 KB
/
memory_trace.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef MEMORYTRACE_H
#define MEMORYTRACE_H
#include <map>
#include <iostream>
extern "C" {
#include "simics/api.h"
#include "simics/arch/x86.h"
}
using namespace std;
#define LINE_BYTES 16
class MemOp {
public:
MemOp(processor_t* cpu, physical_address_t addr, int, uint32);
~MemOp();
physical_address_t getAddress(void);
uint32 getData(physical_address_t addr, int);
void setData(physical_address_t addr, int, uint32);
int getSize(void);
private:
physical_address_t mAddress;
unsigned int mData;
int mSize;
void setChunk(int, int, uint32);
uint32 getChunk(int, int);
};
class MemoryTrace {
public:
MemoryTrace(processor_t *);
~MemoryTrace();
void clear();
void commit_writes();
bool has_read(physical_address_t addr, int size);
int getWriteBufferSize();
physical_address_t getBufferedWrite(int index);
void OperateMemoryRead(generic_transaction_t *);
void OperateMemoryWrite(generic_transaction_t *);
void ObserveMemoryRead(generic_transaction_t *);
void ObserveMemoryWrite(generic_transaction_t *);
void earlyRelease(int address);
uinteger_t getHighData(generic_transaction_t *);
uinteger_t getLowData(generic_transaction_t *);
private:
processor_t *cpu;
unsigned int observes;
unsigned int operates;
unsigned int unique_writes;
unsigned int read_from_writes;
map<physical_address_t, char> read_set;
map<physical_address_t, MemOp*> write_set;
};
#endif