diff --git a/core/SAL/Register.hpp b/core/SAL/Register.hpp index b42a05dc..2a8fad83 100644 --- a/core/SAL/Register.hpp +++ b/core/SAL/Register.hpp @@ -269,14 +269,6 @@ class RegisterManager * @return the base pointer */ virtual address_t getBasePointer() = 0; - /** - * Retrieves the textual description (mnemoric) for the current - * instruction. - * The format of the returned string is simulator-specific. - * @return the mnemoric of the current instruction whose address - * is given by \c getInstructionPointer(). - */ - virtual const std::string& getMnemoric() const = 0; }; } // end-of-namespace: sal diff --git a/core/SAL/bochs/BochsController.hpp b/core/SAL/bochs/BochsController.hpp index f232c96b..97450038 100644 --- a/core/SAL/bochs/BochsController.hpp +++ b/core/SAL/bochs/BochsController.hpp @@ -170,6 +170,30 @@ class BochsController : public SimulatorController */ void dbgEnableInstrPtrOutput(unsigned regularity, std::ostream* dest = &cout); #endif + /* ******************************************************************** + * BochsController-specific (not implemented in SimulatorController!): + * ********************************************************************/ + /** + * Retrieves the textual description (mnemonic) for the current + * instruction. The format of the returned string is Bochs-specific. + * @return the mnemonic of the current instruction whose address + * is given by \c Register::getInstructionPointer(). On + * errors, the returned string is empty + */ + const std::string& getMnemonic() const + { + static std::string str; + bxICacheEntry_c* pEntry = BX_CPU(0)->getICacheEntry(); + assert(pEntry != NULL && "FATAL ERROR: Bochs internal function returned NULL (not expected)!"); + bxInstruction_c* pInstr = pEntry->i; + assert(pInstr != NULL && "FATAL ERROR: Bochs internal member was NULL (not expected)!"); + const char* pszName = get_bx_opcode_name(pInstr->getIaOpcode()); + if (pszName != NULL) + str = pszName; + else + str.clear(); + return str; + } }; } // end-of-namespace: sal diff --git a/core/SAL/bochs/BochsRegister.hpp b/core/SAL/bochs/BochsRegister.hpp index 01a77b37..0546f71e 100644 --- a/core/SAL/bochs/BochsRegister.hpp +++ b/core/SAL/bochs/BochsRegister.hpp @@ -38,7 +38,7 @@ class BochsRegister : public Register * Sets the content of the register. * @param data the new register data to be written */ - virtual void setData(regdata_t data) { *m_pData = data; } + void setData(regdata_t data) { *m_pData = data; } }; /** @@ -239,27 +239,6 @@ class BochsRegisterManager : public RegisterManager return (static_cast(getRegister(RID_EBP)->getData())); #endif } - /** - * Retrieves the textual description (mnemoric) for the current - * instruction. The format of the returned string is Bochs-specific. - * @return the mnemoric of the current instruction whose address - * is given by \c getInstructionPointer(). On errors, the - * returned string is empty - */ - const std::string& getMnemoric() const - { - static std::string str; - bxICacheEntry_c* pEntry = BX_CPU(0)->getICacheEntry(); - assert(pEntry != NULL && "FATAL ERROR: Bochs internal function returned NULL (not expected)!"); - bxInstruction_c* pInstr = pEntry->i; - assert(pInstr != NULL && "FATAL ERROR: Bochs internal member was NULL (not expected)!"); - const char* pszName = get_bx_opcode_name(pInstr->getIaOpcode()); - if (pszName != NULL) - str = pszName; - else - str.clear(); - return str; - } }; } // end-of-namespace: sal diff --git a/doc/class-diagram.dia b/doc/class-diagram.dia index 597827be..6bfbc270 100644 --- a/doc/class-diagram.dia +++ b/doc/class-diagram.dia @@ -1844,7 +1844,7 @@ - + @@ -1853,7 +1853,7 @@ - + #BochsController# @@ -2702,6 +2702,36 @@ + + + #getMnemonic# + + + ## + + + #const string&# + + + + + + ## + + + + + + + + + + + + + + + @@ -2720,8 +2750,8 @@ - - + + @@ -2746,7 +2776,7 @@ - + @@ -4941,8 +4971,8 @@ - - + + @@ -5092,8 +5122,8 @@ - - + + @@ -5674,8 +5704,8 @@ - - + + @@ -5819,8 +5849,8 @@ - - + + @@ -6391,15 +6421,15 @@ - + - - + + @@ -6469,8 +6499,8 @@ - - + + @@ -7158,8 +7188,8 @@ - - + + @@ -7407,8 +7437,8 @@ - - + + @@ -7994,8 +8024,8 @@ - - + + @@ -8391,8 +8421,8 @@ - - + + @@ -9531,7 +9561,7 @@ - + @@ -9540,7 +9570,7 @@ - + #RegisterManager# @@ -9552,7 +9582,7 @@ ## - + @@ -9979,36 +10009,6 @@ - - - #getMnemoric()# - - - ## - - - #const string&# - - - - - - ## - - - - - - - - - - - - - - - @@ -10468,16 +10468,16 @@ - + - + - + @@ -10497,7 +10497,7 @@ - + @@ -10542,7 +10542,7 @@ - + @@ -10550,8 +10550,8 @@ - - + + @@ -10569,7 +10569,7 @@ - + @@ -10978,8 +10978,8 @@ - - + + @@ -11129,8 +11129,8 @@ - - + + @@ -11280,8 +11280,8 @@ - - + + @@ -11321,8 +11321,8 @@ - - + + @@ -11973,8 +11973,8 @@ - - + + @@ -12014,8 +12014,8 @@ - - + + @@ -13301,8 +13301,8 @@ - - + + @@ -13329,7 +13329,7 @@ - + @@ -13338,7 +13338,7 @@ - + #BochsRegisterManager# @@ -13519,36 +13519,6 @@ - - - #getMnemoric# - - - ## - - - #const string&# - - - - - - ## - - - - - - - - - - - - - - - @@ -13557,19 +13527,19 @@ - + - + - - - - + + + + @@ -13592,8 +13562,8 @@ ## - - + + @@ -15466,8 +15436,8 @@ - - + + @@ -15507,8 +15477,8 @@ - - + + @@ -15761,19 +15731,21 @@ - + - - + + + + @@ -15807,8 +15779,8 @@ - - + + @@ -16877,8 +16849,8 @@ - - + + @@ -17338,7 +17310,7 @@ - + @@ -17379,15 +17351,15 @@ - + - - + + @@ -17420,15 +17392,15 @@ - + - - + + diff --git a/doc/class-diagram.png b/doc/class-diagram.png index 1220d002..6658b934 100644 Binary files a/doc/class-diagram.png and b/doc/class-diagram.png differ