ecos_kernel_test: transfer instr_count, lowest- and highest_addr between STEP 2 and 3
git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1477 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
@ -22,6 +22,7 @@ using namespace fail;
|
|||||||
char const * const trace_filename = "trace.tc"; //TODO: sync with experiment.cc
|
char const * const trace_filename = "trace.tc"; //TODO: sync with experiment.cc
|
||||||
char const * const results_filename = "ecos_kernel_test.csv";
|
char const * const results_filename = "ecos_kernel_test.csv";
|
||||||
char const * const mm_filename = "memory_map.txt"; //TODO: sync with experiment.cc
|
char const * const mm_filename = "memory_map.txt"; //TODO: sync with experiment.cc
|
||||||
|
char const * const traceinfo_name = "trace_info.txt";
|
||||||
|
|
||||||
bool EcosKernelTestCampaign::readMemoryMap(fail::MemoryMap &mm, char const * const filename) {
|
bool EcosKernelTestCampaign::readMemoryMap(fail::MemoryMap &mm, char const * const filename) {
|
||||||
ifstream file(filename);
|
ifstream file(filename);
|
||||||
@ -45,6 +46,48 @@ bool EcosKernelTestCampaign::readMemoryMap(fail::MemoryMap &mm, char const * con
|
|||||||
return (count > 0);
|
return (count > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EcosKernelTestCampaign::writeTraceInfo(unsigned instr_counter, unsigned lowest_addr, unsigned highest_addr) {
|
||||||
|
ofstream ti(traceinfo_name, ios::out | ios::app);
|
||||||
|
if (!ti.is_open()) {
|
||||||
|
cout << "failed to open " << traceinfo_name << endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ti << instr_counter << endl << lowest_addr << endl << highest_addr << endl;
|
||||||
|
ti.flush();
|
||||||
|
ti.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EcosKernelTestCampaign::readTraceInfo(unsigned &instr_counter, unsigned &lowest_addr, unsigned &highest_addr) {
|
||||||
|
ifstream file(traceinfo_name);
|
||||||
|
if (!file.is_open()) {
|
||||||
|
cout << "failed to open " << traceinfo_name << endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
string buf;
|
||||||
|
unsigned count = 0;
|
||||||
|
|
||||||
|
while (getline(file, buf)) {
|
||||||
|
stringstream ss(buf, ios::in);
|
||||||
|
switch(count) {
|
||||||
|
case 0:
|
||||||
|
ss >> instr_counter;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
ss >> lowest_addr;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
ss >> highest_addr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
assert(count == 3);
|
||||||
|
return (count == 3);
|
||||||
|
}
|
||||||
|
|
||||||
// equivalence class type: addr, [i1, i2]
|
// equivalence class type: addr, [i1, i2]
|
||||||
// addr: byte to inject a bit-flip into
|
// addr: byte to inject a bit-flip into
|
||||||
// [i1, i2]: interval of instruction numbers, counted from experiment
|
// [i1, i2]: interval of instruction numbers, counted from experiment
|
||||||
@ -79,6 +122,10 @@ bool EcosKernelTestCampaign::run()
|
|||||||
}
|
}
|
||||||
ProtoIStream ps(&tracef);
|
ProtoIStream ps(&tracef);
|
||||||
|
|
||||||
|
// read trace info
|
||||||
|
unsigned instr_counter, lowest_addr, highest_addr;
|
||||||
|
EcosKernelTestCampaign::readTraceInfo(instr_counter, lowest_addr, highest_addr);
|
||||||
|
|
||||||
// a map of addresses of ECC protected objects
|
// a map of addresses of ECC protected objects
|
||||||
MemoryMap mm;
|
MemoryMap mm;
|
||||||
EcosKernelTestCampaign::readMemoryMap(mm, mm_filename);
|
EcosKernelTestCampaign::readMemoryMap(mm, mm_filename);
|
||||||
@ -210,10 +257,10 @@ bool EcosKernelTestCampaign::run()
|
|||||||
// map for keeping one "open" EC for every address
|
// map for keeping one "open" EC for every address
|
||||||
map<address_t, equivalence_class> open_ecs;
|
map<address_t, equivalence_class> open_ecs;
|
||||||
// experiment count
|
// experiment count
|
||||||
int count = 0;
|
unsigned count = 0;
|
||||||
|
|
||||||
// instruction counter within trace
|
// instruction counter within trace
|
||||||
int instr = 0;
|
unsigned instr = 0;
|
||||||
|
|
||||||
// fill open_ecs with one EC for every address
|
// fill open_ecs with one EC for every address
|
||||||
for (MemoryMap::iterator it = mm.begin(); it != mm.end(); ++it) {
|
for (MemoryMap::iterator it = mm.begin(); it != mm.end(); ++it) {
|
||||||
@ -225,7 +272,7 @@ bool EcosKernelTestCampaign::run()
|
|||||||
|
|
||||||
Trace_Event ev;
|
Trace_Event ev;
|
||||||
// for every event in the trace ...
|
// for every event in the trace ...
|
||||||
while (ps.getNext(&ev) && instr < ECOS_NUMINSTR) {
|
while (ps.getNext(&ev) && instr < instr_counter) {
|
||||||
// instruction events just get counted
|
// instruction events just get counted
|
||||||
if (!ev.has_memaddr()) {
|
if (!ev.has_memaddr()) {
|
||||||
// new instruction
|
// new instruction
|
||||||
|
|||||||
@ -15,5 +15,7 @@ class EcosKernelTestCampaign : public fail::Campaign {
|
|||||||
public:
|
public:
|
||||||
virtual bool run();
|
virtual bool run();
|
||||||
static bool readMemoryMap(fail::MemoryMap &mm, char const * const filename);
|
static bool readMemoryMap(fail::MemoryMap &mm, char const * const filename);
|
||||||
|
static bool writeTraceInfo(unsigned instr_counter, unsigned lowest_addr, unsigned highest_addr);
|
||||||
|
static bool readTraceInfo(unsigned &instr_counter, unsigned &lowest_addr, unsigned &highest_addr);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,8 @@ using namespace fail;
|
|||||||
|
|
||||||
|
|
||||||
char const * const mm_filename = "memory_map.txt";
|
char const * const mm_filename = "memory_map.txt";
|
||||||
char const *statename = "ecos_kernel_test.state";
|
char const * const statename = "ecos_kernel_test.state";
|
||||||
|
char const * const traceinfo_name = "trace_info.txt";
|
||||||
|
|
||||||
#if PREREQUISITES
|
#if PREREQUISITES
|
||||||
bool EcosKernelTestExperiment::retrieveGuestAddresses() {
|
bool EcosKernelTestExperiment::retrieveGuestAddresses() {
|
||||||
@ -200,7 +201,9 @@ bool EcosKernelTestExperiment::performTrace() {
|
|||||||
|
|
||||||
log << dec << "tracing finished after " << instr_counter << " instructions" << endl;
|
log << dec << "tracing finished after " << instr_counter << " instructions" << endl;
|
||||||
log << hex << "all memory accesses within [ 0x" << lowest_addr << " , 0x" << highest_addr << " ]" << endl;
|
log << hex << "all memory accesses within [ 0x" << lowest_addr << " , 0x" << highest_addr << " ]" << endl;
|
||||||
//TODO: safe these values for experiment STEP 3
|
|
||||||
|
// save these values for experiment STEP 3
|
||||||
|
EcosKernelTestCampaign::writeTraceInfo(instr_counter, lowest_addr, highest_addr);
|
||||||
|
|
||||||
simulator.removeFlow(&tp);
|
simulator.removeFlow(&tp);
|
||||||
|
|
||||||
@ -222,6 +225,10 @@ bool EcosKernelTestExperiment::performTrace() {
|
|||||||
bool EcosKernelTestExperiment::faultInjection() {
|
bool EcosKernelTestExperiment::faultInjection() {
|
||||||
log << "STEP 3: The actual experiment." << endl;
|
log << "STEP 3: The actual experiment." << endl;
|
||||||
|
|
||||||
|
// read trace info
|
||||||
|
unsigned instr_counter, lowest_addr, highest_addr;
|
||||||
|
EcosKernelTestCampaign::readTraceInfo(instr_counter, lowest_addr, highest_addr);
|
||||||
|
|
||||||
BPSingleListener bp;
|
BPSingleListener bp;
|
||||||
|
|
||||||
#if !LOCAL
|
#if !LOCAL
|
||||||
@ -338,12 +345,14 @@ bool EcosKernelTestExperiment::faultInjection() {
|
|||||||
// 10000us = 500000 instructions
|
// 10000us = 500000 instructions
|
||||||
TimerListener ev_timeout(500000);
|
TimerListener ev_timeout(500000);
|
||||||
simulator.addListener(&ev_timeout);
|
simulator.addListener(&ev_timeout);
|
||||||
//TODO: if ev_timeout would depend on ECOS_NUMINSTR, ev_end would not be needed!
|
//TODO: if ev_timeout would depend on instr_counter, ev_end would not be needed!
|
||||||
// --> (ECOS_NUMINSTR + ECOS_RECOVERYINSTR) * factor?
|
// --> (instr_counter + ECOS_RECOVERYINSTR) * factor?
|
||||||
|
|
||||||
// remaining instructions until "normal" ending
|
// remaining instructions until "normal" ending
|
||||||
|
// number of instructions that are executed additionally for error corrections
|
||||||
|
enum { ECOS_RECOVERYINSTR = 0x2000 }; // (this is a rough guess ... TODO)
|
||||||
BPSingleListener ev_end(ANY_ADDR);
|
BPSingleListener ev_end(ANY_ADDR);
|
||||||
ev_end.setCounter(ECOS_NUMINSTR + ECOS_RECOVERYINSTR - instr_offset);
|
ev_end.setCounter(instr_counter + ECOS_RECOVERYINSTR - instr_offset);
|
||||||
simulator.addListener(&ev_end);
|
simulator.addListener(&ev_end);
|
||||||
|
|
||||||
// eCos' test output function, which will show if the test PASSed or FAILed
|
// eCos' test output function, which will show if the test PASSed or FAILed
|
||||||
|
|||||||
@ -32,11 +32,6 @@ cat <<EOF
|
|||||||
// nm -C $(basename $1)|fgrep _etext
|
// nm -C $(basename $1)|fgrep _etext
|
||||||
#define ECOS_TEXT_END 0x`addrof $1 _etext`
|
#define ECOS_TEXT_END 0x`addrof $1 _etext`
|
||||||
|
|
||||||
// number of instructions the target executes under non-error conditions from ENTRY to FINISH:
|
|
||||||
#define ECOS_NUMINSTR 71618
|
|
||||||
// number of instructions that are executed additionally for error corrections
|
|
||||||
// (this is a rough guess ... TODO)
|
|
||||||
#define ECOS_RECOVERYINSTR 0x2000
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user