From 7d0c6eae6282b6c991060ae890a09238065f509d Mon Sep 17 00:00:00 2001 From: Nils Asmussen Date: Sat, 21 Mar 2020 10:59:36 +0100 Subject: [PATCH] arch-riscv: implement RemoteGDB::acc for FS mode. Change-Id: I78b37db43fbb16d4dafa74294117e8beba62f903 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26985 Tested-by: kokoro Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power --- src/arch/riscv/remote_gdb.cc | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/arch/riscv/remote_gdb.cc b/src/arch/riscv/remote_gdb.cc index 16b458511..7da666d2e 100644 --- a/src/arch/riscv/remote_gdb.cc +++ b/src/arch/riscv/remote_gdb.cc @@ -2,6 +2,7 @@ * Copyright 2015 LabWare * Copyright 2014 Google, Inc. * Copyright (c) 2010 ARM Limited + * Copyright (c) 2020 Barkhausen Institut * All rights reserved * * The license below extends only to copyright in the software and shall @@ -133,7 +134,9 @@ #include +#include "arch/riscv/pagetable_walker.hh" #include "arch/riscv/registers.hh" +#include "arch/riscv/tlb.hh" #include "cpu/thread_state.hh" #include "debug/GDBAcc.hh" #include "mem/page_table.hh" @@ -150,7 +153,25 @@ RemoteGDB::RemoteGDB(System *_system, ThreadContext *tc, int _port) bool RemoteGDB::acc(Addr va, size_t len) { - panic_if(FullSystem, "acc not implemented for RISCV FS!"); + if (FullSystem) + { + TLB *tlb = dynamic_cast(context()->getDTBPtr()); + unsigned logBytes; + Addr paddr = va; + + PrivilegeMode pmode = tlb->getMemPriv(context(), BaseTLB::Read); + SATP satp = context()->readMiscReg(MISCREG_SATP); + if (pmode != PrivilegeMode::PRV_M && + satp.mode != AddrXlateMode::BARE) { + Walker *walker = tlb->getWalker(); + Fault fault = walker->startFunctional( + context(), paddr, logBytes, BaseTLB::Read); + if (fault != NoFault) + return false; + } + return true; + } + return context()->getProcessPtr()->pTable->lookup(va) != nullptr; } -- 2.30.2