X86: Pass whether an access was a read/write/fetch so faults can behave accordingly.
authorGabe Black <gblack@eecs.umich.edu>
Mon, 23 Feb 2009 08:20:34 +0000 (00:20 -0800)
committerGabe Black <gblack@eecs.umich.edu>
Mon, 23 Feb 2009 08:20:34 +0000 (00:20 -0800)
src/arch/x86/faults.cc
src/arch/x86/faults.hh
src/arch/x86/pagetable_walker.cc
src/arch/x86/pagetable_walker.hh
src/arch/x86/tlb.cc
src/arch/x86/tlb.hh

index 1234e68e5d2381b8c1591b8a94ad627c73e14fa7..f01197f361bea85ef2ac36866fcbcaa9b9b397f6 100644 (file)
@@ -166,13 +166,13 @@ namespace X86ISA
     void FakeITLBFault::invoke(ThreadContext * tc)
     {
         // Start the page table walker.
-        tc->getITBPtr()->walk(tc, vaddr);
+        tc->getITBPtr()->walk(tc, vaddr, write, execute);
     }
 
     void FakeDTLBFault::invoke(ThreadContext * tc)
     {
         // Start the page table walker.
-        tc->getDTBPtr()->walk(tc, vaddr);
+        tc->getDTBPtr()->walk(tc, vaddr, write, execute);
     }
 
 #else // !FULL_SYSTEM
index 6a6dfc80a5ec675c99a76f6c0cd2a267acdf0133..ae4314434993a7db17685a7e84dfbeae1021c7a0 100644 (file)
@@ -429,10 +429,12 @@ namespace X86ISA
     {
       protected:
         Addr vaddr;
+        bool write;
+        bool execute;
       public:
-        FakeITLBFault(Addr _vaddr) :
+        FakeITLBFault(Addr _vaddr, bool _write, bool _execute) :
             X86Fault("fake instruction tlb fault", "itlb", 0),
-            vaddr(_vaddr)
+            vaddr(_vaddr), write(_write), execute(_execute)
         {}
 
         void invoke(ThreadContext * tc);
@@ -442,10 +444,12 @@ namespace X86ISA
     {
       protected:
         Addr vaddr;
+        bool write;
+        bool execute;
       public:
-        FakeDTLBFault(Addr _vaddr) :
+        FakeDTLBFault(Addr _vaddr, bool _write, bool _execute) :
             X86Fault("fake data tlb fault", "dtlb", 0),
-            vaddr(_vaddr)
+            vaddr(_vaddr), write(_write), execute(_execute)
         {}
 
         void invoke(ThreadContext * tc);
index 564a04b381369a907ff6de4f6719112b9dfc0d68..b0b9209b5e58d6c368c14b73470d0b3c897a5e40 100644 (file)
@@ -319,11 +319,13 @@ Walker::doNext(PacketPtr &read, PacketPtr &write)
 }
 
 void
-Walker::start(ThreadContext * _tc, Addr vaddr)
+Walker::start(ThreadContext * _tc, Addr vaddr, bool _write, bool _execute)
 {
     assert(state == Ready);
     assert(!tc);
     tc = _tc;
+    execute = _execute;
+    write = _write;
 
     VAddr addr = vaddr;
 
index 324f16f3cc1f8a0630998a0c76e62a68294963ec..de3f21195f4f90a5e02a5e23c1c0b2ec2c6d1241 100644 (file)
@@ -95,7 +95,7 @@ namespace X86ISA
         void doNext(PacketPtr &read, PacketPtr &write);
 
         // Kick off the state machine.
-        void start(ThreadContext * _tc, Addr vaddr);
+        void start(ThreadContext * _tc, Addr vaddr, bool write, bool execute);
 
       protected:
 
@@ -165,7 +165,10 @@ namespace X86ISA
         State nextState;
         int size;
         bool enableNX;
+        bool write, execute;
         TlbEntry entry;
+        
+        Fault pageFault(bool present);
 
       public:
 
index 1009386d7fef1783ee2ab5f922ad04deb05201f3..34829848c96a13abe033f254b1502a9a0468478c 100644 (file)
@@ -140,9 +140,9 @@ TLB::lookup(Addr va, bool update_lru)
 
 #if FULL_SYSTEM
 void
-TLB::walk(ThreadContext * _tc, Addr vaddr)
+TLB::walk(ThreadContext * _tc, Addr vaddr, bool write, bool execute)
 {
-    walker->start(_tc, vaddr);
+    walker->start(_tc, vaddr, write, execute);
 }
 #endif
 
@@ -616,7 +616,7 @@ TLB::translate(RequestPtr &req, ThreadContext *tc, bool write, bool execute)
             // The vaddr already has the segment base applied.
             TlbEntry *entry = lookup(vaddr);
             if (!entry) {
-                return new TlbFault(vaddr);
+                return new TlbFault(vaddr, write, execute);
             } else {
                 // Do paging protection checks.
                 DPRINTF(TLB, "Entry found with paddr %#x, doing protection checks.\n", entry->paddr);
index 89b965e971177f792d2d567ac2e4d43da445d636..56d635a90b140854fcad7333c4908d414d3e08e5 100644 (file)
@@ -119,7 +119,7 @@ namespace X86ISA
 
         Walker * walker;
 
-        void walk(ThreadContext * _tc, Addr vaddr);
+        void walk(ThreadContext * _tc, Addr vaddr, bool write, bool execute);
 #endif
 
       public: