++coding-style.
git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1386 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
@ -14,59 +14,58 @@ namespace fail {
|
||||
* Defines an abstract interface to access the simulated memory pool
|
||||
* and query meta information, e.g. the memory size.
|
||||
*/
|
||||
class MemoryManager
|
||||
{
|
||||
public:
|
||||
virtual ~MemoryManager() { }
|
||||
/**
|
||||
* Retrieves the size of the available simulated memory.
|
||||
* @return the size of the memory pool in bytes
|
||||
*/
|
||||
virtual size_t getPoolSize() const = 0;
|
||||
/**
|
||||
* Retrieves the starting address of the host memory. This is the
|
||||
* first valid address in memory.
|
||||
* @return the starting address
|
||||
*/
|
||||
virtual host_address_t getStartAddr() const = 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
|
||||
*/
|
||||
virtual byte_t getByte(guest_address_t addr) = 0;
|
||||
/**
|
||||
* Retrieves \a cnt bytes at address \a addr from 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.
|
||||
*/
|
||||
virtual void getBytes(guest_address_t addr, size_t cnt, void *dest) = 0;
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
virtual void setByte(guest_address_t addr, byte_t data) = 0;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
virtual void setBytes(guest_address_t addr, size_t cnt, void const *src) = 0;
|
||||
/**
|
||||
* Transforms the guest address \a addr to a host address.
|
||||
* @param addr The guest address to be transformed
|
||||
* @return the transformed (host) address or \c ADDR_INV on errors
|
||||
*/
|
||||
virtual host_address_t guestToHost(guest_address_t addr) = 0;
|
||||
class MemoryManager {
|
||||
public:
|
||||
virtual ~MemoryManager() { }
|
||||
/**
|
||||
* Retrieves the size of the available simulated memory.
|
||||
* @return the size of the memory pool in bytes
|
||||
*/
|
||||
virtual size_t getPoolSize() const = 0;
|
||||
/**
|
||||
* Retrieves the starting address of the host memory. This is the
|
||||
* first valid address in memory.
|
||||
* @return the starting address
|
||||
*/
|
||||
virtual host_address_t getStartAddr() const = 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
|
||||
*/
|
||||
virtual byte_t getByte(guest_address_t addr) = 0;
|
||||
/**
|
||||
* Retrieves \a cnt bytes at address \a addr from 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.
|
||||
*/
|
||||
virtual void getBytes(guest_address_t addr, size_t cnt, void *dest) = 0;
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
virtual void setByte(guest_address_t addr, byte_t data) = 0;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
virtual void setBytes(guest_address_t addr, size_t cnt, void const *src) = 0;
|
||||
/**
|
||||
* Transforms the guest address \a addr to a host address.
|
||||
* @param addr The guest address to be transformed
|
||||
* @return the transformed (host) address or \c ADDR_INV on errors
|
||||
*/
|
||||
virtual host_address_t guestToHost(guest_address_t addr) = 0;
|
||||
};
|
||||
|
||||
} // end-of-namespace: fail
|
||||
|
||||
@ -5,13 +5,13 @@ namespace fail {
|
||||
Register* UniformRegisterSet::getRegister(size_t i)
|
||||
{
|
||||
assert(i < m_Regs.size() && "FATAL ERROR: Invalid index provided!");
|
||||
return (m_Regs[i]);
|
||||
return m_Regs[i];
|
||||
}
|
||||
|
||||
Register* RegisterManager::getRegister(size_t i)
|
||||
{
|
||||
assert(i < m_Registers.size() && "FATAL ERROR: Invalid index provided!");
|
||||
return (m_Registers[i]);
|
||||
return m_Registers[i];
|
||||
}
|
||||
|
||||
void RegisterManager::add(Register* reg)
|
||||
@ -20,7 +20,7 @@ void RegisterManager::add(Register* reg)
|
||||
m_Registers.push_back(reg);
|
||||
|
||||
UniformRegisterSet* urs = getSetOfType(reg->getType());
|
||||
if(urs == NULL) {
|
||||
if (urs == NULL) {
|
||||
urs = new UniformRegisterSet(reg->getType());
|
||||
m_Subsets.push_back(urs);
|
||||
}
|
||||
@ -38,29 +38,28 @@ void UniformRegisterSet::m_add(Register* preg)
|
||||
|
||||
size_t RegisterManager::count() const
|
||||
{
|
||||
return (m_Registers.size());
|
||||
return m_Registers.size();
|
||||
}
|
||||
|
||||
UniformRegisterSet& RegisterManager::getSet(size_t i)
|
||||
{
|
||||
assert(i < m_Subsets.size() && "FATAL ERROR: Invalid index provided!");
|
||||
return (*m_Subsets[i]);
|
||||
return *m_Subsets[i];
|
||||
}
|
||||
|
||||
UniformRegisterSet* RegisterManager::getSetOfType(RegisterType t)
|
||||
{
|
||||
for(std::vector< UniformRegisterSet* >::iterator it = m_Subsets.begin();
|
||||
it != m_Subsets.end(); it++)
|
||||
{
|
||||
for (std::vector< UniformRegisterSet* >::iterator it = m_Subsets.begin();
|
||||
it != m_Subsets.end(); it++) {
|
||||
if((*it)->getType() == t)
|
||||
return (*it);
|
||||
return *it;
|
||||
}
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void RegisterManager::clear()
|
||||
{
|
||||
for(std::vector< UniformRegisterSet* >::iterator it = m_Subsets.begin();
|
||||
for (std::vector< UniformRegisterSet* >::iterator it = m_Subsets.begin();
|
||||
it != m_Subsets.end(); it++)
|
||||
delete (*it);
|
||||
m_Subsets.clear();
|
||||
|
||||
Reference in New Issue
Block a user