Minimal VEZS example experiment
git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1440 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
@ -25,63 +25,56 @@ using namespace fail;
|
|||||||
#error This experiment needs: breakpoints, traps, save, and restore. Enable these in the configuration.
|
#error This experiment needs: breakpoints, traps, save, and restore. Enable these in the configuration.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool ChecksumOOStuBSExperiment::run()
|
bool VEZSExperiment::run()
|
||||||
{
|
{
|
||||||
Logger log("VEZS-Example", false);
|
Logger log("VEZS-Example", false);
|
||||||
BPSingleEvent bp;
|
|
||||||
|
|
||||||
log << "startup" << endl;
|
log << "startup" << endl;
|
||||||
|
BPSingleEvent bp;
|
||||||
|
#if 1
|
||||||
|
// STEP 1: run until interesting function starts, and save state
|
||||||
|
bp.setWatchInstructionPointer(OOSTUBS_FUNC_ENTRY);
|
||||||
|
simulator.addEventAndWait(&bp);
|
||||||
|
log << "test function entry reached, saving state" << endl;
|
||||||
|
log << "EIP = " << hex << bp.getTriggerInstructionPointer() << " or " << simulator.getRegisterManager().getInstructionPointer() << endl;
|
||||||
|
simulator.save("vezs.state");
|
||||||
|
#endif
|
||||||
|
#if 0
|
||||||
|
|
||||||
bp.setWatchInstructionPointer(ANY_ADDR);
|
int bit_offset = 2;
|
||||||
bp.setCounter(OOSTUBS_NUMINSTR);
|
for (int instr_offset = 0; instr_offset < OOSTUBS_NUMINSTR; ++instr_offset) {
|
||||||
|
|
||||||
//simulator.addEvent(&bp);
|
// STEP 3: The actual experiment.
|
||||||
// BPSingleEvent ev_count(ANY_ADDR);
|
log << "restoring state" << endl;
|
||||||
// simulator.addEvent(&ev_count);
|
simulator.restore("vezs.state");
|
||||||
|
|
||||||
for (int i = 0; i < 400; ++i) { // more than 400 will be very slow (500 is max)
|
log << "EIP = " << hex << simulator.getRegisterManager().getInstructionPointer() << endl;
|
||||||
|
|
||||||
// XXX debug
|
|
||||||
int instr_offset = 1000;
|
|
||||||
|
|
||||||
// reaching finish() could happen before OR after FI
|
|
||||||
BPSingleEvent func_finish(OOSTUBS_FUNC_FINISH);
|
|
||||||
simulator.addEvent(&func_finish);
|
|
||||||
bool finish_reached = false;
|
|
||||||
|
|
||||||
bp.setWatchInstructionPointer(ANY_ADDR);
|
bp.setWatchInstructionPointer(ANY_ADDR);
|
||||||
bp.setCounter(instr_offset);
|
for (int count = 0; count < instr_offset; ++count) {
|
||||||
simulator.addEvent(&bp);
|
simulator.addEventAndWait(&bp);
|
||||||
|
|
||||||
// finish() before FI?
|
|
||||||
if (simulator.waitAny() == &func_finish) {
|
|
||||||
finish_reached = true;
|
|
||||||
log << "experiment reached finish() before FI" << endl;
|
|
||||||
|
|
||||||
// wait for bp
|
|
||||||
simulator.waitAny();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// --- fault injection ---
|
int32_t data = simulator.getRegisterManager().getRegister(RID_CAX)->getData();
|
||||||
//byte_t newdata = data ^ (1 << bit_offset);
|
// The INJECTION:
|
||||||
//mm.setByte(mem_addr, newdata);
|
int32_t newdata = data ^ (1<<bit_offset);
|
||||||
// note at what IP we did it
|
simulator.getRegisterManager().getRegister(RID_CAX)->setData(newdata);
|
||||||
|
|
||||||
int32_t injection_ip = simulator.getRegisterManager().getInstructionPointer();
|
int32_t injection_ip = simulator.getRegisterManager().getInstructionPointer();
|
||||||
log << "fault injected @ ip " << injection_ip << endl;
|
log << "inject @ ip " << injection_ip
|
||||||
|
<< " (offset " << dec << instr_offset << ")"
|
||||||
|
<< " bit " << bit_offset << ": 0x"
|
||||||
|
<< hex << ((int)data) << " -> 0x" << ((int)newdata) << endl;
|
||||||
|
|
||||||
// --- aftermath ---
|
// --- aftermath ---
|
||||||
// possible outcomes:
|
// possible outcomes:
|
||||||
// - trap, "crash"
|
// - trap, "crash"
|
||||||
// - jump outside text segment
|
// - jump outside text segment
|
||||||
// - (XXX unaligned jump inside text segment)
|
|
||||||
// - (XXX weird instructions?)
|
|
||||||
// - (XXX results displayed?)
|
|
||||||
// - reaches THE END
|
// - reaches THE END
|
||||||
// - error detected, stop
|
// - error detected, stop
|
||||||
// additional info:
|
// additional info:
|
||||||
// - #loop iterations before/after FI
|
// - #loop iterations before/after FI
|
||||||
// - (XXX "sane" display?)
|
|
||||||
|
|
||||||
// catch traps as "extraordinary" ending
|
// catch traps as "extraordinary" ending
|
||||||
TrapEvent ev_trap(ANY_TRAP);
|
TrapEvent ev_trap(ANY_TRAP);
|
||||||
@ -98,23 +91,14 @@ bool ChecksumOOStuBSExperiment::run()
|
|||||||
|
|
||||||
// remaining instructions until "normal" ending
|
// remaining instructions until "normal" ending
|
||||||
BPSingleEvent ev_end(ANY_ADDR);
|
BPSingleEvent ev_end(ANY_ADDR);
|
||||||
ev_end.setCounter(OOSTUBS_NUMINSTR + OOSTUBS_RECOVERYINSTR - instr_offset);
|
ev_end.setCounter(OOSTUBS_NUMINSTR - instr_offset);
|
||||||
simulator.addEvent(&ev_end);
|
simulator.addEvent(&ev_end);
|
||||||
|
|
||||||
// Start simulator and wait for any result
|
// Start simulator and wait for any result
|
||||||
BaseEvent* ev = simulator.waitAny();
|
BaseEvent* ev = simulator.waitAny();
|
||||||
|
|
||||||
// Do we reach finish() while waiting for ev_trap/ev_done?
|
|
||||||
if (ev == &func_finish) {
|
|
||||||
finish_reached = true;
|
|
||||||
log << "experiment reached finish()" << endl;
|
|
||||||
|
|
||||||
// wait for ev_trap/ev_done
|
|
||||||
ev = simulator.waitAny();
|
|
||||||
}
|
|
||||||
|
|
||||||
// record latest IP regardless of result
|
// record latest IP regardless of result
|
||||||
//simulator.getRegisterManager().getInstructionPointer();
|
injection_ip = simulator.getRegisterManager().getInstructionPointer();
|
||||||
|
|
||||||
|
|
||||||
if (ev == &ev_end) {
|
if (ev == &ev_end) {
|
||||||
@ -128,11 +112,13 @@ bool ChecksumOOStuBSExperiment::run()
|
|||||||
} else {
|
} else {
|
||||||
log << "Result WTF?" << endl;
|
log << "Result WTF?" << endl;
|
||||||
}
|
}
|
||||||
|
log << "@ ip 0x" << hex << injection_ip << endl;
|
||||||
// explicitly remove all events before we leave their scope
|
// explicitly remove all events before we leave their scope
|
||||||
// FIXME event destructors should remove them from the queues
|
// FIXME event destructors should remove them from the queues
|
||||||
simulator.clearEvents();
|
simulator.clearEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
// Explicitly terminate, or the simulator will continue to run.
|
// Explicitly terminate, or the simulator will continue to run.
|
||||||
simulator.terminate();
|
simulator.terminate();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,10 +4,10 @@
|
|||||||
#include "efw/ExperimentFlow.hpp"
|
#include "efw/ExperimentFlow.hpp"
|
||||||
#include "efw/JobClient.hpp"
|
#include "efw/JobClient.hpp"
|
||||||
|
|
||||||
class ChecksumOOStuBSExperiment : public fail::ExperimentFlow {
|
class VEZSExperiment : public fail::ExperimentFlow {
|
||||||
fail::JobClient m_jc;
|
fail::JobClient m_jc;
|
||||||
public:
|
public:
|
||||||
ChecksumOOStuBSExperiment() : m_jc("ios.cs.tu-dortmund.de") {}
|
VEZSExperiment() : m_jc("ios.cs.tu-dortmund.de") {}
|
||||||
bool run();
|
bool run();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -3,48 +3,22 @@
|
|||||||
|
|
||||||
// FIXME autogenerate this
|
// FIXME autogenerate this
|
||||||
|
|
||||||
#if 1 // with ECC
|
|
||||||
|
|
||||||
// the task function's entry address:
|
// the task function's entry address:
|
||||||
// nm -C ecc.elf|fgrep main
|
// nm -C ecc.elf|fgrep main
|
||||||
#define OOSTUBS_FUNC_ENTRY 0x00101eaa
|
#define OOSTUBS_FUNC_ENTRY 0x001009d0
|
||||||
// empty function that is called explicitly when the experiment finished
|
// empty function that is called explicitly when the experiment finished
|
||||||
// nm -C ecc.elf|fgrep "finished()"
|
// nm -C ecc.elf|fgrep "finished()"
|
||||||
#define OOSTUBS_FUNC_FINISH 0x00106da4
|
#define OOSTUBS_FUNC_FINISH 0x001009d6
|
||||||
// function executing HLT with no chance for further progress (after panic())
|
// function executing HLT with no chance for further progress (after panic())
|
||||||
// nm -C ecc.elf|fgrep cpu_halt
|
// nm -C ecc.elf|fgrep cpu_halt
|
||||||
#define OOSTUBS_FUNC_CPU_HALT 0x001009f7
|
#define OOSTUBS_FUNC_CPU_HALT 0x001009f7
|
||||||
|
|
||||||
// nm -C ecc.elf | fgrep "_TEXT_"
|
// nm -C ecc.elf | fgrep "_TEXT_"
|
||||||
#define OOSTUBS_TEXT_START 0x00100000
|
#define OOSTUBS_TEXT_START 0x00100000
|
||||||
#define OOSTUBS_TEXT_END 0x00107cbf
|
#define OOSTUBS_TEXT_END 0x00100a1b
|
||||||
|
|
||||||
// number of instructions the target executes under non-error conditions from ENTRY to DONE:
|
#define OOSTUBS_NUMINSTR 5
|
||||||
// (result of experiment's step #2)
|
|
||||||
#define OOSTUBS_NUMINSTR 0x4B16E6
|
|
||||||
// number of instructions that are executed additionally for error corrections
|
|
||||||
// (this is a rough guess ... TODO)
|
|
||||||
#define OOSTUBS_RECOVERYINSTR 0x2000
|
|
||||||
// the variable that's increased if ECC corrects an error:
|
|
||||||
// nm -C ecc.elf|fgrep errors_corrected
|
|
||||||
#define OOSTUBS_ERROR_CORRECTED 0x0010baf0
|
|
||||||
//
|
|
||||||
// nm -C ecc.elf|fgrep results
|
|
||||||
#define OOSTUBS_RESULTS_ADDR 0x0010ae6c
|
|
||||||
#define OOSTUBS_RESULTS_BYTES 12
|
|
||||||
#define OOSTUBS_RESULT0 0xab3566a9
|
|
||||||
#define OOSTUBS_RESULT1 0x44889112
|
|
||||||
#define OOSTUBS_RESULT2 0x10420844
|
|
||||||
|
|
||||||
#else // without ECC
|
|
||||||
|
|
||||||
#define COOL_ECC_FUNC_ENTRY 0x00200a90
|
|
||||||
#define COOL_ECC_CALCDONE 0x00200ab7
|
|
||||||
#define COOL_ECC_NUMINSTR 97
|
|
||||||
#define COOL_ECC_OBJUNDERTEST 0x0021263c
|
|
||||||
#define COOL_ECC_OBJUNDERTEST_SIZE 10
|
|
||||||
#define COOL_ECC_ERROR_CORRECTED 0x002127b0 // dummy
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __EXPERIMENT_INFO_HPP__
|
#endif // __EXPERIMENT_INFO_HPP__
|
||||||
|
|||||||
Reference in New Issue
Block a user