Merge "Removed OVP-related (source) files/code (backend discarded)."
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
#### Configuration file emitting BUILD_OVP/BOCHS defines ####
|
||||
#### Configuration file emitting BUILD_BOCHS/GEM5/... defines ####
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/VariantConfig.hpp.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/VariantConfig.hpp)
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
|
||||
#cmakedefine BUILD_BOCHS
|
||||
#cmakedefine BUILD_GEM5
|
||||
#cmakedefine BUILD_OVP
|
||||
#cmakedefine BUILD_QEMU
|
||||
#cmakedefine BUILD_T32
|
||||
#cmakedefine T32_MOCK_API
|
||||
|
||||
@ -27,17 +27,6 @@ elseif(BUILD_GEM5)
|
||||
gem5/Gem5ArmCPU.cc
|
||||
)
|
||||
endif(BUILD_ARM)
|
||||
elseif(BUILD_OVP)
|
||||
set(SRCS
|
||||
CPU.cc
|
||||
CPUState.cc
|
||||
Listener.cc
|
||||
ListenerManager.cc
|
||||
SALConfig.cc
|
||||
Register.cc
|
||||
SimulatorController.cc
|
||||
${VARIANT}/OVPController.cc
|
||||
)
|
||||
elseif(BUILD_QEMU)
|
||||
set(SRCS
|
||||
CPU.cc
|
||||
|
||||
@ -9,8 +9,6 @@
|
||||
#else
|
||||
#error Active config currently not supported!
|
||||
#endif
|
||||
#elif defined BUILD_OVP
|
||||
#include "ovp/OVPConfig.hpp"
|
||||
#elif defined BUILD_QEMU
|
||||
#include "qemu/QEMUConfig.hpp"
|
||||
#elif defined BUILD_T32
|
||||
|
||||
@ -5,8 +5,7 @@ namespace fail {
|
||||
// Flag initialization depends on the current selected simulator
|
||||
// (For now, the initialization values are all the same):
|
||||
#if defined BUILD_BOCHS || defined BUILD_GEM5 || \
|
||||
defined BUILD_OVP || defined BUILD_QEMU || \
|
||||
defined BUILD_T32
|
||||
defined BUILD_T32 || defined BUILD_QEMU
|
||||
const address_t ADDR_INV = static_cast<address_t> (0);
|
||||
const address_t ANY_ADDR = static_cast<address_t> (-1);
|
||||
const unsigned ANY_INSTR = static_cast<unsigned> (-1);
|
||||
|
||||
@ -10,8 +10,6 @@
|
||||
#include "bochs/BochsConfig.hpp"
|
||||
#elif defined BUILD_GEM5
|
||||
#include "gem5/Gem5Config.hpp"
|
||||
#elif defined BUILD_OVP
|
||||
#include "ovp/OVPConfig.hpp"
|
||||
#elif defined BUILD_QEMU
|
||||
#include "qemu/QEMUConfig.hpp"
|
||||
#elif defined BUILD_T32
|
||||
|
||||
@ -20,14 +20,6 @@ namespace fail {
|
||||
typedef Gem5Controller ConcreteSimulatorController; //!< concrete simulator (type)
|
||||
}
|
||||
|
||||
#elif defined BUILD_OVP
|
||||
|
||||
#include "ovp/OVPController.hpp"
|
||||
|
||||
namespace fail {
|
||||
typedef OVPController ConcreteSimulatorController; //!< concrete simulator (type)
|
||||
}
|
||||
|
||||
#elif defined BUILD_QEMU
|
||||
|
||||
#include "qemu/QEMUController.hpp"
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
#ifndef __OVPINIT_AH__
|
||||
#define __OVPINIT_AH__
|
||||
|
||||
#include "config/VariantConfig.hpp"
|
||||
|
||||
#ifdef BUILD_OVP
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "../SALInst.hpp"
|
||||
|
||||
aspect FailOVPInit {
|
||||
advice call("% ...::startSimulation(...)") : before ()
|
||||
{
|
||||
std::cout << "OVP init aspect!" << std::endl;
|
||||
// TODO: Log-Level?
|
||||
// TODO pass on command-line parameters
|
||||
fail::simulator.startup();
|
||||
}
|
||||
};
|
||||
|
||||
#endif // BUILD_OVP
|
||||
#endif // __OVPINIT_AH__
|
||||
@ -1,20 +0,0 @@
|
||||
/**
|
||||
* \brief Type definitions and configuration settings for
|
||||
* the OVP simulator.
|
||||
*/
|
||||
|
||||
#ifndef __OVP_CONFIG_HPP__
|
||||
#define __OVP_CONFIG_HPP__
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
namespace fail {
|
||||
|
||||
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)
|
||||
typedef int timer_t; //!< type of timer IDs
|
||||
|
||||
} // end-of-namespace: fail
|
||||
|
||||
#endif // __OVP_CONFIG_HPP__
|
||||
@ -1,132 +0,0 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "OVPController.hpp"
|
||||
#include "OVPMemory.hpp"
|
||||
#include "OVPRegister.hpp"
|
||||
#include "ovp/OVPStatusRegister.hpp"
|
||||
|
||||
namespace fail {
|
||||
|
||||
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();
|
||||
|
||||
// save("/srv/scratch/sirozipp/test.txt");
|
||||
|
||||
// ovpplatform.setPC(0x123);
|
||||
|
||||
// restore("/srv/scratch/sirozipp/test.txt");
|
||||
// cerr << "instrPtr: 0x" << hex << instrPtr << " SP: 0x" << hex << m_Regs->getStackPointer() \
|
||||
// << " R0: 0x" << hex << r0 << " ST: 0x" << hex << st << endl;
|
||||
|
||||
// Check for active breakpoint-Listeners:
|
||||
ListenerManager::iterator it = m_EvList.begin();
|
||||
while (it != m_EvList.end()) {
|
||||
// FIXME: Performance verbessern (dazu muss entsprechend auch die Speicherung
|
||||
// in ListenerManager(.cc|.hpp) angepasst bzw. verbessert werden).
|
||||
BPSingleListener* pEvBreakpt = dynamic_cast<BPSingleListener*>(*it);
|
||||
if (pEvBreakpt && (instrPtr == pEvBreakpt->getWatchInstructionPointer() ||
|
||||
pEvBreakpt->getWatchInstructionPointer() == 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
|
||||
}
|
||||
BPRangeListener* pEvRange = dynamic_cast<BPRangeListener*>(*it);
|
||||
if (pEvRange && pEvRange->isMatching(instrPtr)) {
|
||||
pEvBreakpt->setTriggerInstructionPointer(instrPtr);
|
||||
it = m_EvList.makeActive(it);
|
||||
continue; // dito.
|
||||
}
|
||||
it++;
|
||||
}
|
||||
m_EvList.fireActiveListeners();
|
||||
}
|
||||
|
||||
bool OVPController::save(const string& path)
|
||||
{
|
||||
// TODO!
|
||||
ovpplatform.save(path);
|
||||
return false; // TODO
|
||||
}
|
||||
|
||||
void OVPController::restore(const string& path)
|
||||
{
|
||||
//TODO!
|
||||
assert(path.length() > 0 &&
|
||||
"FATAL ERROR: Tried to restore state without valid path!");
|
||||
ovpplatform.restore(path);
|
||||
}
|
||||
|
||||
void OVPController::reboot()
|
||||
{
|
||||
// TODO!
|
||||
}
|
||||
|
||||
} // end-of-namespace: fail
|
||||
@ -1,73 +0,0 @@
|
||||
#ifndef __OVP_CONTROLLER_HPP__
|
||||
#define __OVP_CONTROLLER_HPP__
|
||||
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
#include "../SimulatorController.hpp"
|
||||
#include "../Listener.hpp"
|
||||
#include "../Register.hpp"
|
||||
#include "ovp/OVPPlatform.hpp"
|
||||
|
||||
namespace fail {
|
||||
|
||||
extern OVPPlatform ovpplatform;
|
||||
|
||||
/**
|
||||
* \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/x86/Architecture.hpp)
|
||||
// are much easier to read...
|
||||
public:
|
||||
/**
|
||||
* Initialize the controller.
|
||||
*/
|
||||
OVPController();
|
||||
~OVPController();
|
||||
void onInstrPtrChanged(address_t instrPtr);
|
||||
/**
|
||||
* Save simulator state.
|
||||
* @param path Location to store state information
|
||||
* @return \c true if the state has been successfully saved, \c false otherwise
|
||||
*/
|
||||
bool save(const std::string& path);
|
||||
/**
|
||||
* Restore simulator state.
|
||||
* @param path Location to previously saved state information
|
||||
*/
|
||||
void restore(const std::string& path);
|
||||
/**
|
||||
* Reboot simulator.
|
||||
*/
|
||||
void reboot();
|
||||
/**
|
||||
* Returns the current instruction pointer.
|
||||
* @return the current eip
|
||||
*/
|
||||
void makeGPRegister(int, void*, const std::string&);
|
||||
void makeSTRegister(Register *, const std::string&);
|
||||
void makePCRegister(int, void*, const std::string&);
|
||||
/**
|
||||
* Due to empty RegisterSets are not allowed, OVP platform
|
||||
* must tell OVPController when it is finished
|
||||
*
|
||||
* FIXME: This should be obsolete now...
|
||||
*/
|
||||
// void finishedRegisterCreation();
|
||||
};
|
||||
|
||||
} // end-of-namespace: fail
|
||||
|
||||
#endif // __OVP_CONTROLLER_HPP__
|
||||
@ -1,67 +0,0 @@
|
||||
#ifndef __OVP_MEMORY_HPP__
|
||||
#define __OVP_MEMORY_HPP__
|
||||
|
||||
#include "../Memory.hpp"
|
||||
|
||||
namespace fail {
|
||||
|
||||
/**
|
||||
* \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 Pointer to destination buffer to copy the data to.
|
||||
*/
|
||||
void getBytes(guest_address_t addr, size_t cnt, void *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) { }
|
||||
/**
|
||||
* Copies data to memory.
|
||||
* @param addr The guest address to write.
|
||||
* 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 src Pointer to data to be copied.
|
||||
*/
|
||||
void setBytes(guest_address_t addr, size_t cnt, void const *src) { }
|
||||
};
|
||||
|
||||
} // end-of-namespace: fail
|
||||
|
||||
#endif // __OVP_MEMORY_HPP__
|
||||
@ -1,76 +0,0 @@
|
||||
#ifndef __OVP_REGISTER_HPP__
|
||||
#define __OVP_REGISTER_HPP__
|
||||
|
||||
#include "../Register.hpp"
|
||||
#include "ovp/OVPPlatform.hpp"
|
||||
//#include "ovp/OVPStatusRegister.hpp"
|
||||
|
||||
extern OVPPlatform ovpplatform;
|
||||
|
||||
namespace fail {
|
||||
|
||||
/**
|
||||
* \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;
|
||||
}
|
||||
};
|
||||
|
||||
} // end-of-namespace: fail
|
||||
|
||||
#endif // __OVP_REGISTER_HPP__
|
||||
Reference in New Issue
Block a user