exchange experimentInfo.hpp by experiment.conf which is know paresd during

runtime (no recompile anymore)
This commit is contained in:
Tobias Stumpf
2014-06-17 17:08:14 +02:00
parent 074eeab399
commit a20d3cd12f
8 changed files with 262 additions and 208 deletions

View File

@ -1,97 +1,43 @@
#!/bin/bash
# Script to automate the preparation steps for an L4Sys experiment
#
# The L4Sys experiment manual lists four steps that need to be performed
# in order to launch an L4Sys campaign. This script automates the final
# three steps.
#
# Usage: Follow the manual. Find injection addresses and CR3 value and
# adjust experimentInfo.hpp accordingly. Then run this script.
#
# TODO: Adjust $FAILDIR to your needs!
BAK=experimentInfo.hpp.bak
CFG=experimentInfo.hpp
FAIL_CMD="fail-client -q" # -rc bochs-dbg.rc"
FAILDIR=/home/doebel/src/fail
DBNAME=fail
FAIL_CMD="fail-client" # -rc bochs-dbg.rc"
FAIL_ARGS="-f bochsrc-bd -q"
FAILDIR=/home/tstumpf/code/fail
BUILDDIR=/home/tstumpf/obj/fail
DBNAME=failtobias
BINDIR=~/local/bin
if [ -n "$1" ] ; then
if [ "$1" = "mem" ]; then
IMPORTER=MemoryImporter;
fi
fi
TYPE=$1
if [ "$IMPORTER" = "MemoryImporter" ]; then
echo "Preparing memory injection experiment."
echo -e "\033[32;1m=========================================================================================="
echo "[$(date)] Prepare FI-Experiment ...."
echo -e "==========================================================================================\033[0m"
if [ -n $TYPE ] ; then
if [ $TYPE = "mem" ]; then
IMPORTER=MemoryImporter;
echo "Preparing memory injection experiment."
elif [ $TYPE = "reg" ]; then
IMPORTER=RegisterImporter;
echo "Preparing register injection experiment."
else
echo "Specified experiment type not knwon";
exit
fi
else
IMPORTER=RegisterImporter;
echo "Preparing register injection experiment."
echo "Specify your experiment type (mem/reg)"
exit
fi
function buildfail {
echo -e "\033[33mCompiling....\033[0m"
cd $FAILDIR/build
FAIL_BUILD_PARALLEL=16 $FAILDIR/scripts/rebuild-bochs.sh - >/dev/null
cd -
}
function BuildNRun {
buildfail
echo -e "\033[33mRunning...\033[0m"
$FAIL_CMD $@
}
# backup experiment config
cp $CFG $BAK
blink_addr=$(nm -C fiasco.image| grep blink | cut -d\ -f 1)
longjmp_addr=$(nm -C fiasco.image| grep longjmp | cut -d\ -f 1)
#echo -e "\033[35;1m[$(date)] ================== Step 0: Getting CR3 =================\033[0m"
#cat $BAK | sed -e 's/PREPARATION_STEP.*/PREPARATION_STEP 4/' >$CFG
#buildfail
#cr3=`$FAIL_CMD -f bochsrc-bd 2>/dev/null | grep CR3 | sed -e 's/ //g' | cut -d\= -f 2`
#echo \#defne L4SYS_ADDRESS_SPACE 0x$cr3
#cat $BAK | sed -e "s/L4SYS_ADDRESS_SPACE .*/L4SYS_ADDRESS_SPACE 0x$cr3/" >$CFG
mv $CFG $BAK
cat $BAK | sed -e "s/L4SYS_BREAK_BLINK .*/L4SYS_BREAK_BLINK 0x$blink_addr/" >$CFG
mv $CFG $BAK
cat $BAK | sed -e "s/L4SYS_BREAK_LONGJMP .*/L4SYS_BREAK_LONGJMP 0x$longjmp_addr/" >$CFG
mv $CFG $BAK
echo -e "\033[35;1m[$(date)] ================== Step 1: Generating Snapshot =================\033[0m"
cat $BAK | sed -e 's/PREPARATION_STEP.*/PREPARATION_STEP 1/' >$CFG
BuildNRun -f bochsrc-bd
echo -e "\033[35;1m[$(date)] ================== Step 2: Get Instruction Count ===============\033[0m"
cat $BAK | sed -e 's/PREPARATION_STEP.*/PREPARATION_STEP 2/' >$CFG
buildfail
echo -e "\033[32mRunning...\033[0m"
values=`$FAIL_CMD 2>/dev/null | grep instructions\; | sed -e 's/.*after \(.*\) instructions;\(.*\) accepted/\1 \2/'`
echo $values
filtered_instr=`echo $values | cut -d\ -f 2`
total_instr=`echo $values | cut -d\ -f 1`
echo -e "\033[35;1m[$(date)] ================== Step 3: Golden Run ==========================\033[0m"
cat $BAK | sed -e 's/PREPARATION_STEP.*/PREPARATION_STEP 3/' >$CFG
BuildNRun
# now get ready to rumble...
echo -e "\033[35;1m[$(date)] ================== Step 4: Build Injection Client ==============\033[0m"
cat $BAK | sed -e "s/L4SYS_NUMINSTR.*/L4SYS_NUMINSTR $filtered_instr/" >$BAK.2
cat $BAK.2 | sed -e "s/L4SYS_TOTINSTR.*/L4SYS_TOTINSTR $total_instr/" >$BAK.3
cat $BAK.3 | sed -e "s/PREPARATION_STEP.*/PREPARATION_STEP 0/">$CFG
rm $BAK $BAK.2 $BAK.3
buildfail
echo -e "\033[35;1m[$(date)] ================== Step 5: Trace Import/Prune ==============\033[0m"
import-trace --importer $IMPORTER -e fiasco.image -d $DBNAME -t trace.pb
prune-trace -d $DBNAME
$BINDIR/fail-client -Wf,--step=all -Wf,--blink_addr=$blink_addr -Wf,--longjmp_addr=$longjmp_addr $FAIL_ARGS
$BINDIR/import-trace --importer $IMPORTER -e fiasco.image -d $DBNAME -t trace.pb
$BINDIR/prune-trace -d $DBNAME
echo -e "\033[32;1m=========================================================================================="
echo "[$(date)] Preparations are finished. Happy injecting...."

View File

@ -8,15 +8,6 @@
using namespace std;
using namespace fail;
// Check if configuration dependencies are satisfied:
#if !defined(CONFIG_EVENT_BREAKPOINTS) || !defined(CONFIG_SR_RESTORE) || \
!defined(CONFIG_EVENT_MEMREAD) || !defined(CONFIG_EVENT_MEMWRITE) || \
!defined(CONFIG_SR_SAVE) || \
!defined(CONFIG_EVENT_IOPORT)
#error This experiment needs: breakpoints, memory accesses, I/O port events, \
save, and restore. Enable these in the configuration.
#endif
L4SysExperiment::L4SysExperiment()
: m_jc("localhost"), log("L4Sys", false)
{
@ -37,8 +28,6 @@ void L4SysExperiment::terminate(int reason) {
simulator.terminate(reason);
}
bool L4SysExperiment::run()
{
srand(time(NULL));

View File

@ -0,0 +1,73 @@
#experiment specific config
address_space=0x1fd77000
# if address_space_trace is not set then we use address_space for tracing
#address_space_trace=0x0
func_entry=0x20000216
func_exit=0x2000029c
# if filter entry/exit is not set, then (filter_entry=func_entry) and
# (filter_exit = func_exit)
filter_entry=0x2000022f
filter_exit=0x20000252
#default break_* value is 0
#break_blink=0xdead
#break_longjmp=0xdead
#break_exit=0xdead
#experiment values calculated during preparation
numinstr=16
totinstr=58401
#default config
emul_ips=5000000
max_instr_bytes=15
#default files
state_folder=l4sys.state
instruction_list=ip.list
golden_run=golden.out
filter=filter.list
trace=trace.pb

View File

@ -140,8 +140,9 @@ private:
* combination.
*/
void doRegisterInjection(int regDesc, int bit);
int updateConfig(std::string parameter, std::string value);
void setupFilteredBreakpoint(fail::BPSingleListener* bp, int instOffset, std::string instr_list);
void parseOptions(L4SysConfig&);

View File

@ -1,7 +1,6 @@
#include <iostream>
#include "experiment.hpp"
#include "experimentInfo.hpp"
#include "InstructionFilter.hpp"
#include "UDIS86.hpp"
#include "aluinstr.hpp"

View File

@ -1,56 +0,0 @@
#ifndef __L4SYS_EXPERIMENT_INFO_HPP__
#define __L4SYS_EXPERIMENT_INFO_HPP__
// the maximum number of bytes in a Bochs instruction
#define MAX_INSTR_BYTES 15
// the bounds of the program (space, instructions and time)
// client
#define L4SYS_ADDRESS_SPACE 0x1fd77000
// server
#define L4SYS_ADDRESS_SPACE_TRACE L4SYS_ADDRESS_SPACE
//#define L4SYS_ADDRESS_SPACE_TRACE 0x1fd4c000
#define L4SYS_exp_start 0x20000216
#define L4SYS_exp_end 0x2000029c
#define L4SYS_inj_start 0x2000022f
#define L4SYS_inj_end 0x20000252
// FUNC_{ENTRY,EXIT} specifies the range that needs to
// be captured to log program output properly
#define L4SYS_FUNC_ENTRY L4SYS_exp_start
#define L4SYS_FUNC_EXIT L4SYS_exp_end
// 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 L4SYS_inj_start
#define L4SYS_FILTER_EXIT L4SYS_inj_end
#define L4SYS_BREAK_BLINK 0xdead
#define L4SYS_BREAK_LONGJMP 0xdead
#define L4SYS_BREAK_EXIT 0xdead
// 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
#define L4SYS_NUMINSTR 0x1
#define L4SYS_TOTINSTR 0x1
#define L4SYS_BOCHS_IPS 5000000
// several file names used
#define L4SYS_STATE_FOLDER "l4sys.state"
#define L4SYS_INSTRUCTION_LIST "ip.list"
#define L4SYS_ALU_INSTRUCTIONS "alu.list"
#define L4SYS_CORRECT_OUTPUT "golden.out"
#define L4SYS_FILTER "filter.list"
// flags
// 0 - preparation complete
// >0 - next step to execute
#define PREPARATION_STEP 0
#endif // __L4SYS_EXPERIMENT_INFO_HPP__

View File

@ -1,23 +1,102 @@
#include <iostream>
#include <list>
#include <stdlib.h>
#include "experiment.hpp"
#include "experimentInfo.hpp"
#include "util/CommandLine.hpp"
using namespace std;
using namespace fail;
#define EXPERIMENT_CONF "experiment.conf"
static void parameterMissing(fail::Logger log, string c) {
log << "Error: Missing config parameter (" << c << ")" << endl;
simulator.terminate(1);
}
int L4SysExperiment::updateConfig(string parameter, string value) {
bool replaced = false;
std::list<std::string> buf;
ifstream is(EXPERIMENT_CONF);
if (is) {
while(!is.eof()) {
string tmp;
getline(is, tmp);
if( !tmp.compare(0, parameter.length() + 1, string(parameter + "=")) ) {
buf.push_back(string(parameter + "=" + value) );
replaced = true;
} else {
buf.push_back(tmp);
}
}
} else {
cerr << "Open config file failed" << endl;
return -1;
}
is.close();
ofstream os(EXPERIMENT_CONF);
if (os) {
if(!replaced)
os << parameter << "=" << value << endl;
while(!buf.empty()) {
os << buf.front() << endl;
buf.pop_front();
}
} else {
cerr << "Open config file for update failed" << endl;
return -1;
}
return 0;
}
void L4SysExperiment::parseOptions(L4SysConfig &conf) {
CommandLine &cmd = CommandLine::Inst();
ifstream fin(EXPERIMENT_CONF);
//Currently we don't delete the parameterstring to avoid deling ptr in the cmd
//Nevertheless, we shouldn't need them, so deleting should be safe
//We interpret the file content as parameters to our main function, so we don't
//need an own parser. Program parameters appear earlier in the parameter list
//and will overwrite the parameters from the config file.
while(fin.good()) {
string buffer;
string prefix("--");
getline(fin, buffer, '\n');
if( !(strncmp(buffer.c_str(),"#",1) == 0) &&
!(strncmp(buffer.c_str()," ",1) == 0 ) &&
!(strncmp(buffer.c_str(),"",1) == 0 ) ) {
string t(prefix + buffer);
//Workarround, if we just alloc t.length some of the arguments values
//disappear
char *c = (char *) malloc(t.length() * 2);
strcpy(c, t.c_str());
cmd.add_args( c );
}
}
cout << "end of config file" << endl;
cmd.addOption("", "", Arg::None, "USAGE: fail-client -Wf,[option] -Wf,[option] ... <BochsOptions...>");
CommandLine::option_handle HELP =
cmd.addOption("h", "help", Arg::None, "-h,--help \tPrint usage and exit");
CommandLine::option_handle STEP =
cmd.addOption("s", "step", Arg::Optional, "-s,--step \tSpecify preparation step, without this argumnt fail-client start in experiment mode (cr3: get CR3, cc: Create Checkpoint, it: collect instruction trace, gr: golden run, all: do the whole preparation)");
CommandLine::option_handle OPT_MAX_INSTR_BYTES =
cmd.addOption("", "max_instr_bytes", Arg::Optional, "--max_instr_bytes \t define MAX_INSTR_BYTES");
CommandLine::option_handle OPT_ADDRESS_SPACE =
@ -38,26 +117,23 @@ void L4SysExperiment::parseOptions(L4SysConfig &conf) {
cmd.addOption("", "break_longjmp", Arg::Optional, "--break_longjmp \t define L4SYS_BREAK_LONGJMP");
CommandLine::option_handle OPT_BREAK_EXIT =
cmd.addOption("", "break_exit", Arg::Optional, "--break_exit \t define L4SYS_BREAK_EXIT");
CommandLine::option_handle OPT_FILTER_INSTRUCTIONS =
cmd.addOption("", "filter_instructions", Arg::Optional, "--filter_instructions \t define L4SYS_FILTER_INSTRUCTIONS");
CommandLine::option_handle OPT_NUMINSTR =
cmd.addOption("", "numinstr", Arg::Optional, "--numinstr \t define L4SYS_NUMINSTR");
CommandLine::option_handle OPT_TOTINSTR =
cmd.addOption("", "totinstr", Arg::Optional, "--totinstr \t define L4SYS_TOTINSTR");
CommandLine::option_handle OPT_EMUL_IPS =
cmd.addOption("", "bochs_ips", Arg::Optional, "--bochs_ips \t define L4SYS_BOCHS_IPS");
cmd.addOption("", "emul_ips", Arg::Optional, "--emul_ips \t define L4SYS_BOCHS_IPS");
CommandLine::option_handle OPT_STATE_FOLDER =
cmd.addOption("", "state_folder", Arg::Optional, "--state_folder \t define L4SYS_STATE_FOLDER");
CommandLine::option_handle OPT_INSTRUCTION_LIST =
cmd.addOption("", "instruction_list", Arg::Optional, "--instruction_list \t define L4SYS_INSTRUCTION_LIST");
CommandLine::option_handle OPT_ALU_INSTRUCTIONS =
cmd.addOption("", "alu_instructions", Arg::Optional, "--alu_instructions \t define L4SYS_ALU_INSTRUCTIONS");
CommandLine::option_handle OPT_CORRECT_OUTPUT =
cmd.addOption("", "golden_run", Arg::Optional, "--correct_output \t define L4SYS_CORRECT_OUTPUT");
CommandLine::option_handle OPT_FILTER =
cmd.addOption("", "filter", Arg::Optional, "--filter \t define L4SYS_FILTER");
CommandLine::option_handle OPT_TRACE =
cmd.addOption("", "trace", Arg::Optional, "--trace \t define outputfile for trace (default trace.pb)");
if (!cmd.parse()) {
cerr << "Error parsing arguments." << endl;
@ -68,123 +144,133 @@ void L4SysExperiment::parseOptions(L4SysConfig &conf) {
}
if (cmd[OPT_MAX_INSTR_BYTES]) {
conf.max_instr_bytes = strtol(cmd[OPT_MAX_INSTR_BYTES].arg, NULL, 16);
conf.max_instr_bytes = strtol(cmd[OPT_MAX_INSTR_BYTES].arg, NULL, 10);
log << "max_instr_bytes: "<< dec << conf.max_instr_bytes << endl;
} else {
conf.max_instr_bytes = MAX_INSTR_BYTES;
parameterMissing(log, "max_instr_bytes");
}
if (cmd[OPT_ADDRESS_SPACE]) {
conf.address_space = strtol(cmd[OPT_ADDRESS_SPACE].arg, NULL, 16);
conf.address_space = strtol(cmd[OPT_ADDRESS_SPACE].arg, NULL, 16);
log << "address_space: "<< hex << conf.address_space << endl;
} else {
conf.address_space = L4SYS_ADDRESS_SPACE;
parameterMissing(log, "adress_space");
}
if (cmd[OPT_ADDRESS_SPACE_TRACE]) {
conf.address_space_trace = strtol(cmd[OPT_ADDRESS_SPACE_TRACE].arg, NULL, 16);
conf.address_space_trace = strtol(cmd[OPT_ADDRESS_SPACE_TRACE].arg, NULL, 16);
if( conf.address_space_trace == 0 )
conf.address_space_trace = conf.address_space;
else
log << "address_space_trace: "<< hex << conf.address_space_trace << endl;
} else {
conf.address_space_trace = L4SYS_ADDRESS_SPACE_TRACE;
conf.address_space_trace = conf.address_space;
}
if (cmd[OPT_FUNC_ENTRY]) {
conf.func_entry = strtol(cmd[OPT_FUNC_ENTRY].arg, NULL, 16);
} else {
conf.func_entry = L4SYS_FUNC_ENTRY;
conf.func_entry = strtol(cmd[OPT_FUNC_ENTRY].arg, NULL, 16);
log << "func_entry: "<< hex << conf.func_entry << endl;
} else{
parameterMissing(log, "filter_entry");
}
if (cmd[OPT_FUNC_EXIT]) {
conf.func_exit = strtol(cmd[OPT_FUNC_EXIT].arg, NULL, 16);
conf.func_exit = strtol(cmd[OPT_FUNC_EXIT].arg, NULL, 16);
log << "func_exit: "<< hex << conf.func_exit << endl;
} else {
conf.func_exit = L4SYS_FUNC_EXIT;
parameterMissing(log, "filter_exit");
}
if (cmd[OPT_FILTER_ENTRY]) {
conf.filter_entry = strtol(cmd[OPT_FILTER_ENTRY].arg, NULL, 16);
conf.filter_entry = strtol(cmd[OPT_FILTER_ENTRY].arg, NULL, 16);
log << "filter_entry: "<< hex << conf.filter_entry << endl;
} else {
conf.filter_entry = L4SYS_FILTER_ENTRY;
conf.filter_entry = conf.func_entry;
}
if (cmd[OPT_FILTER_EXIT]) {
conf.filter_exit = strtol(cmd[OPT_FILTER_EXIT].arg, NULL, 16);
conf.filter_exit = strtol(cmd[OPT_FILTER_EXIT].arg, NULL, 16);
log << "filter_exit: "<< hex << conf.filter_exit << endl;
} else {
conf.filter_exit = L4SYS_FILTER_EXIT;
conf.filter_exit = conf.func_exit;
}
if (cmd[OPT_BREAK_BLINK]) {
conf.break_blink = strtol(cmd[OPT_BREAK_BLINK].arg, NULL, 16);
conf.break_blink = strtol(cmd[OPT_BREAK_BLINK].arg, NULL, 16);
log << "break_blink: "<< hex << conf.break_blink << endl;
} else {
conf.break_blink = L4SYS_BREAK_BLINK;
conf.break_blink = 0;
}
if (cmd[OPT_BREAK_LONGJMP]) {
conf.break_longjmp = strtol(cmd[OPT_BREAK_LONGJMP].arg, NULL, 16);
conf.break_longjmp = strtol(cmd[OPT_BREAK_LONGJMP].arg, NULL, 16);
log << "break_longjmp: "<< hex << conf.break_longjmp << endl;
} else {
conf.break_longjmp = L4SYS_BREAK_LONGJMP;
conf.break_longjmp = 0;
}
if (cmd[OPT_BREAK_EXIT]) {
conf.break_exit = strtol(cmd[OPT_BREAK_EXIT].arg, NULL, 16);
conf.break_exit = strtol(cmd[OPT_BREAK_EXIT].arg, NULL, 16);
log << "break_exit: "<< hex << conf.break_exit << endl;
} else {
conf.break_exit = L4SYS_BREAK_EXIT;
}
if (cmd[OPT_FILTER_INSTRUCTIONS]) {
conf.filter_instructions = strtol(cmd[OPT_FILTER_INSTRUCTIONS].arg, NULL, 16);
} else {
conf.filter_instructions = L4SYS_FILTER_INSTRUCTIONS;
conf.break_exit = 0;
}
if (cmd[OPT_NUMINSTR]) {
conf.numinstr = strtol(cmd[OPT_NUMINSTR].arg, NULL, 16);
conf.numinstr = strtol(cmd[OPT_NUMINSTR].arg, NULL, 10);
log << "numinstr: "<< dec << conf.numinstr << endl;
} else {
conf.numinstr = L4SYS_NUMINSTR;
parameterMissing(log, "numinstr");
}
if (cmd[OPT_TOTINSTR]) {
conf.totinstr = strtol(cmd[OPT_TOTINSTR].arg, NULL, 16);
conf.totinstr = strtol(cmd[OPT_TOTINSTR].arg, NULL, 10);
log << "totinstr: "<< dec << conf.totinstr << endl;
} else {
conf.totinstr = L4SYS_TOTINSTR;
parameterMissing(log, "totinstr");
}
if (cmd[OPT_EMUL_IPS]) {
conf.emul_ips = strtol(cmd[OPT_EMUL_IPS].arg, NULL, 16);
conf.emul_ips = strtol(cmd[OPT_EMUL_IPS].arg, NULL, 10);
log << "emul_ips = " << dec << conf.emul_ips << endl;
} else {
conf.emul_ips = L4SYS_BOCHS_IPS;
parameterMissing(log, "emul_ips");
}
if (cmd[OPT_STATE_FOLDER]) {
conf.state_folder = std::string(cmd[OPT_STATE_FOLDER].arg);
conf.state_folder = std::string(cmd[OPT_STATE_FOLDER].arg);
log << "state_folder: "<< conf.state_folder << endl;
} else {
conf.state_folder = L4SYS_STATE_FOLDER;
conf.state_folder = "l4sys.state";
}
if (cmd[OPT_INSTRUCTION_LIST]) {
conf.instruction_list = std::string(cmd[OPT_INSTRUCTION_LIST].arg);
conf.instruction_list = std::string(cmd[OPT_INSTRUCTION_LIST].arg);
log << "instruction_list: "<< conf.instruction_list << endl;
} else {
conf.instruction_list = L4SYS_INSTRUCTION_LIST;
}
if (cmd[OPT_ALU_INSTRUCTIONS]) {
conf.alu_instructions = std::string(cmd[OPT_ALU_INSTRUCTIONS].arg);
} else {
conf.alu_instructions = L4SYS_ALU_INSTRUCTIONS;
conf.instruction_list = "ip.list";
}
if (cmd[OPT_CORRECT_OUTPUT]) {
conf.golden_run = std::string(cmd[OPT_CORRECT_OUTPUT].arg);
conf.golden_run = std::string(cmd[OPT_CORRECT_OUTPUT].arg);
log << "golden_run: "<< conf.golden_run << endl;
} else {
conf.golden_run = L4SYS_CORRECT_OUTPUT;
conf.golden_run = "golden.out";
}
if (cmd[OPT_FILTER]) {
conf.filter = std::string(cmd[OPT_FILTER].arg);
conf.filter = std::string(cmd[OPT_FILTER].arg);
log << "filter: "<< conf.filter << endl;
} else {
conf.filter = L4SYS_FILTER;
conf.filter = "filter.list";
}
if (cmd[OPT_TRACE]) {
conf.trace = std::string(cmd[OPT_TRACE].arg);
conf.trace = std::string(cmd[OPT_TRACE].arg);
log << "trace: "<< conf.trace << endl;
} else {
conf.trace = std::string("trace.pb");
conf.trace = "trace.pb";
}
if (cmd[STEP]) {

View File

@ -1,7 +1,9 @@
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include "experiment.hpp"
#include "experimentInfo.hpp"
#include "InstructionFilter.hpp"
#include "aluinstr.hpp"
@ -47,7 +49,11 @@ void L4SysExperiment::runToStart(fail::BPSingleListener *bp)
conf.address_space_trace = BX_CPU(0)->cr3;
}
conf.address_space = BX_CPU(0)->cr3;
conf.address_space = BX_CPU(0)->cr3;
char tmp[20];
sprintf(tmp, "0x%lx", BX_CPU(0)->cr3);
updateConfig("address_space", tmp );
}
@ -189,6 +195,16 @@ void L4SysExperiment::collectInstructionTrace(fail::BPSingleListener* bp)
conf.numinstr = inst_accepted;
conf.totinstr = count;
//Write new values into config file
char numimstr_str[20];
sprintf(numimstr_str, "%li", inst_accepted);
updateConfig("numinstr", numimstr_str );
char totinstr_str[20];
sprintf(totinstr_str, "%li", count);
updateConfig("totinstr", totinstr_str);
delete bp;
}