From aece7fcdf97d2864fbb31e02940bfcdd470db7b9 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Thu, 6 Jun 2019 23:03:07 +0100 Subject: [PATCH] arch-arm: Fix WalkerState,Descriptors default constructor Those POD strutures are not initializing all members at construction. This could lead to undefined behaviour Change-Id: Iaa8afb126382b6bfbef686883a026262f24d5ca1 Signed-off-by: Giacomo Travaglini Reviewed-by: Ciro Santilli Reviewed-by: Javier Setoain Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/19149 Maintainer: Andreas Sandberg Tested-by: kokoro --- src/arch/arm/table_walker.cc | 5 ++++- src/arch/arm/table_walker.hh | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/arch/arm/table_walker.cc b/src/arch/arm/table_walker.cc index 6f06b7112..461194d82 100644 --- a/src/arch/arm/table_walker.cc +++ b/src/arch/arm/table_walker.cc @@ -130,7 +130,10 @@ TableWalker::getPort(const std::string &if_name, PortID idx) TableWalker::WalkerState::WalkerState() : tc(nullptr), aarch64(false), el(EL0), physAddrRange(0), req(nullptr), asid(0), vmid(0), isHyp(false), transState(nullptr), - vaddr(0), vaddr_tainted(0), isWrite(false), isFetch(false), isSecure(false), + vaddr(0), vaddr_tainted(0), + sctlr(0), scr(0), cpsr(0), tcr(0), + htcr(0), hcr(0), vtcr(0), + isWrite(false), isFetch(false), isSecure(false), secureLookup(false), rwTable(false), userTable(false), xnTable(false), pxnTable(false), stage2Req(false), stage2Tran(nullptr), timing(false), functional(false), diff --git a/src/arch/arm/table_walker.hh b/src/arch/arm/table_walker.hh index 752b57a64..dacde641a 100644 --- a/src/arch/arm/table_walker.hh +++ b/src/arch/arm/table_walker.hh @@ -67,6 +67,8 @@ class TableWalker : public ClockedObject class DescriptorBase { public: + DescriptorBase() : lookupLevel(L0) {} + /** Current lookup level for this descriptor */ LookupLevel lookupLevel; @@ -382,6 +384,8 @@ class TableWalker : public ClockedObject Page }; + LongDescriptor() : data(0), _dirty(false) {} + /** The raw bits of the entry */ uint64_t data; -- 2.30.2