Namespaces unified (sal+fi -> fail), Code cleanups (-> coding-style.txt), Doxygen-comments fixed.
git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1319 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
@ -7,8 +7,7 @@
|
||||
// Type definitions and configuration settings for
|
||||
// the Bochs simulator.
|
||||
|
||||
namespace sal
|
||||
{
|
||||
namespace fail {
|
||||
|
||||
typedef bx_address guest_address_t; //!< the guest memory address type
|
||||
typedef Bit8u* host_address_t; //!< the host memory address type
|
||||
@ -19,7 +18,6 @@ typedef Bit8u* host_address_t; //!< the host memory address type
|
||||
#endif
|
||||
typedef int timer_t; //!< type of timer IDs
|
||||
|
||||
};
|
||||
|
||||
#endif /* __BOCHS_CONFIG_HPP__ */
|
||||
} // end-of-namespace: fail
|
||||
|
||||
#endif // __BOCHS_CONFIG_HPP__
|
||||
|
||||
@ -6,13 +6,12 @@
|
||||
#include "../Register.hpp"
|
||||
#include "../SALInst.hpp"
|
||||
|
||||
namespace sal
|
||||
{
|
||||
namespace fail {
|
||||
|
||||
#ifdef DANCEOS_RESTORE
|
||||
bx_bool restore_bochs_request = false;
|
||||
bx_bool save_bochs_request = false;
|
||||
string sr_path = "";
|
||||
std::string sr_path = "";
|
||||
#endif
|
||||
|
||||
bx_bool reboot_bochs_request = false;
|
||||
@ -26,9 +25,9 @@ BochsController::BochsController()
|
||||
// Add the general purpose register:
|
||||
#if BX_SUPPORT_X86_64
|
||||
// -- 64 bit register --
|
||||
const string names[] = { "RAX", "RCX", "RDX", "RBX", "RSP", "RBP", "RSI",
|
||||
"RDI", "R8", "R9", "R10", "R11", "R12", "R13",
|
||||
"R14", "R15" };
|
||||
const std::string names[] = { "RAX", "RCX", "RDX", "RBX", "RSP", "RBP", "RSI",
|
||||
"RDI", "R8", "R9", "R10", "R11", "R12", "R13",
|
||||
"R14", "R15" };
|
||||
for(unsigned short i = 0; i < 16; i++)
|
||||
{
|
||||
BxGPReg* pReg = new BxGPReg(i, 64, &(BX_CPU(0)->gen_reg[i].rrx));
|
||||
@ -37,8 +36,8 @@ BochsController::BochsController()
|
||||
}
|
||||
#else
|
||||
// -- 32 bit register --
|
||||
const string names[] = { "EAX", "ECX", "EDX", "EBX", "ESP", "EBP", "ESI",
|
||||
"EDI" };
|
||||
const std::string names[] = { "EAX", "ECX", "EDX", "EBX", "ESP", "EBP", "ESI",
|
||||
"EDI" };
|
||||
for(unsigned short i = 0; i < 8; i++)
|
||||
{
|
||||
BxGPReg* pReg = new BxGPReg(i, 32, &(BX_CPU(0)->gen_reg[i].dword.erx));
|
||||
@ -101,11 +100,11 @@ void BochsController::onInstrPtrChanged(address_t instrPtr, address_t address_sp
|
||||
(*m_pDest) << "0x" << std::hex << instrPtr;
|
||||
#endif
|
||||
// Check for active breakpoint-events:
|
||||
fi::EventList::iterator it = m_EvList.begin();
|
||||
EventList::iterator it = m_EvList.begin();
|
||||
while(it != m_EvList.end())
|
||||
{
|
||||
// FIXME: Maybe we need to improve the performance of this check.
|
||||
fi::BPEvent* pEvBreakpt = dynamic_cast<fi::BPEvent*>(*it);
|
||||
BPEvent* pEvBreakpt = dynamic_cast<BPEvent*>(*it);
|
||||
if(pEvBreakpt && pEvBreakpt->isMatching(instrPtr, address_space))
|
||||
{
|
||||
pEvBreakpt->setTriggerInstructionPointer(instrPtr);
|
||||
@ -121,18 +120,18 @@ void BochsController::onInstrPtrChanged(address_t instrPtr, address_t address_sp
|
||||
//this code is highly optimised for the average case, so it me appear a bit ugly
|
||||
bool do_fire = false;
|
||||
unsigned i = 0;
|
||||
fi::BufferCache<fi::BPEvent*> *buffer_cache = m_EvList.getBPBuffer();
|
||||
while(i < buffer_cache->get_count()) {
|
||||
fi::BPEvent *pEvBreakpt = buffer_cache->get(i);
|
||||
BufferCache<BPEvent*> *buffer_cache = m_EvList.getBPBuffer();
|
||||
while(i < buffer_cache->getCount()) {
|
||||
BPEvent *pEvBreakpt = buffer_cache->get(i);
|
||||
if(pEvBreakpt->isMatching(instrPtr, address_space)) {
|
||||
pEvBreakpt->setTriggerInstructionPointer(instrPtr);
|
||||
|
||||
//transition to STL: find the element we are working on in the Event List
|
||||
fi::EventList::iterator it = std::find(m_EvList.begin(), m_EvList.end(), pEvBreakpt);
|
||||
EventList::iterator it = std::find(m_EvList.begin(), m_EvList.end(), pEvBreakpt);
|
||||
it = m_EvList.makeActive(it);
|
||||
//find out how much elements need to be skipped to get in sync again
|
||||
//(should be one or none, the loop is just to make sure)
|
||||
for(unsigned j = i; j < buffer_cache->get_count(); j++) {
|
||||
for(unsigned j = i; j < buffer_cache->getCount(); j++) {
|
||||
if(buffer_cache->get(j) == (*it)) {
|
||||
i = j;
|
||||
break;
|
||||
@ -154,11 +153,11 @@ void BochsController::onInstrPtrChanged(address_t instrPtr, address_t address_sp
|
||||
|
||||
void BochsController::onIOPortEvent(unsigned char data, unsigned port, bool out) {
|
||||
// Check for active breakpoint-events:
|
||||
fi::EventList::iterator it = m_EvList.begin();
|
||||
EventList::iterator it = m_EvList.begin();
|
||||
while(it != m_EvList.end())
|
||||
{
|
||||
// FIXME: Maybe we need to improve the performance of this check.
|
||||
fi::IOPortEvent* pIOPt = dynamic_cast<fi::IOPortEvent*>(*it);
|
||||
IOPortEvent* pIOPt = dynamic_cast<IOPortEvent*>(*it);
|
||||
if(pIOPt && pIOPt->isMatching(port, out))
|
||||
{
|
||||
pIOPt->setData(data);
|
||||
@ -174,14 +173,14 @@ void BochsController::onIOPortEvent(unsigned char data, unsigned port, bool out)
|
||||
// implementation.
|
||||
}
|
||||
|
||||
void BochsController::save(const string& path)
|
||||
void BochsController::save(const std::string& path)
|
||||
{
|
||||
int stat;
|
||||
|
||||
stat = mkdir(path.c_str(), 0777);
|
||||
if(!(stat == 0 || errno == EEXIST))
|
||||
std::cout << "[FAIL] Can not create target-directory to save!" << std::endl;
|
||||
// TODO: (Non-)Verbose-Mode? Maybe better: use return value to indicate failure?
|
||||
// TODO: (Non-)Verbose-Mode? Log-level? Maybe better: use return value to indicate failure?
|
||||
|
||||
save_bochs_request = true;
|
||||
sr_path = path;
|
||||
@ -195,7 +194,7 @@ void BochsController::saveDone()
|
||||
m_Flows.toggle(m_CurrFlow);
|
||||
}
|
||||
|
||||
void BochsController::restore(const string& path)
|
||||
void BochsController::restore(const std::string& path)
|
||||
{
|
||||
clearEvents();
|
||||
restore_bochs_request = true;
|
||||
@ -242,10 +241,10 @@ void BochsController::m_onTimerTrigger(void* thisPtr)
|
||||
{
|
||||
// FIXME: The timer logic can be modified to use only one timer in Bochs.
|
||||
// (For now, this suffices.)
|
||||
fi::TimerEvent* pTmEv = static_cast<fi::TimerEvent*>(thisPtr);
|
||||
TimerEvent* pTmEv = static_cast<TimerEvent*>(thisPtr);
|
||||
// Check for a matching TimerEvent. (In fact, we are only
|
||||
// interessted in the iterator pointing at pTmEv.):
|
||||
fi::EventList::iterator it = std::find(simulator.m_EvList.begin(),
|
||||
EventList::iterator it = std::find(simulator.m_EvList.begin(),
|
||||
simulator.m_EvList.end(), pTmEv);
|
||||
// TODO: This has O(|m_EvList|) time complexity. We can further improve this
|
||||
// by creating a method such that makeActive(pTmEv) works as well,
|
||||
@ -254,7 +253,7 @@ void BochsController::m_onTimerTrigger(void* thisPtr)
|
||||
simulator.m_EvList.fireActiveEvents();
|
||||
}
|
||||
|
||||
timer_id_t BochsController::m_registerTimer(fi::TimerEvent* pev)
|
||||
timer_id_t BochsController::m_registerTimer(TimerEvent* pev)
|
||||
{
|
||||
assert(pev != NULL);
|
||||
return static_cast<timer_id_t>(
|
||||
@ -262,18 +261,18 @@ timer_id_t BochsController::m_registerTimer(fi::TimerEvent* pev)
|
||||
1/*start immediately*/, "Fail*: BochsController"/*name*/));
|
||||
}
|
||||
|
||||
bool BochsController::m_unregisterTimer(fi::TimerEvent* pev)
|
||||
bool BochsController::m_unregisterTimer(TimerEvent* pev)
|
||||
{
|
||||
assert(pev != NULL);
|
||||
bx_pc_system.deactivate_timer(static_cast<unsigned>(pev->getId()));
|
||||
return bx_pc_system.unregisterTimer(static_cast<unsigned>(pev->getId()));
|
||||
}
|
||||
|
||||
bool BochsController::onEventAddition(fi::BaseEvent* pev)
|
||||
bool BochsController::onEventAddition(BaseEvent* pev)
|
||||
{
|
||||
fi::TimerEvent* tmev;
|
||||
TimerEvent* tmev;
|
||||
// Register the timer event in the Bochs simulator:
|
||||
if ((tmev = dynamic_cast<fi::TimerEvent*>(pev)) != NULL) {
|
||||
if ((tmev = dynamic_cast<TimerEvent*>(pev)) != NULL) {
|
||||
tmev->setId(m_registerTimer(tmev));
|
||||
if(tmev->getId() == -1)
|
||||
return false; // unable to register the timer (error in Bochs' function call)
|
||||
@ -282,21 +281,21 @@ bool BochsController::onEventAddition(fi::BaseEvent* pev)
|
||||
return true;
|
||||
}
|
||||
|
||||
void BochsController::onEventDeletion(fi::BaseEvent* pev)
|
||||
void BochsController::onEventDeletion(BaseEvent* pev)
|
||||
{
|
||||
fi::TimerEvent* tmev;
|
||||
TimerEvent* tmev;
|
||||
// Unregister the time event:
|
||||
if ((tmev = dynamic_cast<fi::TimerEvent*>(pev)) != NULL) {
|
||||
if ((tmev = dynamic_cast<TimerEvent*>(pev)) != NULL) {
|
||||
m_unregisterTimer(tmev);
|
||||
}
|
||||
// Note: Maybe more stuff to do here for other event types.
|
||||
}
|
||||
|
||||
void BochsController::onEventTrigger(fi::BaseEvent* pev)
|
||||
void BochsController::onEventTrigger(BaseEvent* pev)
|
||||
{
|
||||
fi::TimerEvent* tmev;
|
||||
TimerEvent* tmev;
|
||||
// Unregister the time event, if once-flag is true:
|
||||
if ((tmev = dynamic_cast<fi::TimerEvent*>(pev)) != NULL) {
|
||||
if ((tmev = dynamic_cast<TimerEvent*>(pev)) != NULL) {
|
||||
if (tmev->getOnceFlag()) // deregister the timer (timer = single timeout)
|
||||
m_unregisterTimer(tmev);
|
||||
else // re-add the event (repetitive timer), tunneling the onEventAddition-handler
|
||||
@ -305,4 +304,4 @@ void BochsController::onEventTrigger(fi::BaseEvent* pev)
|
||||
// Note: Maybe more stuff to do here for other event types.
|
||||
}
|
||||
|
||||
} // end-of-namespace: sal
|
||||
} // end-of-namespace: fail
|
||||
|
||||
@ -20,13 +20,9 @@
|
||||
#include "../../../bochs/iodev/iodev.h"
|
||||
#include "../../../bochs/pc_system.h"
|
||||
|
||||
using namespace std;
|
||||
namespace fail {
|
||||
|
||||
namespace fi { class ExperimentFlow; }
|
||||
|
||||
/// Simulator Abstraction Layer namespace
|
||||
namespace sal
|
||||
{
|
||||
class ExperimentFlow;
|
||||
|
||||
/**
|
||||
* \class BochsController
|
||||
@ -35,7 +31,7 @@ namespace sal
|
||||
class BochsController : public SimulatorController
|
||||
{
|
||||
private:
|
||||
fi::ExperimentFlow* m_CurrFlow; //!< Stores the current flow for save/restore-operations
|
||||
ExperimentFlow* m_CurrFlow; //!< Stores the current flow for save/restore-operations
|
||||
#ifdef DEBUG
|
||||
unsigned m_Regularity;
|
||||
unsigned m_Counter;
|
||||
@ -67,14 +63,14 @@ class BochsController : public SimulatorController
|
||||
* along with the TimerEvent, @see getId(). On error, -1 is returned
|
||||
* (e.g. because a timer with the same id is already existing)
|
||||
*/
|
||||
timer_id_t m_registerTimer(fi::TimerEvent* pev);
|
||||
timer_id_t m_registerTimer(TimerEvent* pev);
|
||||
/**
|
||||
* Deletes a timer. No further events will be triggered by the timer.
|
||||
* @param pev a pointer to the TimerEvent-object to be removed
|
||||
* @return \c true if the timer with \a pev->getId() has been removed
|
||||
* successfully, \c false otherwise
|
||||
*/
|
||||
bool m_unregisterTimer(fi::TimerEvent* pev);
|
||||
bool m_unregisterTimer(TimerEvent* pev);
|
||||
public:
|
||||
// Initialize the controller.
|
||||
BochsController();
|
||||
@ -106,7 +102,7 @@ class BochsController : public SimulatorController
|
||||
* @return You should return \c true to continue and \c false to prevent
|
||||
* the addition of the event \a pev.
|
||||
*/
|
||||
bool onEventAddition(fi::BaseEvent* pev);
|
||||
bool onEventAddition(BaseEvent* pev);
|
||||
/**
|
||||
* This method is called when an experiment flow removes an event from
|
||||
* the event-management by calling \c removeEvent(prev), \c clearEvents()
|
||||
@ -114,7 +110,7 @@ class BochsController : public SimulatorController
|
||||
* this event handler will be called *before* the event is actually deleted.
|
||||
* @param pev the event to be deleted when returning from the event handler
|
||||
*/
|
||||
void onEventDeletion(fi::BaseEvent* pev);
|
||||
void onEventDeletion(BaseEvent* pev);
|
||||
/**
|
||||
* This method is called when an previously added event is about to be
|
||||
* triggered by the simulator-backend. More specifically, this event handler
|
||||
@ -122,7 +118,7 @@ class BochsController : public SimulatorController
|
||||
* corresponding coroutine is toggled.
|
||||
* @param pev the event to be triggered when returning from the event handler
|
||||
*/
|
||||
void onEventTrigger(fi::BaseEvent* pev);
|
||||
void onEventTrigger(BaseEvent* pev);
|
||||
/* ********************************************************************
|
||||
* Simulator Controller & Access API:
|
||||
* ********************************************************************/
|
||||
@ -130,7 +126,7 @@ class BochsController : public SimulatorController
|
||||
* Save simulator state.
|
||||
* @param path Location to store state information
|
||||
*/
|
||||
void save(const string& path);
|
||||
void save(const std::string& path);
|
||||
/**
|
||||
* Save finished: Callback from Simulator
|
||||
*/
|
||||
@ -139,7 +135,7 @@ class BochsController : public SimulatorController
|
||||
* Restore simulator state. Clears all Events.
|
||||
* @param path Location to previously saved state information
|
||||
*/
|
||||
void restore(const string& path);
|
||||
void restore(const std::string& path);
|
||||
/**
|
||||
* Restore finished: Callback from Simulator
|
||||
*/
|
||||
@ -168,7 +164,7 @@ class BochsController : public SimulatorController
|
||||
* instruction pointer, 0 to disable
|
||||
* @param dest specifies the output destition; defaults to \c std::cout
|
||||
*/
|
||||
void dbgEnableInstrPtrOutput(unsigned regularity, std::ostream* dest = &cout);
|
||||
void dbgEnableInstrPtrOutput(unsigned regularity, std::ostream* dest = &std::cout);
|
||||
#endif
|
||||
/* ********************************************************************
|
||||
* BochsController-specific (not implemented in SimulatorController!):
|
||||
@ -196,6 +192,6 @@ class BochsController : public SimulatorController
|
||||
}
|
||||
};
|
||||
|
||||
} // end-of-namespace: sal
|
||||
} // end-of-namespace: fail
|
||||
|
||||
#endif /* __BOCHS_CONTROLLER_HPP__ */
|
||||
#endif // __BOCHS_CONTROLLER_HPP__
|
||||
|
||||
@ -3,8 +3,7 @@
|
||||
|
||||
#include "../Memory.hpp"
|
||||
|
||||
namespace sal
|
||||
{
|
||||
namespace fail {
|
||||
|
||||
/**
|
||||
* \class BochsMemoryManager
|
||||
@ -115,6 +114,6 @@ class BochsMemoryManager : public MemoryManager
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
} // end-of-namespace: fail
|
||||
|
||||
#endif
|
||||
#endif // __BOCHS_MEMORY_HPP__
|
||||
|
||||
@ -2,13 +2,12 @@
|
||||
#define __BOCHS_REGISTER_HPP__
|
||||
|
||||
#include "../Register.hpp"
|
||||
|
||||
#include "../../../bochs/bochs.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
|
||||
namespace sal {
|
||||
namespace fail {
|
||||
|
||||
/**
|
||||
* \class BochsRegister
|
||||
@ -241,6 +240,6 @@ class BochsRegisterManager : public RegisterManager
|
||||
}
|
||||
};
|
||||
|
||||
} // end-of-namespace: sal
|
||||
} // end-of-namespace: fail
|
||||
|
||||
#endif /* __BOCHS_REGISTER_HPP__ */
|
||||
#endif // __BOCHS_REGISTER_HPP__
|
||||
|
||||
@ -25,11 +25,11 @@ aspect Breakpoints
|
||||
//bxInstruction_c* pInstr = *(tjp->arg<1>());
|
||||
|
||||
// report this event to the Bochs controller:
|
||||
sal::simulator.onInstrPtrChanged(pThis->get_instruction_pointer(), pThis->cr3);
|
||||
fail::simulator.onInstrPtrChanged(pThis->get_instruction_pointer(), pThis->cr3);
|
||||
// Note: get_bx_opcode_name(pInstr->getIaOpcode()) retrieves the mnemonics.
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // CONFIG_EVENT_BREAKPOINTS
|
||||
|
||||
#endif
|
||||
#endif // __BREAKPOINTS_AH__
|
||||
|
||||
@ -13,10 +13,10 @@
|
||||
|
||||
// Fixed "port number" for "Guest system >> Bochs" communication
|
||||
#define BOCHS_COM_PORT 0x378
|
||||
// FIXME: This #define should be located in a config or passed within the event object...
|
||||
|
||||
aspect GuestSysCom
|
||||
{
|
||||
|
||||
pointcut outInstructions() = "% ...::bx_cpu_c::OUT_DX%(...)";
|
||||
|
||||
advice execution (outInstructions()) : after ()
|
||||
@ -27,11 +27,11 @@ aspect GuestSysCom
|
||||
unsigned rDX = getCPU(tjp->that())->gen_reg[2].word.rx; // port number
|
||||
unsigned rAL = getCPU(tjp->that())->gen_reg[0].word.byte.rl; // data
|
||||
if (rDX == BOCHS_COM_PORT) {
|
||||
sal::simulator.onGuestSystemEvent((char)rAL, rDX);
|
||||
fail::simulator.onGuestSystemEvent((char)rAL, rDX);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CONFIG_EVENT_GUESTSYS
|
||||
|
||||
#endif /* __GUESTSYS_COM_AH__ */
|
||||
#endif // __GUESTSYS_COM_AH__
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef __IOPORT_COM_AH__
|
||||
#define __IOPORT_COM_AH__
|
||||
#define __IOPORT_COM_AH__
|
||||
|
||||
#include "config/FailConfig.hpp"
|
||||
|
||||
@ -20,7 +20,7 @@ aspect IOPortCom
|
||||
{
|
||||
unsigned rDX = getCPU(tjp->that())->gen_reg[2].word.rx; // port number
|
||||
unsigned char rAL = getCPU(tjp->that())->gen_reg[0].word.byte.rl; // data
|
||||
sal::simulator.onIOPortEvent(rAL, rDX, true);
|
||||
fail::simulator.onIOPortEvent(rAL, rDX, true);
|
||||
}
|
||||
|
||||
pointcut inInstruction() = "% ...::bx_cpu_c::IN_ALDX(...)";
|
||||
@ -29,10 +29,10 @@ aspect IOPortCom
|
||||
{
|
||||
unsigned rDX = getCPU(tjp->that())->gen_reg[2].word.rx; // port number
|
||||
unsigned char rAL = getCPU(tjp->that())->gen_reg[0].word.byte.rl; // data
|
||||
sal::simulator.onIOPortEvent(rAL, rDX, false);
|
||||
fail::simulator.onIOPortEvent(rAL, rDX, false);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CONFIG_EVENT_IOPORT
|
||||
|
||||
#endif /* __IOPORT_COM_AH__ */
|
||||
#endif // __IOPORT_COM_AH__
|
||||
|
||||
@ -29,12 +29,12 @@ aspect Interrupt
|
||||
unsigned vector = *(tjp->arg<0>());
|
||||
unsigned type = *(tjp->arg<1>());
|
||||
if(type == BX_EXTERNAL_INTERRUPT)
|
||||
sal::simulator.onInterruptEvent(vector, false);
|
||||
fail::simulator.onInterruptEvent(vector, false);
|
||||
else if(type == BX_NMI)
|
||||
sal::simulator.onInterruptEvent(vector, true);
|
||||
fail::simulator.onInterruptEvent(vector, true);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CONFIG_EVENT_INTERRUPT
|
||||
|
||||
#endif /* __INTERRUPT_AH__ */
|
||||
#endif // __INTERRUPT_AH__
|
||||
|
||||
@ -16,7 +16,7 @@ aspect Interrupt_FI
|
||||
advice execution (interrupt_method()) : around ()
|
||||
{
|
||||
unsigned vector = *(tjp->arg<0>());
|
||||
if(!sal::simulator.isSuppressedInterrupt(vector)){
|
||||
if(!fail::simulator.isSuppressedInterrupt(vector)){
|
||||
tjp->proceed();
|
||||
}
|
||||
}
|
||||
@ -24,4 +24,4 @@ aspect Interrupt_FI
|
||||
|
||||
#endif // CONFIG_SUPPRESS_INTERRUPTS
|
||||
|
||||
#endif /* __INTERRUPT_SUPPRESSION_AH__ */
|
||||
#endif // __INTERRUPT_SUPPRESSION_AH__
|
||||
|
||||
@ -9,10 +9,11 @@
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <ctime>
|
||||
|
||||
#include "../../../bochs/bochs.h"
|
||||
#include "../SALInst.hpp"
|
||||
|
||||
using namespace std;
|
||||
// FIXME: This seems (partial) deprecated as well...
|
||||
|
||||
aspect Jump
|
||||
{
|
||||
@ -59,7 +60,7 @@ aspect Jump
|
||||
advice execution (defJumpInstructions()) : around()
|
||||
{
|
||||
bxInstruction_c* pInstr = *(tjp->arg<0>()); // bxInstruction_c-object
|
||||
sal::simulator.onJumpEvent(true, pInstr->getIaOpcode());
|
||||
fail::simulator.onJumpEvent(true, pInstr->getIaOpcode());
|
||||
/*
|
||||
JoinPoint::That* pThis = tjp->that();
|
||||
if(pThis == NULL)
|
||||
@ -108,7 +109,7 @@ aspect Jump
|
||||
advice execution (regJumpInstructions()) : around ()
|
||||
{
|
||||
bxInstruction_c* pInstr = *(tjp->arg<0>()); // bxInstruction_c-object
|
||||
sal::simulator.onJumpEvent(false, pInstr->getIaOpcode());
|
||||
fail::simulator.onJumpEvent(false, pInstr->getIaOpcode());
|
||||
/*
|
||||
JoinPoint::That* pThis = tjp->that();
|
||||
|
||||
@ -135,5 +136,5 @@ aspect Jump
|
||||
|
||||
#endif // CONFIG_EVENT_JUMP
|
||||
|
||||
#endif /* __JUMP_AH__ */
|
||||
#endif // __JUMP_AH__
|
||||
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
|
||||
#include "config/FailConfig.hpp"
|
||||
|
||||
// FIXME: What's the purpose of this file/code? Deprecated?
|
||||
|
||||
#if 0
|
||||
// #if defined(CONFIG_SR_RESTORE) || defined(CONFIG_SR_REBOOT)
|
||||
|
||||
@ -18,11 +20,11 @@ aspect jumpToPreviousCtx
|
||||
advice execution (end_reset_handler()) : after ()
|
||||
{
|
||||
|
||||
if (sal::restore_bochs_request || sal::reboot_bochs_request )
|
||||
if (fail::restore_bochs_request || fail::reboot_bochs_request )
|
||||
{
|
||||
sal::restore_bochs_request = false;
|
||||
sal::reboot_bochs_request = false;
|
||||
sal::simulator.toPreviousCtx();
|
||||
fail::restore_bochs_request = false;
|
||||
fail::reboot_bochs_request = false;
|
||||
fail::simulator.toPreviousCtx();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -8,11 +8,13 @@
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
#include "bochs.h"
|
||||
|
||||
#include "bochs.h"
|
||||
#include "../../controller/EventList.hpp"
|
||||
#include "../../controller/Event.hpp"
|
||||
|
||||
// FIXME: This is deprecated stuff. Delete this file.
|
||||
|
||||
using namespace std;
|
||||
|
||||
// FIXME this code doesn't make any sense for the read_virtual_% functions
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
// TODO warn on uncovered memory accesses
|
||||
aspect MemEvents
|
||||
{
|
||||
sal::address_t rmw_address;
|
||||
fail::address_t rmw_address;
|
||||
|
||||
pointcut write_methods() =
|
||||
"% ...::bx_cpu_c::write_virtual_%(...)" && // -> access32/64.cc
|
||||
@ -59,27 +59,29 @@ aspect MemEvents
|
||||
//
|
||||
#ifdef CONFIG_EVENT_MEMWRITE
|
||||
advice execution (write_methods()) : after () {
|
||||
sal::simulator.onMemoryAccessEvent(
|
||||
fail::simulator.onMemoryAccessEvent(
|
||||
*(tjp->arg<1>()), sizeof(*(tjp->arg<2>())), true,
|
||||
getCPU(tjp->that())->prev_rip);
|
||||
}
|
||||
|
||||
advice execution (write_methods_RMW()) : after () {
|
||||
sal::simulator.onMemoryAccessEvent(
|
||||
fail::simulator.onMemoryAccessEvent(
|
||||
rmw_address, sizeof(*(tjp->arg<0>())), true,
|
||||
getCPU(tjp->that())->prev_rip);
|
||||
}
|
||||
|
||||
advice execution (write_methods_new_stack()) : after () {
|
||||
std::cerr << "WOOOOOT write_methods_new_stack" << std::endl;
|
||||
sal::simulator.onMemoryAccessEvent(
|
||||
// TODO: Log-level?
|
||||
fail::simulator.onMemoryAccessEvent(
|
||||
*(tjp->arg<1>()), sizeof(*(tjp->arg<3>())), true,
|
||||
getCPU(tjp->that())->prev_rip);
|
||||
}
|
||||
|
||||
advice execution (write_methods_new_stack_64()) : after () {
|
||||
std::cerr << "WOOOOOT write_methods_new_stack_64" << std::endl;
|
||||
sal::simulator.onMemoryAccessEvent(
|
||||
// TODO: Log-level?
|
||||
fail::simulator.onMemoryAccessEvent(
|
||||
*(tjp->arg<0>()), sizeof(*(tjp->arg<2>())), true,
|
||||
getCPU(tjp->that())->prev_rip);
|
||||
}
|
||||
@ -90,7 +92,7 @@ aspect MemEvents
|
||||
// memory (e.g., to read vectors from the interrupt vector
|
||||
// table).
|
||||
/*
|
||||
sal::simulator.onMemoryAccessEvent(
|
||||
fail::simulator.onMemoryAccessEvent(
|
||||
*(tjp->arg<0>()), sizeof(*(tjp->arg<1>())), true,
|
||||
getCPU(tjp->that())->prev_rip);
|
||||
*/
|
||||
@ -105,13 +107,13 @@ aspect MemEvents
|
||||
//
|
||||
#ifdef CONFIG_EVENT_MEMREAD
|
||||
advice execution (read_methods()) : before () {
|
||||
sal::simulator.onMemoryAccessEvent(
|
||||
fail::simulator.onMemoryAccessEvent(
|
||||
*(tjp->arg<1>()), sizeof(*(tjp->result())), false,
|
||||
getCPU(tjp->that())->prev_rip);
|
||||
}
|
||||
|
||||
advice execution (read_methods_dqword()) : before () {
|
||||
sal::simulator.onMemoryAccessEvent(
|
||||
fail::simulator.onMemoryAccessEvent(
|
||||
*(tjp->arg<1>()), 16, false,
|
||||
getCPU(tjp->that())->prev_rip);
|
||||
}
|
||||
@ -120,7 +122,7 @@ aspect MemEvents
|
||||
advice execution (read_methods_RMW()) : before () {
|
||||
rmw_address = *(tjp->arg<1>());
|
||||
#ifdef CONFIG_EVENT_MEMREAD
|
||||
sal::simulator.onMemoryAccessEvent(
|
||||
fail::simulator.onMemoryAccessEvent(
|
||||
*(tjp->arg<1>()), sizeof(*(tjp->result())), false,
|
||||
getCPU(tjp->that())->prev_rip);
|
||||
#endif
|
||||
@ -133,7 +135,7 @@ aspect MemEvents
|
||||
// memory (e.g., to read vectors from the interrupt vector
|
||||
// table).
|
||||
/*
|
||||
sal::simulator.onMemoryAccessEvent(
|
||||
fail::simulator.onMemoryAccessEvent(
|
||||
*(tjp->arg<0>()), sizeof(*(tjp->result())), false,
|
||||
getCPU(tjp->that())->prev_rip);
|
||||
*/
|
||||
@ -143,4 +145,4 @@ aspect MemEvents
|
||||
|
||||
#endif // CONFIG_EVENT_MEMACCESS
|
||||
|
||||
#endif /* __MEM_EVENTS_AH__ */
|
||||
#endif // __MEM_EVENTS_AH__
|
||||
|
||||
@ -16,7 +16,7 @@ aspect Trap
|
||||
|
||||
advice execution (exception_method()) : before ()
|
||||
{
|
||||
sal::simulator.onTrapEvent(*(tjp->arg<0>()));
|
||||
fail::simulator.onTrapEvent(*(tjp->arg<0>()));
|
||||
// TODO: There are some different types of exceptions at cpu.h (line 265-281)
|
||||
// Which kind of a trap are these types?
|
||||
}
|
||||
@ -24,4 +24,4 @@ aspect Trap
|
||||
|
||||
#endif // CONFIG_EVENT_TRAP
|
||||
|
||||
#endif /* __TRAP_AH__ */
|
||||
#endif // __TRAP_AH__
|
||||
|
||||
@ -12,4 +12,4 @@ static inline BX_CPU_C *getCPU(BX_CPU_C *that)
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // __BOCHS_HELPERS_HPP__
|
||||
|
||||
@ -11,7 +11,8 @@ aspect credits {
|
||||
advice call ("% bx_center_print(...)")
|
||||
&& within ("void bx_print_header()")
|
||||
&& args(file, line, maxwidth)
|
||||
: around (FILE *file, const char *line, unsigned maxwidth) {
|
||||
: around (FILE *file, const char *line, unsigned maxwidth)
|
||||
{
|
||||
if (!first) {
|
||||
tjp->proceed();
|
||||
return;
|
||||
|
||||
@ -16,4 +16,4 @@ aspect DisableLogfn {
|
||||
advice execution (add_remove_logfn()) : around () {}
|
||||
};
|
||||
|
||||
#endif /* __DISABLE_ADD_REMOVE_LOGFN_AH__ */
|
||||
#endif // __DISABLE_ADD_REMOVE_LOGFN_AH__
|
||||
|
||||
@ -21,6 +21,6 @@ aspect DisableKeybInt {
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* CONFIG_DISABLE_KEYB_INTERRUPTS */
|
||||
#endif // CONFIG_DISABLE_KEYB_INTERRUPTS
|
||||
|
||||
#endif /* __DISABLE_KEYBOARD_INTERRUPT_AH__ */
|
||||
#endif // __DISABLE_KEYBOARD_INTERRUPT_AH__
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
#ifndef __FAILBOCHS_HPP__
|
||||
#define __FAILBOCHS_HPP__
|
||||
#define __FAILBOCHS_HPP__
|
||||
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
namespace sal
|
||||
{
|
||||
// FIXME: Maybe rename this file to "FailBochsGlobals.hpp"?
|
||||
|
||||
namespace fail {
|
||||
|
||||
#ifdef DANCEOS_RESTORE
|
||||
extern bx_bool restore_bochs_request;
|
||||
@ -21,4 +21,4 @@ extern int interrupt_to_fire;
|
||||
|
||||
}
|
||||
|
||||
#endif /* __FAILBOCHS_HPP__ */
|
||||
#endif // __FAILBOCHS_HPP__
|
||||
|
||||
@ -16,11 +16,11 @@ aspect fireInterrupt
|
||||
|
||||
advice execution (cpuLoop()) : before ()
|
||||
{
|
||||
if (!sal::interrupt_injection_request) {
|
||||
if (!fail::interrupt_injection_request) {
|
||||
return;
|
||||
}else{
|
||||
BX_SET_INTR(sal::interrupt_to_fire);
|
||||
DEV_pic_raise_irq(sal::interrupt_to_fire);
|
||||
BX_SET_INTR(fail::interrupt_to_fire);
|
||||
DEV_pic_raise_irq(fail::interrupt_to_fire);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -32,12 +32,12 @@ aspect InterruptDone
|
||||
|
||||
advice execution (interrupt_method()) : before ()
|
||||
{
|
||||
if (!sal::interrupt_injection_request) {
|
||||
if (!fail::interrupt_injection_request) {
|
||||
return;
|
||||
}else{
|
||||
if(*(tjp->arg<0>()) == 32 + sal::interrupt_to_fire){
|
||||
DEV_pic_lower_irq(sal::interrupt_to_fire);
|
||||
sal::simulator.fireInterruptDone();
|
||||
if(*(tjp->arg<0>()) == 32 + fail::interrupt_to_fire){
|
||||
DEV_pic_lower_irq(fail::interrupt_to_fire);
|
||||
fail::simulator.fireInterruptDone();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -45,4 +45,4 @@ aspect InterruptDone
|
||||
|
||||
#endif // CONFIG_FIRE_INTERRUPTS
|
||||
|
||||
#endif /* __FIREINTERRUPT_AH__ */
|
||||
#endif // __FIREINTERRUPT_AH__
|
||||
|
||||
@ -3,11 +3,13 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
// FIXME: This seems deprecated...?!
|
||||
|
||||
aspect fireTimer {
|
||||
|
||||
advice "bx_pc_system_c" : slice class {
|
||||
public:
|
||||
// TODO: Log-level?
|
||||
void fireTimer(Bit32u timerNum){
|
||||
if(timerNum <= numTimers){
|
||||
if(!timer[timerNum].active){
|
||||
|
||||
@ -4,8 +4,9 @@
|
||||
#include "../SALInst.hpp"
|
||||
|
||||
aspect BochsInit {
|
||||
advice call("int bxmain()") : before () {
|
||||
sal::simulator.startup();
|
||||
advice call("int bxmain()") : before ()
|
||||
{
|
||||
fail::simulator.startup();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -12,13 +12,14 @@ aspect reboot {
|
||||
pointcut cpuLoop() = "void defineCPULoopJoinPoint(...)";
|
||||
|
||||
advice execution (cpuLoop()) : after () {
|
||||
if (!sal::reboot_bochs_request) {
|
||||
if (!fail::reboot_bochs_request) {
|
||||
return;
|
||||
}
|
||||
|
||||
bx_gui_c::reset_handler();
|
||||
std::cout << "[FAIL] Reboot finished" << std::endl;
|
||||
sal::simulator.rebootDone();
|
||||
// TODO: Log-level?
|
||||
fail::simulator.rebootDone();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#define __RESTORE_AH__
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "config/FailConfig.hpp"
|
||||
#include "../SALInst.hpp"
|
||||
|
||||
@ -14,7 +15,7 @@ aspect restore {
|
||||
|
||||
advice execution (restoreState()) : after () {
|
||||
std::cout << "[FAIL] Restore finished" << std::endl;
|
||||
sal::simulator.restoreDone();
|
||||
fail::simulator.restoreDone();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -17,13 +17,13 @@ aspect save {
|
||||
advice execution (cpuLoop()) : order ("save", "Breakpoints");
|
||||
|
||||
advice execution (cpuLoop()) : after () {
|
||||
if (!sal::save_bochs_request) {
|
||||
if (!fail::save_bochs_request) {
|
||||
return;
|
||||
}
|
||||
assert(sal::sr_path.size() > 0 && "[FAIL] tried to save state without valid path");
|
||||
SIM->save_state(sal::sr_path.c_str());
|
||||
assert(fail::sr_path.size() > 0 && "[FAIL] tried to save state without valid path");
|
||||
SIM->save_state(fail::sr_path.c_str());
|
||||
std::cout << "[FAIL] Save finished" << std::endl;
|
||||
sal::simulator.saveDone();
|
||||
fail::simulator.saveDone();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -49,6 +49,6 @@ aspect nonverbose {
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // CONFIG_STFU
|
||||
|
||||
#endif
|
||||
#endif // __NONVERBOSE_AH__
|
||||
|
||||
Reference in New Issue
Block a user