x86, mem: Get rid of PageTableOps::getBasePtr.
authorGabe Black <gabeblack@google.com>
Sat, 6 Jan 2018 07:52:29 +0000 (23:52 -0800)
committerGabe Black <gabeblack@google.com>
Sat, 20 Jan 2018 08:08:06 +0000 (08:08 +0000)
Pass this constant into the page table constructor.

Change-Id: Icbf730f18d9dfcfebd10a196f7f799514728b0fb
Reviewed-on: https://gem5-review.googlesource.com/7345
Maintainer: Gabe Black <gabeblack@google.com>
Reviewed-by: Brandon Potter <Brandon.Potter@amd.com>
src/arch/x86/pagetable.hh
src/arch/x86/process.cc
src/mem/multi_level_page_table.hh
src/mem/multi_level_page_table_impl.hh

index 354fb5a5c363bd27560d514719d5d1d869700e82..490a2591bbb084fd2cccf37dd10ccb9b201aa776 100644 (file)
@@ -179,14 +179,6 @@ namespace X86ISA
             PTE.u   = flags & PTE_Supervisor  ? 0 : 1;
         }
 
-        /** returns the physical memory address of the page table */
-        Addr getBasePtr(ThreadContext* tc)
-        {
-            CR3 cr3 = pageTablePhysAddr;
-            DPRINTF(MMU, "CR3: %d\n", cr3);
-            return cr3.longPdtb;
-        }
-
         /** returns the page number out of a page table entry */
         Addr getPnum(PageTableEntry PTE)
         {
index 627750cbd5f8ba024e7f2dfa502c29e8ba70d9ea..0a94ac4179eadd5860de0765817981d273d5529c 100644 (file)
@@ -100,9 +100,11 @@ X86Process::X86Process(ProcessParams *params, ObjectFile *objFile,
                        SyscallDesc *_syscallDescs, int _numSyscallDescs)
     : Process(params, params->useArchPT ?
                       static_cast<EmulationPageTable *>(
-                              new ArchPageTable(params->name, params->pid,
-                                                params->system, PageBytes,
-                                                PageTableLayout)) :
+                              new ArchPageTable(
+                                      params->name, params->pid,
+                                      params->system, PageBytes,
+                                      PageTableLayout,
+                                      pageTablePhysAddr >> PageShift)) :
                       new EmulationPageTable(params->name, params->pid,
                                              PageBytes),
               objFile),
index f71dc0dbc42fa05dc5f9e38e2be2bbd3a1c1a073..7cbbd8c0ef929697f333e1a5902cf65e89b0a1d0 100644 (file)
@@ -140,7 +140,8 @@ class MultiLevelPageTable : public EmulationPageTable
 public:
     MultiLevelPageTable(const std::string &__name, uint64_t _pid,
                         System *_sys, Addr pageSize,
-                        const std::vector<uint8_t> &layout);
+                        const std::vector<uint8_t> &layout,
+                        Addr _basePtr);
     ~MultiLevelPageTable();
 
     void initState(ThreadContext* tc) override;
index 2d7ddc4e4c7867c01f7408fa66e400277b8cd74c..3356c9ea230cbf70173f81c1540950901cdcacb7 100644 (file)
@@ -47,10 +47,9 @@ using namespace TheISA;
 template <class ISAOps>
 MultiLevelPageTable<ISAOps>::MultiLevelPageTable(
         const std::string &__name, uint64_t _pid, System *_sys,
-        Addr pageSize, const std::vector<uint8_t> &layout)
+        Addr pageSize, const std::vector<uint8_t> &layout, Addr _basePtr)
     : EmulationPageTable(__name, _pid, pageSize), system(_sys),
-    logLevelSize(layout),
-    numLevels(logLevelSize.size())
+    basePtr(_basePtr), logLevelSize(layout), numLevels(logLevelSize.size())
 {
 }
 
@@ -63,11 +62,6 @@ template <class ISAOps>
 void
 MultiLevelPageTable<ISAOps>::initState(ThreadContext* tc)
 {
-    basePtr = pTableISAOps.getBasePtr(tc);
-    if (basePtr == 0)
-        basePtr++;
-    DPRINTF(MMU, "basePtr: %d\n", basePtr);
-
     system->pagePtr = basePtr;
 
     /* setting first level of the page table */