Fail* directories reorganized, Code-cleanup (-> coding-style), Typos+comments fixed.

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1321 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
adrian
2012-06-08 20:09:43 +00:00
parent d474a5b952
commit 2575604b41
866 changed files with 1848 additions and 1879 deletions

View File

@ -0,0 +1,17 @@
set(EXPERIMENT_NAME hsc-simple)
set(EXPERIMENT_TYPE HSCSimpleExperiment)
configure_file(../instantiate-experiment.ah.in
${CMAKE_CURRENT_BINARY_DIR}/instantiate-${EXPERIMENT_NAME}.ah @ONLY
)
#experiment sources
set(MY_EXPERIMENT_SRCS
experiment.hpp
experiment.cc
)
#### include directories ####
include_directories(${CMAKE_CURRENT_BINARY_DIR})
## build library
add_library(${EXPERIMENT_NAME} ${MY_EXPERIMENT_SRCS})

View File

@ -0,0 +1,54 @@
#include <iostream>
#include <unistd.h>
#include "experiment.hpp"
#include "sal/SALInst.hpp"
#include "sal/bochs/BochsRegister.hpp"
#include "sal/Event.hpp"
#include "util/Logger.hpp"
#include "config/FailConfig.hpp"
// Check if configuration dependencies are satisfied:
#if !defined(CONFIG_EVENT_BREAKPOINTS) || !defined(CONFIG_SR_RESTORE) || !defined(CONFIG_SR_SAVE)
#error This experiment needs: breakpoints, save, and restore. Enable these in the configuration.
#endif
using namespace std;
using namespace fail;
bool HSCSimpleExperiment::run()
{
Logger log("HSC", false);
log << "experiment start" << endl;
// do funny things here...
#if 1
// STEP 1
BPSingleEvent mainbp(0x00003c34);
simulator.addEventAndWait(&mainbp);
log << "breakpoint reached, saving" << endl;
simulator.save("hello.state");
#elif 0
// STEP 2
log << "restoring ..." << endl;
simulator.restore("hello.state");
log << "restored!" << endl;
log << "waiting for last square() instruction" << endl;
BPSingleEvent breakpoint(0x3c9e); // square(x) ret instruction
simulator.addEventAndWait(&breakpoint);
log << "injecting hellish fault" << endl;
// RID_CAX is the RAX register in 64 bit mode and EAX in 32 bit mode:
simulator.getRegisterManager().getRegister(RID_CAX)->setData(666);
log << "waiting for last main() instruction" << endl;
breakpoint.setWatchInstructionPointer(0x3c92);
simulator.addEventAndWait(&breakpoint);
log << "reached" << endl;
simulator.addEventAndWait(&breakpoint);
#endif
simulator.clearEvents(this);
return true;
}

View File

@ -0,0 +1,14 @@
#ifndef __HSC_SIMPLE_EXPERIMENT_HPP__
#define __HSC_SIMPLE_EXPERIMENT_HPP__
#include "efw/ExperimentFlow.hpp"
class HSCSimpleExperiment : public fail::ExperimentFlow
{
public:
HSCSimpleExperiment() { }
bool run();
};
#endif // __HSC_SIMPLE_EXPERIMENT_HPP__