X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Farch%2Fx86%2Fisa.hh;h=855c8e7b3095120eddbcc6ebd5ab29d6eff0a7f1;hb=f1840c9951408b25340ad6f383143f1018003d23;hp=e87d747bca1b126802e9a1fc03d1f115422bd0f5;hpb=25ec278a0be5e3e09d396ef5be993e45b766790b;p=gem5.git diff --git a/src/arch/x86/isa.hh b/src/arch/x86/isa.hh index e87d747bc..855c8e7b3 100644 --- a/src/arch/x86/isa.hh +++ b/src/arch/x86/isa.hh @@ -24,8 +24,6 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Gabe Black */ #ifndef __ARCH_X86_ISA_HH__ @@ -34,10 +32,12 @@ #include #include +#include "arch/generic/isa.hh" +#include "arch/x86/registers.hh" #include "arch/x86/regs/float.hh" #include "arch/x86/regs/misc.hh" -#include "arch/x86/registers.hh" #include "base/types.hh" +#include "cpu/reg_class.hh" #include "sim/sim_object.hh" class Checkpoint; @@ -47,36 +47,49 @@ struct X86ISAParams; namespace X86ISA { - class ISA : public SimObject + class ISA : public BaseISA { protected: - MiscReg regVal[NUM_MISCREGS]; + RegVal regVal[NUM_MISCREGS]; void updateHandyM5Reg(Efer efer, CR0 cr0, - SegAttr csAttr, SegAttr ssAttr, RFLAGS rflags, - ThreadContext *tc); + SegAttr csAttr, SegAttr ssAttr, RFLAGS rflags); public: - typedef X86ISAParams Params; - void clear(); + typedef X86ISAParams Params; + ISA(Params *p); const Params *params() const; - MiscReg readMiscRegNoEffect(int miscReg); - MiscReg readMiscReg(int miscReg, ThreadContext *tc); + RegVal readMiscRegNoEffect(int miscReg) const; + RegVal readMiscReg(int miscReg); - void setMiscRegNoEffect(int miscReg, MiscReg val); - void setMiscReg(int miscReg, MiscReg val, ThreadContext *tc); + void setMiscRegNoEffect(int miscReg, RegVal val); + void setMiscReg(int miscReg, RegVal val); - int - flattenIntIndex(int reg) + RegId + flattenRegId(const RegId& regId) const { - return reg & ~IntFoldBit; + switch (regId.classValue()) { + case IntRegClass: + return RegId(IntRegClass, flattenIntIndex(regId.index())); + case FloatRegClass: + return RegId(FloatRegClass, flattenFloatIndex(regId.index())); + case CCRegClass: + return RegId(CCRegClass, flattenCCIndex(regId.index())); + case MiscRegClass: + return RegId(MiscRegClass, flattenMiscIndex(regId.index())); + default: + break; + } + return regId; } + int flattenIntIndex(int reg) const { return reg & ~IntFoldBit; } + int - flattenFloatIndex(int reg) + flattenFloatIndex(int reg) const { if (reg >= NUM_FLOATREGS) { reg = FLOATREG_STACK(reg - NUM_FLOATREGS, @@ -85,9 +98,16 @@ namespace X86ISA return reg; } - void serialize(std::ostream &os); - void unserialize(Checkpoint *cp, const std::string §ion); - void startup(ThreadContext *tc); + int flattenVecIndex(int reg) const { return reg; } + int flattenVecElemIndex(int reg) const { return reg; } + int flattenVecPredIndex(int reg) const { return reg; } + int flattenCCIndex(int reg) const { return reg; } + int flattenMiscIndex(int reg) const { return reg; } + + void serialize(CheckpointOut &cp) const override; + void unserialize(CheckpointIn &cp) override; + + void setThreadContext(ThreadContext *_tc) override; }; }