another directory rename: failstar -> fail

"failstar" sounds like a name for a cruise liner from the 80s.  As "*" isn't a
desirable part of directory names, just name the whole thing "fail/", the core
parts being stored in "fail/core/".

Additionally fixing two build system dependency issues:
 - missing jobserver -> protomessages dependency
 - broken bochs -> fail dependency (add_custom_target DEPENDS only allows plain
   file dependencies ... cmake for the win)


git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@956 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
hsc
2012-03-08 19:43:02 +00:00
commit b70b6fb43a
921 changed files with 473161 additions and 0 deletions

139
core/SAL/ovp/Controller.cc Normal file
View File

@ -0,0 +1,139 @@
#include <iostream>
#include "OVPController.hpp"
#include "OVPMemory.hpp"
#include "OVPRegister.hpp"
#include "../../../ovp/OVPStatusRegister.hpp"
namespace sal {
OVPController::OVPController()
: SimulatorController(new OVPRegisterManager(), new OVPMemoryManager())
{
//FIXME: This should be obsolete now...
//set = new UniformRegisterSet(RT_GP);
//setStatus = new UniformRegisterSet(RT_ST);
//setPC= new UniformRegisterSet(RT_PC);
}
OVPController::~OVPController()
{
//FIXME: This should be obsolete now...
//delete set;
//delete setStatus;
//delete setPC;
// Free memory of OVPRegister objects (actually allocated in make*Register):
for(RegisterManager::iterator it = m_Regs->begin(); it != m_Regs->end(); it++)
delete (*it); // free the memory, allocated in the constructor
}
void OVPController::makeGPRegister(int width, void *link, const string& name) {
// Add general purpose register
OVPRegister *reg = new OVPRegister(m_currentRegId++, width, link, RT_GP);
reg->setName(name);
m_Regs->add(reg);
// Note: The RegisterManager (aka m_Regs) automatically assigns the
// added registers (herein typed OVPRegister) to their matching
// UniformRegisterSet (@see RegisterManager::add).
}
void OVPController::makeSTRegister(Register *reg, const string& name) {
// Add status register
reg->setName(name);
cerr << "Add Status Register: " << reg << endl;
m_Regs->add(reg);
}
void OVPController::makePCRegister(int width, void *link, const string& name) {
// Add general purpose register
OVPRegister *reg = new OVPRegister(m_currentRegId++, width, link, RT_PC);
reg->setName(name);
m_Regs->add(reg);
}
//FIXME: This should be obsolete now...
//void OVPController::finishedRegisterCreation() {
// m_Regs->add(*set);
// m_Regs->add(*setStatus);
// m_Regs->add(*setPC);
//}
void OVPController::onInstrPtrChanged(address_t instrPtr)
{
// make some funny outputs
unsigned int r0 = m_Regs->getSetOfType(RT_GP)->getRegister(0)->getData();
OVPRegisterManager *ovp_Regs = (OVPRegisterManager *) m_Regs;
// FIXME: This cast seems to be invalid: RT_GP vs. OVPStatusRegister (= RT_ST)?
OVPStatusRegister *rid_st = (OVPStatusRegister *) m_Regs->getSetOfType(RT_GP)->first();
// cerr << "Addr: " << rid_st << endl;
unsigned int st = rid_st->getData();
// cerr << "instrPtr: 0x" << hex << instrPtr << " SP: 0x" << hex << m_Regs->getStackPointer() \
<< " R0: 0x" << hex << r0 << " ST: 0x" << hex << st << endl;
// Check for active breakpoint-events:
fi::EventList::iterator it = m_EvList.begin();
while(it != m_EvList.end())
{
// FIXME: Performance verbessern (dazu muss entsprechend auch die Speicherung
// in EventList(.cc|.hpp) angepasst bzw. verbessert werden).
fi::BPEvent* pEvBreakpt = dynamic_cast<fi::BPEvent*>(*it);
if(pEvBreakpt && (instrPtr == pEvBreakpt->getWatchInstructionPointer() ||
pEvBreakpt->getWatchInstructionPointer() == fi::ANY_ADDR))
{
pEvBreakpt->setTriggerInstructionPointer(instrPtr);
it = m_EvList.makeActive(it);
// "it" has already been set to the next element (by calling
// makeActive()):
continue; // -> skip iterator increment
}
fi::BPRangeEvent* pEvRange = dynamic_cast<fi::BPRangeEvent*>(*it);
if(pEvRange && pEvRange->isMatching(instrPtr))
{
pEvBreakpt->setTriggerInstructionPointer(instrPtr);
it = m_EvList.makeActive(it);
continue; // dito.
}
it++;
}
m_EvList.fireActiveEvents();
}
void OVPController::save(const string& path)
{
//TODO
//SIM->save_state(path.c_str());
//bx_gui_c::power_handler();
}
void OVPController::restore(const string& path)
{
//TODO
//bx_pc_system.restore_bochs_request = true;
assert(path.length() > 0 &&
"FATAL ERROR: Tried to restore state without valid path!");
//strncpy(bx_pc_system.sr_path, path.c_str(), 512 /*CI_PATH_LENGTH, @see gui/textconfig.cc*/);
}
void OVPController::reboot()
{
//TODO
//bx_pc_system.Reset(BX_RESET_HARDWARE);
//bx_gui_c::reset_handler();//TODO: leider protected, so geht das also nicht...
}
void OVPController::toPreviousCtx()
{
// TODO
}
void OVPController::terminate(int exCode){
}
void OVPController::fireTimer(uint32_t){
};
};

View File

@ -0,0 +1,18 @@
#ifndef __OVP_CONFIG_HPP__
#define __OVP_CONFIG_HPP__
// Type definitions and configuration settings for
// the OVP simulator.
namespace sal
{
typedef uint32_t guest_address_t; //!< the guest memory address type
typedef uint8_t* host_address_t; //!< the host memory address type
typedef uint32_t register_data_t; //!< register data type (32 bit)
};
#endif /* __OVP_CONFIG_HPP__ */

View File

@ -0,0 +1,90 @@
#ifndef __OVP_CONTROLLER_HPP__
#define __OVP_CONTROLLER_HPP__
#include <string>
#include <cassert>
#include <string.h>
#include <string>
#include "../SimulatorController.hpp"
#include "../../controller/Event.hpp"
#include "../../../ovp/OVPPlatform.hpp"
#include "../Register.hpp"
using namespace std;
extern OVPPlatform ovpplatform;
/// Simulator Abstraction Layer namespace
namespace sal
{
/**
* \class OVPController
* OVP-specific implementation of a SimulatorController.
*/
class OVPController : public SimulatorController
{
private:
//FIXME: This should be obsolete now...
//UniformRegisterSet *set; //(RT_GP);
//UniformRegisterSet *setStatus;//(RT_ST);
//UniformRegisterSet *setPC;//(RT_PC);
// (FIXME: perhaps this should be declared as a static member)
unsigned int m_currentRegId;
// NOTE: Constants (such as GPRegisterId in SAL/bochs/BochsRegister.hpp)
// are much easier to read...
public:
// Initialize the controller.
OVPController();
virtual ~OVPController();
virtual void onInstrPtrChanged(address_t instrPtr);
/**
* Save simulator state.
* @param path Location to store state information
*/
virtual void save(const string& path);
/**
* Restore simulator state.
* @param path Location to previously saved state information
*/
virtual void restore(const string& path);
/**
* Reboot simulator.
*/
virtual void reboot();
/**
* Handles the control back to the previous coroutine which
* triggered the reboot. Need not to be called explicitly.
*/
void toPreviousCtx();
/**
* Returns the current instruction pointer.
* @return the current eip
*/
/**
* Terminate simulator
*/
virtual void terminate(int exCode = EXIT_SUCCESS);
virtual void fireTimer(uint32_t);
void makeGPRegister(int, void*, const string&);
void makeSTRegister(Register *, const string&);
void makePCRegister(int, void*, const string&);
//DELETE-ME:This should be obsolete now...
/**
* Due to empty RegisterSets are not allowed, OVP platform
* must tell OVPController when it is finished
*/
//void finishedRegisterCreation();
};
};
#endif

View File

@ -0,0 +1,92 @@
#ifndef __OVP_MEMORY_HPP__
#define __OVP_MEMORY_HPP__
#include "../Memory.hpp"
namespace sal
{
/**
* \class OVPMemoryManager
* Represents a concrete implemenation of the abstract
* MemoryManager to provide access to OVP's memory pool.
*/
class OVPMemoryManager : public MemoryManager
{
public:
/**
* Constructs a new MemoryManager object and initializes
* it's attributes appropriately.
*/
OVPMemoryManager() : MemoryManager() { }
/**
* Retrieves the size of the available simulated memory.
* @return the size of the memory pool in bytes
*/
size_t getPoolSize() const
{
return 0;
}
/**
* Retrieves the starting address of the host memory. This is the
* first valid address in memory.
* @return the starting address
*/
host_address_t getStartAddr() const
{
return (0);
}
/**
* Retrieves the byte at address \a addr in the memory.
* @param addr The guest address where the byte is located.
* The address is expected to be valid.
* @return the byte at \a addr
*/
byte_t getByte(guest_address_t addr)
{
return (0);
}
/**
* Retrieves \a cnt bytes at address \a addr in the memory.
* @param addr The guest address where the bytes are located.
* The address is expected to be valid.
* @param cnt The number of bytes to be retrieved. \a addr + \a cnt
* is expected to not exceed the memory limit.
* @param dest The destination buffer to write the bytes to
*/
void getBytes(guest_address_t addr, size_t cnt, std::vector<byte_t>& dest)
{
}
/**
* Writes the byte \a data to memory.
* @param addr The guest address to write.
* The address is expected to be valid.
* @param data The new byte to write
*/
void setByte(guest_address_t addr, byte_t data)
{
}
/**
* Writes the bytes \a data to memory. Consequently \c data.size()
* bytes will be written.
* @param addr The guest address to write.
* The address is expected to be valid.
* @param data The new bytes to write
*/
void setBytes(guest_address_t addr, const std::vector<byte_t>& data)
{
}
/**
* Transforms the guest address \a addr to a host address.
* @param addr The (logical) guest address to be transformed
* @return the transformed (host) address or \c ADDR_INV on errors
*/
host_address_t guestToHost(guest_address_t addr)
{
return (0);
}
};
}
#endif

View File

@ -0,0 +1,80 @@
#ifndef __OVP_REGISTER_HPP__
#define __OVP_REGISTER_HPP__
#include "../Register.hpp"
#include "../../../ovp/OVPPlatform.hpp"
//#include "../../../ovp/OVPStatusRegister.hpp"
extern OVPPlatform ovpplatform;
namespace sal {
/**
* \class OVPRegister
* OVP-specific implementation of x86 registers.
*/
class OVPRegister : public Register
{
private:
void *reg;
public:
/**
* Constructs a new register object.
* @param id the unique id of this register (simulator specific)
* @param width width of the register (8, 16, 32 or 64 bit should suffice)
* @param link pointer to bochs internal register memory
* @param t type of the register
*/
OVPRegister(unsigned int id, regwidth_t width, void* link, RegisterType t)
: Register(id, t, width) {
reg = link;
}
/**
* Retrieves the data of the register.
* @return the current register data
*/
regdata_t getData() { return ovpplatform.getRegisterData(reg); }
/**
* Sets the content of the register.
* @param data the new register data to be written
*/
void setData(regdata_t data) { ovpplatform.setRegisterData(reg, data); }
};
/**
* \class OVPRegister
* OVP-specific implementation of the RegisterManager.
*/
class OVPRegisterManager : public RegisterManager
{
public:
/**
* Returns the current instruction pointer.
* @return the current eip
*/
virtual address_t getInstructionPointer()
{
return ovpplatform.getPC();
}
/**
* Retruns the top address of the stack.
* @return the starting address of the stack
*/
virtual address_t getStackPointer()
{
return ovpplatform.getSP();
}
/**
* Retrieves the base ptr (holding the address of the
* current stack frame).
* @return the base pointer
*/
virtual address_t getBasePointer()
{
return 0;
}
};
}
#endif

13
core/SAL/ovp/init.ah Normal file
View File

@ -0,0 +1,13 @@
#ifndef __OVPINIT_AH__
#define __OVPINIT_AH__
#include "../SALInst.hpp"
aspect OVPInit {
advice call("% ...::startSimulation(...)") : before () {
cout << "OVP init aspect!" << endl;
sal::simulator.startup();
}
};
#endif // __OVPINIT_AH__