Code cleanup remove non-intruction-filtering part which is unused and broken
This commit is contained in:
@ -216,13 +216,8 @@ L4SysExperiment::prepareMemoryExperiment(int ip, int offset, int dataAddress)
|
|||||||
log << "\033[34;1mMemory fault injection\033[0m at instruction " << std::hex << offset
|
log << "\033[34;1mMemory fault injection\033[0m at instruction " << std::hex << offset
|
||||||
<< ", ip " << ip << ", address " << dataAddress << std::endl;
|
<< ", ip " << ip << ", address " << dataAddress << std::endl;
|
||||||
|
|
||||||
#if L4SYS_FILTER_INSTRUCTIONS
|
|
||||||
setupFilteredBreakpoint(bp, offset, conf.instruction_list);
|
setupFilteredBreakpoint(bp, offset, conf.instruction_list);
|
||||||
assert(bp->getWatchInstructionPointer() == (address_t)(ip & 0xFFFFFFFF));
|
assert(bp->getWatchInstructionPointer() == (address_t)(ip & 0xFFFFFFFF));
|
||||||
#else
|
|
||||||
bp->setWatchInstructionPointer(ANY_ADDR);
|
|
||||||
bp->setCounter(offset);
|
|
||||||
#endif
|
|
||||||
return bp;
|
return bp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,17 +235,11 @@ L4SysExperiment::prepareRegisterExperiment(int ip, int offset, int dataAddress)
|
|||||||
<< " reg data (" << reg << ", "
|
<< " reg data (" << reg << ", "
|
||||||
<< regOffset << ")" << std::endl;
|
<< regOffset << ")" << std::endl;
|
||||||
|
|
||||||
#if L4SYS_FILTER_INSTRUCTIONS
|
|
||||||
setupFilteredBreakpoint(bp, offset, conf.instruction_list);
|
setupFilteredBreakpoint(bp, offset, conf.instruction_list);
|
||||||
log << bp->getWatchInstructionPointer() << std::endl;
|
log << bp->getWatchInstructionPointer() << std::endl;
|
||||||
log << ip << std::endl;
|
log << ip << std::endl;
|
||||||
assert(bp->getWatchInstructionPointer() == (address_t)(ip & 0xFFFFFFFF));
|
assert(bp->getWatchInstructionPointer() == (address_t)(ip & 0xFFFFFFFF));
|
||||||
log << bp->getCounter() << std::endl;
|
log << bp->getCounter() << std::endl;
|
||||||
#else
|
|
||||||
log << "Exp offset: " << offset << std::endl;
|
|
||||||
bp->setWatchInstructionPointer(ANY_ADDR);
|
|
||||||
bp->setCounter(offset);
|
|
||||||
#endif
|
|
||||||
return bp;
|
return bp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,9 +345,7 @@ void L4SysExperiment::doExperiments(fail::BPSingleListener* bp) {
|
|||||||
<< " Start time " << now << ", new time " << simulator.getTimerTicks()
|
<< " Start time " << now << ", new time " << simulator.getTimerTicks()
|
||||||
<< ", diff = " << simulator.getTimerTicks() - now << std::endl;
|
<< ", diff = " << simulator.getTimerTicks() - now << std::endl;
|
||||||
|
|
||||||
#if L4SYS_FILTER_INSTRUCTIONS
|
|
||||||
assert(bp->getTriggerInstructionPointer() == bp->getWatchInstructionPointer());
|
assert(bp->getTriggerInstructionPointer() == bp->getWatchInstructionPointer());
|
||||||
#endif
|
|
||||||
result->set_injection_ip(bp->getTriggerInstructionPointer());
|
result->set_injection_ip(bp->getTriggerInstructionPointer());
|
||||||
|
|
||||||
if (exp_type == param->msg.MEM) {
|
if (exp_type == param->msg.MEM) {
|
||||||
|
|||||||
@ -78,7 +78,6 @@ void L4SysExperiment::collectInstructionTrace(fail::BPSingleListener* bp)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if L4SYS_FILTER_INSTRUCTIONS
|
|
||||||
ofstream instr_list_file(conf.instruction_list.c_str(), ios::binary);
|
ofstream instr_list_file(conf.instruction_list.c_str(), ios::binary);
|
||||||
RangeSetInstructionFilter filtering(conf.filter.c_str());
|
RangeSetInstructionFilter filtering(conf.filter.c_str());
|
||||||
bp->setWatchInstructionPointer(ANY_ADDR);
|
bp->setWatchInstructionPointer(ANY_ADDR);
|
||||||
@ -185,68 +184,12 @@ void L4SysExperiment::collectInstructionTrace(fail::BPSingleListener* bp)
|
|||||||
instr_list_file.close();
|
instr_list_file.close();
|
||||||
log << "test function calculation position reached after "
|
log << "test function calculation position reached after "
|
||||||
<< dec << count << " instructions; " << inst_accepted << " accepted" << endl;
|
<< dec << count << " instructions; " << inst_accepted << " accepted" << endl;
|
||||||
log << "mem accesses: " << mem << ", valid: " << mem_valid << std::endl;
|
log << "mem accesses: " << mem << ", valid: " << mem_valid << std::endl;
|
||||||
#else
|
|
||||||
bp->setWatchInstructionPointer(ANY_ADDR);
|
|
||||||
while (bp->getTriggerInstructionPointer() != conf.func_exit)
|
|
||||||
{
|
|
||||||
fail::BaseListener *res = simulator.resume();
|
|
||||||
address_t curr_addr = 0;
|
|
||||||
|
|
||||||
// XXX: See the API problem below!
|
conf.numinstr = inst_accepted;
|
||||||
if (res == &ML) {
|
conf.totinstr = count;
|
||||||
curr_addr = ML.getTriggerInstructionPointer();
|
|
||||||
simulator.addListener(&ML);
|
|
||||||
if ((func.address_space_trace != ANY_ADDR) && (BX_CPU(0)->cr3 != func.address_space_trace)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
++mem;
|
|
||||||
} else if (res == bp) {
|
|
||||||
curr_addr = bp->getTriggerInstructionPointer();
|
|
||||||
assert(curr_addr == simulator.getCPU(0).getInstructionPointer());
|
|
||||||
simulator.addListener(bp);
|
|
||||||
++count;
|
|
||||||
}
|
|
||||||
#if 0
|
|
||||||
if (curr_addr < 0xC0000000) // XXX filter for kernel-only experiment
|
|
||||||
continue;
|
|
||||||
#endif
|
|
||||||
currtime = simulator.getTimerTicks();
|
|
||||||
deltatime = currtime - prevtime;
|
|
||||||
|
|
||||||
if (res == &ML) {
|
delete bp;
|
||||||
#if 0
|
|
||||||
log << "Memory event IP " << std::hex << ML.getTriggerInstructionPointer()
|
|
||||||
<< " @ " << ML.getTriggerAddress() << "("
|
|
||||||
<< ML.getTriggerAccessType() << "," << ML.getTriggerWidth()
|
|
||||||
<< ")" << std::endl;
|
|
||||||
#endif
|
|
||||||
++mem_valid;
|
|
||||||
|
|
||||||
Trace_Event te;
|
|
||||||
if (deltatime != 0) { te.set_time_delta(deltatime); };
|
|
||||||
te.set_ip(curr_addr);
|
|
||||||
te.set_memaddr(ML.getTriggerAddress());
|
|
||||||
te.set_accesstype( (ML.getTriggerAccessType() & MemAccessEvent::MEM_READ) ? te.READ : te.WRITE );
|
|
||||||
te.set_width(ML.getTriggerWidth());
|
|
||||||
os->writeMessage(&te);
|
|
||||||
} else if (res == bp) {
|
|
||||||
Trace_Event e;
|
|
||||||
if (deltatime != 0) { e.set_time_delta(deltatime); };
|
|
||||||
e.set_ip(curr_addr);
|
|
||||||
os->writeMessage(&e);
|
|
||||||
} else {
|
|
||||||
printf("Unknown res? %p\n", res);
|
|
||||||
}
|
|
||||||
prevtime = currtime;
|
|
||||||
}
|
|
||||||
log << "test function calculation position reached after "
|
|
||||||
<< dec << count << " instructions; " << count << " accepted" << endl;
|
|
||||||
log << "mem accesses: " << mem << ", valid: " << mem_valid << std::endl;
|
|
||||||
#endif
|
|
||||||
conf.numinstr = inst_accepted;
|
|
||||||
conf.totinstr = count;
|
|
||||||
delete bp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void L4SysExperiment::goldenRun(fail::BPSingleListener* bp)
|
void L4SysExperiment::goldenRun(fail::BPSingleListener* bp)
|
||||||
|
|||||||
Reference in New Issue
Block a user