misc: Clean up usage of arch/isa_traits.hh.
authorGabe Black <gabeblack@google.com>
Sat, 22 Aug 2020 04:58:03 +0000 (21:58 -0700)
committerGabe Black <gabeblack@google.com>
Fri, 28 Aug 2020 07:20:58 +0000 (07:20 +0000)
isa_traits.hh used to have much more in it, but now it only has
PageShift, PageBytes, and (for now) the guest endianness. These values
should only be retrieved from the System class generally speaking, so
only the system class should include arch/isa_traits.hh.

Some gpu compute related files need PageBytes or PageShift. Even though
those files don't advertise their ISA dependence, they are tied to x86.
In those files, they can include arch/x86/isa_traits.hh.

The only other file which legitimately needs arch/isa_traits.hh is the
decoder cache since it uses PageBytes to size an array.

Change-Id: I12686368715623e3140a68a7027c136bd52567b1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33203
Reviewed-by: Gabe Black <gabeblack@google.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
28 files changed:
src/arch/generic/memhelpers.hh
src/arch/riscv/registers.hh
src/cpu/base.hh
src/cpu/checker/cpu_impl.hh
src/cpu/exetrace.cc
src/cpu/o3/dyn_inst.hh
src/cpu/o3/fetch_impl.hh
src/cpu/o3/impl.hh
src/cpu/o3/lsq_unit.hh
src/cpu/o3/regfile.hh
src/cpu/o3/rename_impl.hh
src/cpu/pred/bpred_unit.cc
src/cpu/pred/simple_indirect.hh
src/cpu/simple_thread.cc
src/cpu/simple_thread.hh
src/dev/storage/ide_disk.cc
src/dev/virtio/base.hh
src/gpu-compute/compute_unit.cc
src/gpu-compute/gpu_tlb.cc
src/gpu-compute/shader.cc
src/gpu-compute/shader.hh
src/gpu-compute/tlb_coalescer.cc
src/gpu-compute/tlb_coalescer.hh
src/kern/linux/helpers.cc
src/mem/cache/prefetch/base.hh
src/sim/faults.cc
src/sim/process.cc
src/sim/syscall_emul.cc

index ffdf543c0fa91ff0ad371a7f0e08a16935adeaed..d08bea9146843c926e292b7c8d3c81037d532ec9 100644 (file)
@@ -41,7 +41,6 @@
 #ifndef __ARCH_GENERIC_MEMHELPERS_HH__
 #define __ARCH_GENERIC_MEMHELPERS_HH__
 
-#include "arch/isa_traits.hh"
 #include "base/types.hh"
 #include "mem/packet.hh"
 #include "mem/request.hh"
index 9b899e343793f56f7878bc9fc616372be588bc6e..7ce59e32c4356b613f1f719ee988bde87420fc0a 100644 (file)
@@ -52,7 +52,6 @@
 #include "arch/generic/types.hh"
 #include "arch/generic/vec_pred_reg.hh"
 #include "arch/generic/vec_reg.hh"
-#include "arch/isa_traits.hh"
 #include "arch/riscv/generated/max_inst_regs.hh"
 #include "base/types.hh"
 
index 5c0c709cd801f662f91d88c72f087a1853498ed2..3ef551949f0fbe5759b844aa353a44489e5bcd5f 100644 (file)
@@ -51,7 +51,6 @@
 #include "arch/null/cpu_dummy.hh"
 #else
 #include "arch/generic/interrupts.hh"
-#include "arch/isa_traits.hh"
 #include "base/statistics.hh"
 #include "mem/port_proxy.hh"
 #include "sim/clocked_object.hh"
index 0656035c837fd34293f6338d0b42c911b4288a28..c6d2cf86a9452908dcd1e3a6ef0e847c3e9cd740 100644 (file)
@@ -45,7 +45,6 @@
 #include <list>
 #include <string>
 
-#include "arch/isa_traits.hh"
 #include "base/refcnt.hh"
 #include "config/the_isa.hh"
 #include "cpu/base_dyn_inst.hh"
index c9c8b686cc6f4cad8d740697788b5ec03b83632e..ca050414720507479fea46f7b678707e98730307 100644 (file)
@@ -43,7 +43,6 @@
 #include <iomanip>
 #include <sstream>
 
-#include "arch/isa_traits.hh"
 #include "arch/utility.hh"
 #include "base/loader/symtab.hh"
 #include "config/the_isa.hh"
index c326058ec6cde050684df006f363087808de0067..d5f142c0c6b8f2906f3a3ffd147c0104b74b7df6 100644 (file)
@@ -44,7 +44,6 @@
 
 #include <array>
 
-#include "arch/isa_traits.hh"
 #include "config/the_isa.hh"
 #include "cpu/o3/cpu.hh"
 #include "cpu/o3/isa_specific.hh"
index 7ecab54618a58953a32f91ab7833341af03bb25b..314e0147e4d1415e53491a58ff7042162492b906 100644 (file)
@@ -49,7 +49,6 @@
 #include <queue>
 
 #include "arch/generic/tlb.hh"
-#include "arch/isa_traits.hh"
 #include "arch/utility.hh"
 #include "base/random.hh"
 #include "base/types.hh"
index b7f43c592afc122c4810866da22c18edbfb37d4f..1d7357750dced5328303ad01afd9d36a7e8f58ca 100644 (file)
@@ -29,7 +29,6 @@
 #ifndef __CPU_O3_IMPL_HH__
 #define __CPU_O3_IMPL_HH__
 
-#include "arch/isa_traits.hh"
 #include "config/the_isa.hh"
 #include "cpu/o3/cpu_policy.hh"
 
index 16dddfd18197e9bf45ec9070566033fae268845c..06d43eeae919f28cbeaa1df3e42e5584f77f476f 100644 (file)
@@ -49,7 +49,6 @@
 
 #include "arch/generic/debugfaults.hh"
 #include "arch/generic/vec_reg.hh"
-#include "arch/isa_traits.hh"
 #include "arch/locked_mem.hh"
 #include "config/the_isa.hh"
 #include "cpu/inst_seq.hh"
index 5fed9108af487e8a959bd27543e9a6cbf673f3b3..922089c13e991997c0cd61fb7c21ffdb5a547a4c 100644 (file)
@@ -44,7 +44,6 @@
 
 #include <vector>
 
-#include "arch/isa_traits.hh"
 #include "arch/types.hh"
 #include "base/trace.hh"
 #include "config/the_isa.hh"
index 7447764b64dafebd8f38976e27b4af1c435d72f0..36b513c8e7addc872fa7fe22db92df311e1772e9 100644 (file)
@@ -44,7 +44,6 @@
 
 #include <list>
 
-#include "arch/isa_traits.hh"
 #include "arch/registers.hh"
 #include "config/the_isa.hh"
 #include "cpu/o3/rename.hh"
index 4b93e30b39c849a2268893b09fa4596b5afa807a..ec9c5f832e53864c95c3dd0bc8aa2e1a6a398d8c 100644 (file)
@@ -44,7 +44,6 @@
 
 #include <algorithm>
 
-#include "arch/isa_traits.hh"
 #include "arch/types.hh"
 #include "arch/utility.hh"
 #include "base/trace.hh"
index f91e7844ca2bea6c3a3c03a6e0d93b9a3fe5dad0..e954892a1442ae13a85d8df814115b094ef28251 100644 (file)
@@ -31,7 +31,6 @@
 
 #include <deque>
 
-#include "arch/isa_traits.hh"
 #include "config/the_isa.hh"
 #include "cpu/inst_seq.hh"
 #include "cpu/pred/indirect.hh"
index 7ed2e827967ff523862a33812126faef61f3c7b0..14551fbab37b382f5cbe2d816153459b2a2925f4 100644 (file)
@@ -42,7 +42,6 @@
 
 #include <string>
 
-#include "arch/isa_traits.hh"
 #include "arch/utility.hh"
 #include "base/callback.hh"
 #include "base/compiler.hh"
index 612174ccb91313301394a9a505386708965987f3..8a2f22794c20edfb62bd7c7b236a235495501c2a 100644 (file)
@@ -47,7 +47,6 @@
 #include "arch/decoder.hh"
 #include "arch/generic/tlb.hh"
 #include "arch/isa.hh"
-#include "arch/isa_traits.hh"
 #include "arch/registers.hh"
 #include "arch/types.hh"
 #include "base/types.hh"
index c8d8bf9d4d4621f6a01df781aefb43710b7bc4de..e97e23b8e46a16b1c7206c1e91121170539536ce 100644 (file)
@@ -49,7 +49,6 @@
 #include <deque>
 #include <string>
 
-#include "arch/isa_traits.hh"
 #include "base/chunk_generator.hh"
 #include "base/cprintf.hh" // csprintf
 #include "base/trace.hh"
index 7c4c3f8865b4b18fc14085b6ca6c8cd73d5e5bf1..de6cfd12a3d4a929cc16992f856c4c3a1d7f2de9 100644 (file)
@@ -40,7 +40,6 @@
 
 #include <functional>
 
-#include "arch/isa_traits.hh"
 #include "base/bitunion.hh"
 #include "dev/virtio/virtio_ring.h"
 #include "mem/port_proxy.hh"
index 2d64fa3c7c4f1b38f30cedd900b2a08f668184ac..920257d8dce12e3a2185d5608eddda4f31d142fa 100644 (file)
@@ -35,6 +35,7 @@
 
 #include <limits>
 
+#include "arch/x86/isa_traits.hh"
 #include "base/output.hh"
 #include "debug/GPUDisp.hh"
 #include "debug/GPUExec.hh"
index a37618d3235dc357815ad8e14b1664e4002eab8f..513106f4a702fd3f206884d50308988ca64f8f85 100644 (file)
@@ -40,6 +40,7 @@
 
 #include "arch/x86/faults.hh"
 #include "arch/x86/insts/microldstop.hh"
+#include "arch/x86/isa_traits.hh"
 #include "arch/x86/pagetable.hh"
 #include "arch/x86/pagetable_walker.hh"
 #include "arch/x86/regs/misc.hh"
index 7b4f20f16f5ce1ceb8cacd151b9be3b360b50841..9ebbd3cf4d4722466738959d6f4a1f6686114e79 100644 (file)
@@ -35,6 +35,7 @@
 
 #include <limits>
 
+#include "arch/x86/isa_traits.hh"
 #include "arch/x86/linux/linux.hh"
 #include "base/chunk_generator.hh"
 #include "debug/GPUDisp.hh"
index 3e2e5695090ee337d6214a67e47ac464d51a293f..baf6df46c0c7a7e3f7ab34d85d6e6d6fcf827e26 100644 (file)
@@ -40,7 +40,6 @@
 #include <string>
 
 #include "arch/isa.hh"
-#include "arch/isa_traits.hh"
 #include "base/types.hh"
 #include "cpu/simple/atomic.hh"
 #include "cpu/simple/timing.hh"
index b5912326589669e1f5746770889a446fc67cf913..08eccd8d89a43789adb499a8a776f099a179d64d 100644 (file)
@@ -35,6 +35,7 @@
 
 #include <cstring>
 
+#include "arch/x86/isa_traits.hh"
 #include "base/logging.hh"
 #include "debug/GPUTLB.hh"
 #include "sim/process.hh"
index aff25157ecc8232f85008cb906c17582321931a2..defdc865da2ba2eb5fe49d74ba5caff4c2c1e894 100644 (file)
@@ -41,7 +41,6 @@
 
 #include "arch/generic/tlb.hh"
 #include "arch/isa.hh"
-#include "arch/isa_traits.hh"
 #include "arch/x86/pagetable.hh"
 #include "arch/x86/regs/segment.hh"
 #include "base/logging.hh"
index 028ad8ab0f9e5b3cf47a59650d2d4b45610d5631..9fb248774aa64678a4ed361060a72f522c4a5649 100644 (file)
@@ -37,7 +37,6 @@
 
 #include "kern/linux/helpers.hh"
 
-#include "arch/isa_traits.hh"
 #include "config/the_isa.hh"
 #include "cpu/thread_context.hh"
 #include "mem/port_proxy.hh"
index 7009db76e9cc041396959f4228f635ea6985f1ea..783fb011e5e22512d0f133b17a233713e93375f0 100644 (file)
@@ -48,7 +48,6 @@
 
 #include <cstdint>
 
-#include "arch/isa_traits.hh"
 #include "arch/generic/tlb.hh"
 #include "base/statistics.hh"
 #include "base/types.hh"
index 46485d49c68eb37199a0dbd17ec0cca6306108b9..9bbc11930d06094e420f8ca5a2d158dd984482e5 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "sim/faults.hh"
 
-#include "arch/isa_traits.hh"
 #include "base/logging.hh"
 #include "cpu/base.hh"
 #include "cpu/thread_context.hh"
index 28c0b542ea976d2f968aef705add133da625343c..9cf52aa2362dceb2e29e8eb4103f98ad70b9b80b 100644 (file)
@@ -318,7 +318,7 @@ Process::drain()
 void
 Process::allocateMem(Addr vaddr, int64_t size, bool clobber)
 {
-    int npages = divCeil(size, (int64_t)PageBytes);
+    int npages = divCeil(size, (int64_t)system->getPageBytes());
     Addr paddr = system->allocPhysPages(npages);
     pTable->map(vaddr, paddr, size,
                 clobber ? EmulationPageTable::Clobber :
@@ -333,14 +333,14 @@ Process::replicatePage(Addr vaddr, Addr new_paddr, ThreadContext *old_tc,
         new_paddr = system->allocPhysPages(1);
 
     // Read from old physical page.
-    uint8_t *buf_p = new uint8_t[PageBytes];
-    old_tc->getVirtProxy().readBlob(vaddr, buf_p, PageBytes);
+    uint8_t *buf_p = new uint8_t[system->getPageBytes()];
+    old_tc->getVirtProxy().readBlob(vaddr, buf_p, system->getPageBytes());
 
     // Create new mapping in process address space by clobbering existing
     // mapping (if any existed) and then write to the new physical page.
     bool clobber = true;
-    pTable->map(vaddr, new_paddr, PageBytes, clobber);
-    new_tc->getVirtProxy().writeBlob(vaddr, buf_p, PageBytes);
+    pTable->map(vaddr, new_paddr, system->getPageBytes(), clobber);
+    new_tc->getVirtProxy().writeBlob(vaddr, buf_p, system->getPageBytes());
     delete[] buf_p;
 }
 
@@ -442,7 +442,7 @@ Process::updateBias()
 
     // Determine how large the interpreters footprint will be in the process
     // address space.
-    Addr interp_mapsize = roundUp(interp->mapSize(), TheISA::PageBytes);
+    Addr interp_mapsize = roundUp(interp->mapSize(), system->getPageBytes());
 
     // We are allocating the memory area; set the bias to the lowest address
     // in the allocated memory region.
index 9fd08e893a560e57ba008da0d2effeedfbeffeda..a0b7d2bc1125075122455c3624d558c37ecd3c50 100644 (file)
@@ -241,7 +241,7 @@ exitGroupFunc(SyscallDesc *desc, ThreadContext *tc, int status)
 SyscallReturn
 getpagesizeFunc(SyscallDesc *desc, ThreadContext *tc)
 {
-    return (int)PageBytes;
+    return (int)tc->getSystemPtr()->getPageBytes();
 }