tc->getCpuPtr()->getInterruptController(tc->threadId()));
return ic->readIE();
}
+ case MISCREG_SEPC:
+ case MISCREG_MEPC:
+ {
+ auto misa = readMiscRegNoEffect(MISCREG_ISA);
+ auto val = readMiscRegNoEffect(misc_reg);
+ // if compressed instructions are disabled, epc[1] is set to 0
+ if ((misa & ISA_EXT_C_MASK) == 0)
+ return mbits(val, 63, 2);
+ // epc[0] is always 0
+ else
+ return mbits(val, 63, 1);
+ }
default:
// Try reading HPM counters
// As a placeholder, all HPM counters are just cycle counters
setMiscRegNoEffect(misc_reg, new_val);
}
break;
+ case MISCREG_ISA:
+ {
+ auto cur_val = readMiscRegNoEffect(misc_reg);
+ // only allow to disable compressed instructions
+ // if the following instruction is 4-byte aligned
+ if ((val & ISA_EXT_C_MASK) == 0 &&
+ bits(tc->pcState().npc(), 2, 0) != 0)
+ val |= cur_val & ISA_EXT_C_MASK;
+ setMiscRegNoEffect(misc_reg, val);
+ }
+ break;
case MISCREG_STATUS:
{
// SXL and UXL are hard-wired to 64 bit
* Copyright (c) 2013 ARM Limited
* Copyright (c) 2014-2015 Sven Karlsson
* Copyright (c) 2019 Yifei Liu
+ * Copyright (c) 2020 Barkhausen Institut
* All rights reserved
*
* The license below extends only to copyright in the software and shall
const RegVal ISA_MXL_MASK = 3ULL << MXL_OFFSET;
const RegVal ISA_EXT_MASK = mask(26);
+const RegVal ISA_EXT_C_MASK = 1UL << ('c' - 'a');
const RegVal MISA_MASK = ISA_MXL_MASK | ISA_EXT_MASK;
const RegVal STATUS_SD_MASK = 1ULL << ((sizeof(uint64_t) * 8) - 1);