File indexing completed on 2024-05-12 04:39:44

0001 /*
0002     SPDX-FileCopyrightText: 2013 Vlas Puhov <vlas.puhov@mail.ru>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef REGISTERCONTROLLER_X86_H
0008 #define REGISTERCONTROLLER_X86_H
0009 
0010 #include "registercontroller.h"
0011 
0012 namespace KDevMI
0013 {
0014 class MIDebugSession;
0015 
0016 class RegisterControllerGeneral_x86 : public IRegisterController
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     QVector<GroupsName> namesOfRegisterGroups() const override;
0022 
0023 public Q_SLOTS:
0024     void updateRegisters(const GroupsName& group = GroupsName()) override;
0025 
0026 protected:
0027     explicit RegisterControllerGeneral_x86(MIDebugSession* debugSession = nullptr, QObject* parent = nullptr);
0028 
0029     RegistersGroup registersFromGroup(const GroupsName& group) const override;
0030 
0031     QStringList registerNamesForGroup(const GroupsName& group) const override;
0032 
0033     void updateValuesForRegisters(RegistersGroup* registers) const override;
0034 
0035     void setRegisterValueForGroup(const GroupsName& group, const Register& reg) override;
0036 
0037     enum X86RegisterGroups {General, Flags, FPU, XMM, Segment, LAST_REGISTER};
0038 
0039     GroupsName enumToGroupName(X86RegisterGroups group) const;
0040     //None of functions below checks value for validity, if value is invalid updateRegistres() will restore the previous state.
0041 
0042     void setFPURegister(const Register& reg);
0043     void setXMMRegister(const Register& reg);
0044     void setSegmentRegister(const Register& reg);
0045     void setEFfagRegister(const Register& reg);
0046 private:
0047     void initRegisterNames();
0048 
0049 protected:
0050     static QVector<QStringList> m_registerNames;
0051 
0052     static FlagRegister m_eflags;
0053 
0054     ///Indicates if register names were initialized.
0055     bool m_registerNamesInitialized = false;
0056 };
0057 
0058 class RegisterController_x86 : public RegisterControllerGeneral_x86
0059 {
0060     Q_OBJECT
0061 
0062 public:
0063     explicit RegisterController_x86(MIDebugSession* debugSession = nullptr, QObject* parent = nullptr);
0064 
0065 private:
0066     void initRegisterNames();
0067 };
0068 
0069 class RegisterController_x86_64 : public RegisterControllerGeneral_x86
0070 {
0071     Q_OBJECT
0072 
0073 public:
0074     explicit RegisterController_x86_64(MIDebugSession* debugSession = nullptr, QObject* parent = nullptr);
0075 
0076 private:
0077     void initRegisterNames();
0078 };
0079 
0080 } // end of namespace KDevMI
0081 
0082 #endif // REGISTERCONTROLLER_X86_H