arch-arm: Fix FEAT_VMID16 for Self Hosted debug
The existing code was querying the vmidbits but it was not checking the VTCR_EL2.VS bit, which dynamically enables/disables VMID16 Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Change-Id: Id1e7df758a636267173c4fcd4db99e5834f21ee9 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45659 Reviewed-by: Richard Cooper <richard.cooper@arm.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Arm Limited
|
||||
* Copyright (c) 2019 Metempsy Technology LSC
|
||||
* All rights reserved
|
||||
*
|
||||
@@ -452,15 +453,18 @@ BrkPoint::testContextMatch(ThreadContext *tc, bool ctx1, bool low_ctx)
|
||||
bool
|
||||
BrkPoint::testVMIDMatch(ThreadContext *tc)
|
||||
{
|
||||
const bool vs = ((VTCR_t)(tc->readMiscReg(MISCREG_VTCR_EL2))).vs;
|
||||
|
||||
uint32_t vmid_index = 55;
|
||||
if (VMID16enabled)
|
||||
if (VMID16enabled && vs)
|
||||
vmid_index = 63;
|
||||
ExceptionLevel el = currEL(tc);
|
||||
if (el == EL2)
|
||||
return false;
|
||||
|
||||
uint32_t vmid = bits(tc->readMiscReg(MISCREG_VTTBR_EL2), vmid_index, 48);
|
||||
uint32_t v = getVMIDfromReg(tc);
|
||||
vmid_t vmid = bits(tc->readMiscReg(MISCREG_VTTBR_EL2), vmid_index, 48);
|
||||
vmid_t v = getVMIDfromReg(tc, vs);
|
||||
|
||||
return (v == vmid);
|
||||
}
|
||||
|
||||
@@ -520,11 +524,11 @@ BrkPoint::isEnabled(ThreadContext *tc, ExceptionLevel el,
|
||||
return v && SelfDebug::securityStateMatch(tc, ssc, hmc || !aarch32);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
BrkPoint::getVMIDfromReg(ThreadContext *tc)
|
||||
vmid_t
|
||||
BrkPoint::getVMIDfromReg(ThreadContext *tc, bool vs)
|
||||
{
|
||||
uint32_t vmid_index = 39;
|
||||
if (VMID16enabled)
|
||||
if (VMID16enabled && vs)
|
||||
vmid_index = 47;
|
||||
return bits(tc->readMiscReg(valRegIndex), vmid_index, 32);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Arm Limited
|
||||
* Copyright (c) 2019 Metempsy Technology LSC
|
||||
* All rights reserved
|
||||
*
|
||||
@@ -103,7 +104,7 @@ class BrkPoint
|
||||
}
|
||||
|
||||
|
||||
inline uint32_t getVMIDfromReg(ThreadContext *tc);
|
||||
vmid_t getVMIDfromReg(ThreadContext *tc, bool vs);
|
||||
|
||||
public:
|
||||
bool testAddrMatch(ThreadContext *tc, Addr pc, uint8_t bas);
|
||||
|
||||
Reference in New Issue
Block a user