From da7e63d088cd1710ee4f55f7c5481df4fa95e531 Mon Sep 17 00:00:00 2001 From: Brandon Potter Date: Tue, 28 Aug 2018 14:49:51 -0400 Subject: [PATCH] sim-se: const for loader's loadSection param The port proxy can be declared as a reference to a const proxy rather than just a reference to a proxy. Change-Id: I4640b0c5f33e2334c1e7630131f78607ced40a34 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/12301 Maintainer: Brandon Potter Tested-by: kokoro Reviewed-by: Jason Lowe-Power Reviewed-by: Andreas Sandberg --- src/base/loader/elf_object.cc | 3 ++- src/base/loader/elf_object.hh | 2 +- src/base/loader/object_file.cc | 7 ++++--- src/base/loader/object_file.hh | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/base/loader/elf_object.cc b/src/base/loader/elf_object.cc index 761fd79f5..654cb33d5 100644 --- a/src/base/loader/elf_object.cc +++ b/src/base/loader/elf_object.cc @@ -498,7 +498,8 @@ ElfObject::loadWeakSymbols(SymbolTable *symtab, Addr base, Addr offset, } bool -ElfObject::loadSections(PortProxy& mem_proxy, Addr addr_mask, Addr offset) +ElfObject::loadSections(const PortProxy& mem_proxy, Addr addr_mask, + Addr offset) { if (!ObjectFile::loadSections(mem_proxy, addr_mask, offset)) return false; diff --git a/src/base/loader/elf_object.hh b/src/base/loader/elf_object.hh index d74ee8914..9585684d4 100644 --- a/src/base/loader/elf_object.hh +++ b/src/base/loader/elf_object.hh @@ -94,7 +94,7 @@ class ElfObject : public ObjectFile public: virtual ~ElfObject() {} - bool loadSections(PortProxy& mem_proxy, Addr addr_mask = maxAddr, + bool loadSections(const PortProxy& mem_proxy, Addr addr_mask = maxAddr, Addr offset = 0) override; virtual bool loadAllSymbols(SymbolTable *symtab, Addr base = 0, diff --git a/src/base/loader/object_file.cc b/src/base/loader/object_file.cc index 86278e44f..ede8922e9 100644 --- a/src/base/loader/object_file.cc +++ b/src/base/loader/object_file.cc @@ -73,8 +73,8 @@ ObjectFile::~ObjectFile() bool -ObjectFile::loadSection(Section *sec, PortProxy& mem_proxy, Addr addr_mask, - Addr offset) +ObjectFile::loadSection(Section *sec, const PortProxy& mem_proxy, + Addr addr_mask, Addr offset) { if (sec->size != 0) { Addr addr = (sec->baseAddr & addr_mask) + offset; @@ -91,7 +91,8 @@ ObjectFile::loadSection(Section *sec, PortProxy& mem_proxy, Addr addr_mask, bool -ObjectFile::loadSections(PortProxy& mem_proxy, Addr addr_mask, Addr offset) +ObjectFile::loadSections(const PortProxy& mem_proxy, Addr addr_mask, + Addr offset) { return (loadSection(&text, mem_proxy, addr_mask, offset) && loadSection(&data, mem_proxy, addr_mask, offset) diff --git a/src/base/loader/object_file.hh b/src/base/loader/object_file.hh index 5da7e3cc4..bd9d6260a 100644 --- a/src/base/loader/object_file.hh +++ b/src/base/loader/object_file.hh @@ -88,7 +88,7 @@ class ObjectFile static const Addr maxAddr = std::numeric_limits::max(); - virtual bool loadSections(PortProxy& mem_proxy, + virtual bool loadSections(const PortProxy& mem_proxy, Addr mask = maxAddr, Addr offset = 0); virtual bool loadAllSymbols(SymbolTable *symtab, Addr base = 0, @@ -129,7 +129,7 @@ class ObjectFile Section data; Section bss; - bool loadSection(Section *sec, PortProxy& mem_proxy, Addr mask, + bool loadSection(Section *sec, const PortProxy& mem_proxy, Addr mask, Addr offset = 0); void setGlobalPointer(Addr global_ptr) { globalPtr = global_ptr; } -- 2.30.2