From: Gabe Black Date: Sat, 22 Aug 2020 04:58:03 +0000 (-0700) Subject: misc: Clean up usage of arch/isa_traits.hh. X-Git-Tag: v20.1.0.0~211 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1d755b4ba154a240c591032028e90ca91628dbbf;p=gem5.git misc: Clean up usage of arch/isa_traits.hh. 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 Reviewed-by: Daniel Carvalho Maintainer: Gabe Black Tested-by: kokoro --- diff --git a/src/arch/generic/memhelpers.hh b/src/arch/generic/memhelpers.hh index ffdf543c0..d08bea914 100644 --- a/src/arch/generic/memhelpers.hh +++ b/src/arch/generic/memhelpers.hh @@ -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" diff --git a/src/arch/riscv/registers.hh b/src/arch/riscv/registers.hh index 9b899e343..7ce59e32c 100644 --- a/src/arch/riscv/registers.hh +++ b/src/arch/riscv/registers.hh @@ -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" diff --git a/src/cpu/base.hh b/src/cpu/base.hh index 5c0c709cd..3ef551949 100644 --- a/src/cpu/base.hh +++ b/src/cpu/base.hh @@ -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" diff --git a/src/cpu/checker/cpu_impl.hh b/src/cpu/checker/cpu_impl.hh index 0656035c8..c6d2cf86a 100644 --- a/src/cpu/checker/cpu_impl.hh +++ b/src/cpu/checker/cpu_impl.hh @@ -45,7 +45,6 @@ #include #include -#include "arch/isa_traits.hh" #include "base/refcnt.hh" #include "config/the_isa.hh" #include "cpu/base_dyn_inst.hh" diff --git a/src/cpu/exetrace.cc b/src/cpu/exetrace.cc index c9c8b686c..ca0504147 100644 --- a/src/cpu/exetrace.cc +++ b/src/cpu/exetrace.cc @@ -43,7 +43,6 @@ #include #include -#include "arch/isa_traits.hh" #include "arch/utility.hh" #include "base/loader/symtab.hh" #include "config/the_isa.hh" diff --git a/src/cpu/o3/dyn_inst.hh b/src/cpu/o3/dyn_inst.hh index c326058ec..d5f142c0c 100644 --- a/src/cpu/o3/dyn_inst.hh +++ b/src/cpu/o3/dyn_inst.hh @@ -44,7 +44,6 @@ #include -#include "arch/isa_traits.hh" #include "config/the_isa.hh" #include "cpu/o3/cpu.hh" #include "cpu/o3/isa_specific.hh" diff --git a/src/cpu/o3/fetch_impl.hh b/src/cpu/o3/fetch_impl.hh index 7ecab5461..314e0147e 100644 --- a/src/cpu/o3/fetch_impl.hh +++ b/src/cpu/o3/fetch_impl.hh @@ -49,7 +49,6 @@ #include #include "arch/generic/tlb.hh" -#include "arch/isa_traits.hh" #include "arch/utility.hh" #include "base/random.hh" #include "base/types.hh" diff --git a/src/cpu/o3/impl.hh b/src/cpu/o3/impl.hh index b7f43c592..1d7357750 100644 --- a/src/cpu/o3/impl.hh +++ b/src/cpu/o3/impl.hh @@ -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" diff --git a/src/cpu/o3/lsq_unit.hh b/src/cpu/o3/lsq_unit.hh index 16dddfd18..06d43eeae 100644 --- a/src/cpu/o3/lsq_unit.hh +++ b/src/cpu/o3/lsq_unit.hh @@ -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" diff --git a/src/cpu/o3/regfile.hh b/src/cpu/o3/regfile.hh index 5fed9108a..922089c13 100644 --- a/src/cpu/o3/regfile.hh +++ b/src/cpu/o3/regfile.hh @@ -44,7 +44,6 @@ #include -#include "arch/isa_traits.hh" #include "arch/types.hh" #include "base/trace.hh" #include "config/the_isa.hh" diff --git a/src/cpu/o3/rename_impl.hh b/src/cpu/o3/rename_impl.hh index 7447764b6..36b513c8e 100644 --- a/src/cpu/o3/rename_impl.hh +++ b/src/cpu/o3/rename_impl.hh @@ -44,7 +44,6 @@ #include -#include "arch/isa_traits.hh" #include "arch/registers.hh" #include "config/the_isa.hh" #include "cpu/o3/rename.hh" diff --git a/src/cpu/pred/bpred_unit.cc b/src/cpu/pred/bpred_unit.cc index 4b93e30b3..ec9c5f832 100644 --- a/src/cpu/pred/bpred_unit.cc +++ b/src/cpu/pred/bpred_unit.cc @@ -44,7 +44,6 @@ #include -#include "arch/isa_traits.hh" #include "arch/types.hh" #include "arch/utility.hh" #include "base/trace.hh" diff --git a/src/cpu/pred/simple_indirect.hh b/src/cpu/pred/simple_indirect.hh index f91e7844c..e954892a1 100644 --- a/src/cpu/pred/simple_indirect.hh +++ b/src/cpu/pred/simple_indirect.hh @@ -31,7 +31,6 @@ #include -#include "arch/isa_traits.hh" #include "config/the_isa.hh" #include "cpu/inst_seq.hh" #include "cpu/pred/indirect.hh" diff --git a/src/cpu/simple_thread.cc b/src/cpu/simple_thread.cc index 7ed2e8279..14551fbab 100644 --- a/src/cpu/simple_thread.cc +++ b/src/cpu/simple_thread.cc @@ -42,7 +42,6 @@ #include -#include "arch/isa_traits.hh" #include "arch/utility.hh" #include "base/callback.hh" #include "base/compiler.hh" diff --git a/src/cpu/simple_thread.hh b/src/cpu/simple_thread.hh index 612174ccb..8a2f22794 100644 --- a/src/cpu/simple_thread.hh +++ b/src/cpu/simple_thread.hh @@ -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" diff --git a/src/dev/storage/ide_disk.cc b/src/dev/storage/ide_disk.cc index c8d8bf9d4..e97e23b8e 100644 --- a/src/dev/storage/ide_disk.cc +++ b/src/dev/storage/ide_disk.cc @@ -49,7 +49,6 @@ #include #include -#include "arch/isa_traits.hh" #include "base/chunk_generator.hh" #include "base/cprintf.hh" // csprintf #include "base/trace.hh" diff --git a/src/dev/virtio/base.hh b/src/dev/virtio/base.hh index 7c4c3f886..de6cfd12a 100644 --- a/src/dev/virtio/base.hh +++ b/src/dev/virtio/base.hh @@ -40,7 +40,6 @@ #include -#include "arch/isa_traits.hh" #include "base/bitunion.hh" #include "dev/virtio/virtio_ring.h" #include "mem/port_proxy.hh" diff --git a/src/gpu-compute/compute_unit.cc b/src/gpu-compute/compute_unit.cc index 2d64fa3c7..920257d8d 100644 --- a/src/gpu-compute/compute_unit.cc +++ b/src/gpu-compute/compute_unit.cc @@ -35,6 +35,7 @@ #include +#include "arch/x86/isa_traits.hh" #include "base/output.hh" #include "debug/GPUDisp.hh" #include "debug/GPUExec.hh" diff --git a/src/gpu-compute/gpu_tlb.cc b/src/gpu-compute/gpu_tlb.cc index a37618d32..513106f4a 100644 --- a/src/gpu-compute/gpu_tlb.cc +++ b/src/gpu-compute/gpu_tlb.cc @@ -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" diff --git a/src/gpu-compute/shader.cc b/src/gpu-compute/shader.cc index 7b4f20f16..9ebbd3cf4 100644 --- a/src/gpu-compute/shader.cc +++ b/src/gpu-compute/shader.cc @@ -35,6 +35,7 @@ #include +#include "arch/x86/isa_traits.hh" #include "arch/x86/linux/linux.hh" #include "base/chunk_generator.hh" #include "debug/GPUDisp.hh" diff --git a/src/gpu-compute/shader.hh b/src/gpu-compute/shader.hh index 3e2e56950..baf6df46c 100644 --- a/src/gpu-compute/shader.hh +++ b/src/gpu-compute/shader.hh @@ -40,7 +40,6 @@ #include #include "arch/isa.hh" -#include "arch/isa_traits.hh" #include "base/types.hh" #include "cpu/simple/atomic.hh" #include "cpu/simple/timing.hh" diff --git a/src/gpu-compute/tlb_coalescer.cc b/src/gpu-compute/tlb_coalescer.cc index b59123265..08eccd8d8 100644 --- a/src/gpu-compute/tlb_coalescer.cc +++ b/src/gpu-compute/tlb_coalescer.cc @@ -35,6 +35,7 @@ #include +#include "arch/x86/isa_traits.hh" #include "base/logging.hh" #include "debug/GPUTLB.hh" #include "sim/process.hh" diff --git a/src/gpu-compute/tlb_coalescer.hh b/src/gpu-compute/tlb_coalescer.hh index aff25157e..defdc865d 100644 --- a/src/gpu-compute/tlb_coalescer.hh +++ b/src/gpu-compute/tlb_coalescer.hh @@ -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" diff --git a/src/kern/linux/helpers.cc b/src/kern/linux/helpers.cc index 028ad8ab0..9fb248774 100644 --- a/src/kern/linux/helpers.cc +++ b/src/kern/linux/helpers.cc @@ -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" diff --git a/src/mem/cache/prefetch/base.hh b/src/mem/cache/prefetch/base.hh index 7009db76e..783fb011e 100644 --- a/src/mem/cache/prefetch/base.hh +++ b/src/mem/cache/prefetch/base.hh @@ -48,7 +48,6 @@ #include -#include "arch/isa_traits.hh" #include "arch/generic/tlb.hh" #include "base/statistics.hh" #include "base/types.hh" diff --git a/src/sim/faults.cc b/src/sim/faults.cc index 46485d49c..9bbc11930 100644 --- a/src/sim/faults.cc +++ b/src/sim/faults.cc @@ -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" diff --git a/src/sim/process.cc b/src/sim/process.cc index 28c0b542e..9cf52aa23 100644 --- a/src/sim/process.cc +++ b/src/sim/process.cc @@ -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. diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc index 9fd08e893..a0b7d2bc1 100644 --- a/src/sim/syscall_emul.cc +++ b/src/sim/syscall_emul.cc @@ -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(); }