sal/bochs: move register IDs to a separate file

This is necessary as a temporary fix: Currently, campaign code cannot use
Fail*'s architecture abstractions at all (e.g., we cannot iterate over all
existing GP registers).  Until this is corrected by separating a concrete
backend and architecture information (the latter being usable by a
campaign), we now at least can use register IDs.

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1792 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
hsc
2012-10-22 15:36:09 +00:00
parent 069cd42d4d
commit 0d1618746c
2 changed files with 46 additions and 34 deletions

View File

@ -2,6 +2,7 @@
#define __BOCHS_REGISTER_HPP__
#include "../Register.hpp"
#include "BochsRegisterIDs.hpp"
#include "bochs.h"
@ -57,40 +58,6 @@ public:
: BochsRegister(id, width, link, RT_GP) { }
};
/**
* \enum GPRegisterId
* Symbolic identifier to access Bochs' general purpose register
* (within the corresponding GP set), e.g.
* \code
* // Print %eax register data:
* BochsController bc(...);
* cout << bc.getRegisterManager().getSetOfType(RT_GP)
* .getRegister(RID_EAX)->getData();
* \endcode
*/
enum GPRegisterId {
#if BX_SUPPORT_X86_64 // 64 bit register id's:
RID_RAX = 0, RID_RCX, RID_RDX, RID_RBX, RID_RSP, RID_RBP, RID_RSI, RID_RDI,
RID_R8, RID_R9, RID_R10, RID_R11, RID_R12, RID_R13, RID_R14, RID_R15,
#else // 32 bit register id's:
RID_EAX = 0, RID_ECX, RID_EDX, RID_EBX, RID_ESP, RID_EBP, RID_ESI, RID_EDI,
#endif // common register id's (independent of the current register width):
RID_CAX = 0, RID_CCX, RID_CDX, RID_CBX, RID_CSP, RID_CBP, RID_CSI, RID_CDI,
RID_LAST_GP_ID
};
/**
* \enum PCRegisterId
* Symbolic identifier to access Bochs' program counter register.
*/
enum PCRegisterId { RID_PC = RID_LAST_GP_ID, RID_LAST_PC_ID };
/**
* \enum FlagsRegisterId
* Symbolic identifier to access Bochs' flags register.
*/
enum FlagsRegisterId { RID_FLAGS = RID_LAST_PC_ID };
/**
* \class BxPCReg
* Bochs-specific implementation of the x86 program counter register.

View File

@ -0,0 +1,45 @@
#ifndef __BOCHS_REGISTER_IDS_HPP__
#define __BOCHS_REGISTER_IDS_HPP__
// FIXME: This should be part of an x86 architecture-specific header, outside
// the bochs/ subdirectory, and be usable from a campaign without an existing
// simulator backend. (Also, iterating over registers should be possible.)
namespace fail {
/**
* \enum GPRegisterId
* Symbolic identifier to access Bochs' general purpose register
* (within the corresponding GP set), e.g.
* \code
* // Print %eax register data:
* BochsController bc(...);
* cout << bc.getRegisterManager().getSetOfType(RT_GP)
* .getRegister(RID_EAX)->getData();
* \endcode
*/
enum GPRegisterId {
#if BX_SUPPORT_X86_64 // 64 bit register id's:
RID_RAX = 0, RID_RCX, RID_RDX, RID_RBX, RID_RSP, RID_RBP, RID_RSI, RID_RDI,
RID_R8, RID_R9, RID_R10, RID_R11, RID_R12, RID_R13, RID_R14, RID_R15,
#else // 32 bit register id's:
RID_EAX = 0, RID_ECX, RID_EDX, RID_EBX, RID_ESP, RID_EBP, RID_ESI, RID_EDI,
#endif // common register id's (independent of the current register width):
RID_CAX = 0, RID_CCX, RID_CDX, RID_CBX, RID_CSP, RID_CBP, RID_CSI, RID_CDI,
RID_LAST_GP_ID
};
/**
* \enum PCRegisterId
* Symbolic identifier to access Bochs' program counter register.
*/
enum PCRegisterId { RID_PC = RID_LAST_GP_ID, RID_LAST_PC_ID };
/**
* \enum FlagsRegisterId
* Symbolic identifier to access Bochs' flags register.
*/
enum FlagsRegisterId { RID_FLAGS = RID_LAST_PC_ID };
}
#endif