From df973abef3a70074971375cfe52c46f53528c00e Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Thu, 16 Oct 2014 05:49:43 -0400 Subject: mem: Dynamically determine page bytes in memory components This patch takes a step towards an ISA-agnostic memory system by enabling the components to establish the page size after instantiation. The swap operation in the memory is now also allowing any granularity to avoid depending on the IntReg of the ISA. --- src/sim/system.cc | 2 -- src/sim/system.hh | 14 +++++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'src/sim') diff --git a/src/sim/system.cc b/src/sim/system.cc index c0b9486f4..61c6decf7 100644 --- a/src/sim/system.cc +++ b/src/sim/system.cc @@ -45,14 +45,12 @@ * Rick Strong */ -#include "arch/isa_traits.hh" #include "arch/remote_gdb.hh" #include "arch/utility.hh" #include "base/loader/object_file.hh" #include "base/loader/symtab.hh" #include "base/str.hh" #include "base/trace.hh" -#include "config/the_isa.hh" #include "cpu/thread_context.hh" #include "debug/Loader.hh" #include "debug/WorkItems.hh" diff --git a/src/sim/system.hh b/src/sim/system.hh index 5b68373a6..d82978018 100644 --- a/src/sim/system.hh +++ b/src/sim/system.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 ARM Limited + * Copyright (c) 2012, 2014 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -51,9 +51,11 @@ #include #include +#include "arch/isa_traits.hh" #include "base/loader/symtab.hh" #include "base/misc.hh" #include "base/statistics.hh" +#include "config/the_isa.hh" #include "cpu/pc_event.hh" #include "enums/MemoryMode.hh" #include "kern/system_events.hh" @@ -269,6 +271,16 @@ class System : public MemObject */ bool isMemAddr(Addr addr) const; + /** + * Get the page bytes for the ISA. + */ + Addr getPageBytes() const { return TheISA::PageBytes; } + + /** + * Get the number of bits worth of in-page adress for the ISA. + */ + Addr getPageShift() const { return TheISA::PageShift; } + protected: PhysicalMemory physmem; -- cgit v1.2.3