X86: Implement the media floating point max instructions.
[gem5.git] / src / arch / x86 / isa.hh
index 34c803f0cea00b3f31cc4cb39ec3b4933a82c883..9a1880062d4b77a83cdbe0aecefcc4d8eee73c83 100644 (file)
 #ifndef __ARCH_X86_ISA_HH__
 #define __ARCH_X86_ISA_HH__
 
-#include "arch/x86/miscregfile.hh"
-#include "arch/x86/types.hh"
+#include "arch/x86/floatregs.hh"
+#include "arch/x86/miscregs.hh"
+#include "arch/x86/registers.hh"
+#include "base/types.hh"
+
+#include <string>
+#include <iostream>
 
 class Checkpoint;
 class EventManager;
+class ThreadContext;
 
 namespace X86ISA
 {
     class ISA
     {
       protected:
-        MiscRegFile miscRegFile;
+        MiscReg regVal[NUM_MISCREGS];
+        void updateHandyM5Reg(Efer efer, CR0 cr0,
+                SegAttr csAttr, SegAttr ssAttr, RFLAGS rflags);
 
       public:
-        int instAsid()
-        {
-            //XXX This doesn't make sense in x86
-            return 0;
-        }
+        void clear();
 
-        int dataAsid()
+        ISA()
         {
-            //XXX This doesn't make sense in x86
-            return 0;
+            clear();
         }
 
-        void clear();
-
         MiscReg readMiscRegNoEffect(int miscReg);
         MiscReg readMiscReg(int miscReg, ThreadContext *tc);
 
-        void setMiscRegNoEffect(int miscReg, const MiscReg val);
-        void setMiscReg(int miscReg, const MiscReg val,
-                ThreadContext *tc);
+        void setMiscRegNoEffect(int miscReg, MiscReg val);
+        void setMiscReg(int miscReg, MiscReg val, ThreadContext *tc);
 
-        int flattenIntIndex(int reg);
-        int flattenFloatIndex(int reg);
+        int
+        flattenIntIndex(int reg)
+        {
+            return reg & ~IntFoldBit;
+        }
+
+        int
+        flattenFloatIndex(int reg)
+        {
+            if (reg >= NUM_FLOATREGS) {
+                reg = FLOATREG_STACK(reg - NUM_FLOATREGS,
+                                     regVal[MISCREG_X87_TOP]);
+            }
+            return reg;
+        }
 
         void serialize(EventManager *em, std::ostream &os);
         void unserialize(EventManager *em, Checkpoint *cp,