Skip to content
Snippets Groups Projects
Commit 4a061ba4 authored by Horst Schirmeier's avatar Horst Schirmeier
Browse files

hscsimple: config checks, use Logger

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@981 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
parent c8956140
No related branches found
No related tags found
No related merge requests found
......@@ -6,42 +6,50 @@
#include "SAL/SALInst.hpp"
#include "SAL/bochs/BochsRegister.hpp"
#include "controller/Event.hpp"
#include "util/Logger.hpp"
#include "config/AspectConfig.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 std::cout;
using std::endl;
bool hscsimpleExperiment::run()
{
cout << "[HSC] experiment start" << endl;
Logger log("HSC", false);
log << "experiment start" << endl;
// do funny things here...
#if 0
#if 1
// STEP 1
fi::BPEvent mainbp(0x00003c34);
sal::simulator.addEventAndWait(&mainbp);
cout << "[HSC] breakpoint reached, saving" << endl;
sal::simulator.save("hello.main");
log << "breakpoint reached, saving" << endl;
sal::simulator.save("hello.state");
#elif 1
cout << "[HSC] restoring ..." << endl;
sal::simulator.restore("hello.main");
cout << "[HSC] restored!" << endl;
// STEP 2
log << "restoring ..." << endl;
sal::simulator.restore("hello.state");
log << "restored!" << endl;
cout << "[HSC] waiting for last square() instruction" << endl;
log << "waiting for last square() instruction" << endl;
fi::BPEvent breakpoint(0x3c9e); // square(x) ret instruction
sal::simulator.addEventAndWait(&breakpoint);
cout << "[HSC] injecting hellish fault" << endl;
log << "injecting hellish fault" << endl;
#if BX_SUPPORT_X86_64
int reg = sal::RID_RAX;
#else
int reg = sal::RID_EAX;
#endif
sal::simulator.getRegisterManager().getRegister(reg)->setData(666);
cout << "[HSC] waiting for last main() instruction" << endl;
log << "waiting for last main() instruction" << endl;
breakpoint.setWatchInstructionPointer(0x3c92);
sal::simulator.addEventAndWait(&breakpoint);
cout << "[HSC] reached" << endl;
log << "reached" << endl;
// FIXME this shouldn't fail:
sal::simulator.addEventAndWait(&breakpoint);
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment