privNonSecureRead(v);
return *this;
}
+ chain hypE2HRead(bool v = true) const {
+ info[MISCREG_HYP_E2H_RD] = v;
+ return *this;
+ }
+ chain hypE2HWrite(bool v = true) const {
+ info[MISCREG_HYP_E2H_WR] = v;
+ return *this;
+ }
+ chain hypE2H(bool v = true) const {
+ hypE2HRead(v);
+ hypE2HWrite(v);
+ return *this;
+ }
chain hypRead(bool v = true) const {
+ hypE2HRead(v);
info[MISCREG_HYP_RD] = v;
return *this;
}
chain hypWrite(bool v = true) const {
+ hypE2HWrite(v);
info[MISCREG_HYP_WR] = v;
return *this;
}
hypWrite(v);
return *this;
}
+ chain monE2HRead(bool v = true) const {
+ info[MISCREG_MON_E2H_RD] = v;
+ return *this;
+ }
+ chain monE2HWrite(bool v = true) const {
+ info[MISCREG_MON_E2H_WR] = v;
+ return *this;
+ }
+ chain monE2H(bool v = true) const {
+ monE2HRead(v);
+ monE2HWrite(v);
+ return *this;
+ }
chain monSecureRead(bool v = true) const {
+ monE2HRead(v);
info[MISCREG_MON_NS0_RD] = v;
return *this;
}
chain monSecureWrite(bool v = true) const {
+ monE2HWrite(v);
info[MISCREG_MON_NS0_WR] = v;
return *this;
}
chain monNonSecureRead(bool v = true) const {
+ monE2HRead(v);
info[MISCREG_MON_NS1_RD] = v;
return *this;
}
chain monNonSecureWrite(bool v = true) const {
+ monE2HWrite(v);
info[MISCREG_MON_NS1_WR] = v;
return *this;
}
// -*- mode:c++ -*-
-// Copyright (c) 2011-2013, 2016-2019 ARM Limited
+// Copyright (c) 2011-2013, 2016-2020 ARM Limited
// All rights reserved
//
// The license below extends only to copyright in the software and shall
msrMrs64EnabledCheckCode = '''
// Check for read/write access right
- if (!can%sAArch64SysReg(flat_idx, Scr64, cpsr, xc->tcBase())) {
+ if (!can%sAArch64SysReg(flat_idx, Hcr64, Scr64, cpsr, xc->tcBase())) {
if (flat_idx == MISCREG_DAIF ||
flat_idx == MISCREG_DC_ZVA_Xt ||
flat_idx == MISCREG_DC_CVAC_Xt ||
mnemonic);
}
- if (!canWriteAArch64SysReg(misc_index,
+ if (!canWriteAArch64SysReg(misc_index, Hcr64,
Scr64, Cpsr, xc->tcBase())) {
return std::make_shared<UndefinedInstruction>(
/*
- * Copyright (c) 2010-2013, 2015-2019 ARM Limited
+ * Copyright (c) 2010-2013, 2015-2020 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
}
bool
-canReadAArch64SysReg(MiscRegIndex reg, SCR scr, CPSR cpsr, ThreadContext *tc)
+canReadAArch64SysReg(MiscRegIndex reg, HCR hcr, SCR scr, CPSR cpsr,
+ ThreadContext *tc)
{
// Check for SP_EL0 access while SPSEL == 0
if ((reg == MISCREG_SP_EL0) && (tc->readMiscReg(MISCREG_SPSEL) == 0))
}
bool secure = ArmSystem::haveSecurity(tc) && !scr.ns;
+ bool el2_host = EL2Enabled(tc) && hcr.e2h;
switch (currEL(cpsr)) {
case EL0:
return secure ? miscRegInfo[reg][MISCREG_PRI_S_RD] :
miscRegInfo[reg][MISCREG_PRI_NS_RD];
case EL2:
- return miscRegInfo[reg][MISCREG_HYP_RD];
+ return el2_host ? miscRegInfo[reg][MISCREG_HYP_E2H_RD] :
+ miscRegInfo[reg][MISCREG_HYP_RD];
case EL3:
- return secure ? miscRegInfo[reg][MISCREG_MON_NS0_RD] :
+ return el2_host ? miscRegInfo[reg][MISCREG_MON_E2H_RD] :
+ secure ? miscRegInfo[reg][MISCREG_MON_NS0_RD] :
miscRegInfo[reg][MISCREG_MON_NS1_RD];
default:
panic("Invalid exception level");
}
bool
-canWriteAArch64SysReg(MiscRegIndex reg, SCR scr, CPSR cpsr, ThreadContext *tc)
+canWriteAArch64SysReg(MiscRegIndex reg, HCR hcr, SCR scr, CPSR cpsr,
+ ThreadContext *tc)
{
// Check for SP_EL0 access while SPSEL == 0
if ((reg == MISCREG_SP_EL0) && (tc->readMiscReg(MISCREG_SPSEL) == 0))
}
bool secure = ArmSystem::haveSecurity(tc) && !scr.ns;
+ bool el2_host = EL2Enabled(tc) && hcr.e2h;
switch (el) {
case EL0:
return secure ? miscRegInfo[reg][MISCREG_PRI_S_WR] :
miscRegInfo[reg][MISCREG_PRI_NS_WR];
case EL2:
- return miscRegInfo[reg][MISCREG_HYP_WR];
+ return el2_host ? miscRegInfo[reg][MISCREG_HYP_E2H_WR] :
+ miscRegInfo[reg][MISCREG_HYP_WR];
case EL3:
- return secure ? miscRegInfo[reg][MISCREG_MON_NS0_WR] :
+ return el2_host ? miscRegInfo[reg][MISCREG_MON_E2H_WR] :
+ secure ? miscRegInfo[reg][MISCREG_MON_NS0_WR] :
miscRegInfo[reg][MISCREG_MON_NS1_WR];
default:
panic("Invalid exception level");
/*
- * Copyright (c) 2010-2019 ARM Limited
+ * Copyright (c) 2010-2020 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
// Hypervisor mode
MISCREG_HYP_RD,
MISCREG_HYP_WR,
+ // Hypervisor mode, HCR_EL2.E2H == 1
+ MISCREG_HYP_E2H_RD,
+ MISCREG_HYP_E2H_WR,
// Monitor mode, SCR.NS == 0
MISCREG_MON_NS0_RD,
MISCREG_MON_NS0_WR,
// Monitor mode, SCR.NS == 1
MISCREG_MON_NS1_RD,
MISCREG_MON_NS1_WR,
+ // Monitor mode, HCR_EL2.E2H == 1
+ MISCREG_MON_E2H_RD,
+ MISCREG_MON_E2H_WR,
NUM_MISCREG_INFOS
};
CPSR cpsr);
// Checks read access permissions to AArch64 system registers
- bool canReadAArch64SysReg(MiscRegIndex reg, SCR scr, CPSR cpsr,
+ bool canReadAArch64SysReg(MiscRegIndex reg, HCR hcr, SCR scr, CPSR cpsr,
ThreadContext *tc);
// Checks write access permissions to AArch64 system registers
- bool canWriteAArch64SysReg(MiscRegIndex reg, SCR scr, CPSR cpsr,
+ bool canWriteAArch64SysReg(MiscRegIndex reg, HCR hcr, SCR scr, CPSR cpsr,
ThreadContext *tc);
// Uses just the scr.ns bit to pre flatten the misc regs. This is useful