From 674af5fd001a4ba0df45cfd90e679df27a04d204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20D=C3=B6bel?= Date: Tue, 27 Aug 2013 12:59:19 +0200 Subject: [PATCH] Separate boundaries for output tracing and injection * L4SYS_FUNC_{ENTRY,EXIT} now determines the range upon which an experiment is run. These instructions produce the output that is relevant for the experiment. * L4SYS_FILTER_{ENTRY,EXIT} determine a subset of the above instructions. FI experiments are performed on this subset (between first occurrence of FILTER_ENTRY and first occurrence of FILTER_EXIT inclusively). Change-Id: I37d2189d8256b6b707a0a33984f2b2656071d983 --- src/experiments/l4-sys/experiment.cc | 16 +++++++++++++--- src/experiments/l4-sys/experimentInfo.hpp | 11 +++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/experiments/l4-sys/experiment.cc b/src/experiments/l4-sys/experiment.cc index 0dd7d695..354d7ef0 100644 --- a/src/experiments/l4-sys/experiment.cc +++ b/src/experiments/l4-sys/experiment.cc @@ -228,11 +228,12 @@ void L4SysExperiment::collectInstructionTrace(fail::BPSingleListener& bp) #ifdef L4SYS_FILTER_INSTRUCTIONS ofstream instr_list_file(L4SYS_INSTRUCTION_LIST, ios::binary); - RangeSetInstructionFilter rsif(L4SYS_FILTER); + RangeSetInstructionFilter filtering(L4SYS_FILTER); bp.setWatchInstructionPointer(ANY_ADDR); size_t count = 0, accepted = 0; map times_called_map; + bool injecting = false; while (bp.getTriggerInstructionPointer() != L4SYS_FUNC_EXIT) { simulator.addListenerAndResume(&bp); @@ -245,10 +246,19 @@ void L4SysExperiment::collectInstructionTrace(fail::BPSingleListener& bp) unsigned times_called = times_called_map[curr_addr]; times_called++; times_called_map[curr_addr] = times_called; + + if (curr_addr == L4SYS_FILTER_ENTRY) { + injecting = true; + } + + if (curr_addr == L4SYS_FILTER_EXIT) { + injecting = false; + } // now check if we want to add the instruction for fault injection - if (rsif.isValidInstr(curr_addr, - reinterpret_cast(calculateInstructionAddress()))) { + if (injecting and filtering.isValidInstr(curr_addr, + reinterpret_cast(calculateInstructionAddress())) + ) { accepted++; TraceInstr new_instr; log << "writing IP " << hex << curr_addr << " counter " diff --git a/src/experiments/l4-sys/experimentInfo.hpp b/src/experiments/l4-sys/experimentInfo.hpp index a1724dda..829250a5 100644 --- a/src/experiments/l4-sys/experimentInfo.hpp +++ b/src/experiments/l4-sys/experimentInfo.hpp @@ -6,10 +6,21 @@ // the bounds of the program (space, instructions and time) #define L4SYS_ADDRESS_SPACE 0x1fd4c000 + +// FUNC_{ENTRY,EXIT} specifies the range that needs to +// be captured to log program output properly #define L4SYS_FUNC_ENTRY 0x010002a0 #define L4SYS_FUNC_EXIT 0x01000380 +// FILTER_{ENTRY,EXIT} specifies the range that injections +// should be carried out on (should be a subset of the above) +// and only works with FILTER_INSTRUCTIONS turned on +#define L4SYS_FILTER_ENTRY 0x0100031c +#define L4SYS_FILTER_EXIT 0x01000380 // select instruction filtering +// XXX: this should be always on and the code should be +// reworked to do the non-filtering work with an empty +// filter list #define L4SYS_FILTER_INSTRUCTIONS 1 // kernel: 2377547, userland: 79405472