X86: Compute PCI config addresses correctly.
[gem5.git] / src / arch / x86 / pagetable.hh
index aaf82ed70f95aa2cf897521c788045fec108d908..e42693c03d9d6a3c137b267d1bcf7be19786e0da 100644 (file)
 #include <string>
 
 #include "sim/host.hh"
+#include "base/bitunion.hh"
 #include "base/misc.hh"
 
 class Checkpoint;
 
 namespace X86ISA
 {
-    struct VAddr
-    {
-        VAddr(Addr a) { panic("not implemented yet."); }
-    };
+    BitUnion64(VAddr)
+        Bitfield<20, 12> longl1;
+        Bitfield<29, 21> longl2;
+        Bitfield<38, 30> longl3;
+        Bitfield<47, 39> longl4;
+
+        Bitfield<20, 12> pael1;
+        Bitfield<29, 21> pael2;
+        Bitfield<31, 30> pael3;
+
+        Bitfield<21, 12> norml1;
+        Bitfield<31, 22> norml2;
+    EndBitUnion(VAddr)
 
     struct TlbEntry
     {
         // The base of the physical page.
-        Addr pageStart;
+        Addr paddr;
+
+        // The beginning of the virtual page this entry maps.
+        Addr vaddr;
+        // The size of the page this entry represents.
+        Addr size;
+
         // Read permission is always available, assuming it isn't blocked by
         // other mechanisms.
-        bool writeable;
+        bool writable;
         // Whether this page is accesible without being in supervisor mode.
         bool user;
         // Whether to use write through or write back. M5 ignores this and
@@ -94,13 +110,13 @@ namespace X86ISA
         // Whether or not memory on this page can be executed.
         bool noExec;
 
-        // The beginning of the virtual page this entry maps.
-        Addr vaddr;
-        // The size of the page this entry represents.
-        Addr size;
-
+        TlbEntry(Addr asn, Addr _vaddr, Addr _paddr);
         TlbEntry() {}
-        TlbEntry(Addr paddr) : pageStart(paddr) {}
+
+        Addr pageStart()
+        {
+            return paddr;
+        }
 
         void serialize(std::ostream &os);
         void unserialize(Checkpoint *cp, const std::string &section);