summaryrefslogtreecommitdiff
path: root/src/arch/arm/isa/formats
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2014-09-27 09:08:37 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2014-09-27 09:08:37 -0400
commitec41000dadd5256fd90f0bfdc97264946e50a3aa (patch)
treeb045e00e601839d4f49cb85321b544b71341abce /src/arch/arm/isa/formats
parent341dbf266258dcbdb1e5e9f09c244b8ac271faaf (diff)
downloadgem5-ec41000dadd5256fd90f0bfdc97264946e50a3aa.tar.xz
arm: Fixed undefined behaviours identified by gcc
This patch fixes the runtime errors highlighted by the undefined behaviour sanitizer. In the end there were two issues. First, when rotating an immediate, we ended up shifting an uint32_t by 32 in some cases. This case is fixed by checking for a rotation by 0 positions. Second, the Mrc15 and Mcr15 are operating on an IntReg and a MiscReg, but we used the type RegRegImmOp and passed a MiscRegIndex as an IntRegIndex. This issue is resolved by introducing a MiscRegRegImmOp and RegMiscRegImmOp with the appropriate types. With these fixes there are no runtime errors identified for the full ARM regressions.
Diffstat (limited to 'src/arch/arm/isa/formats')
-rw-r--r--src/arch/arm/isa/formats/misc.isa4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/arch/arm/isa/formats/misc.isa b/src/arch/arm/isa/formats/misc.isa
index 0ba114e86..7d3865104 100644
--- a/src/arch/arm/isa/formats/misc.isa
+++ b/src/arch/arm/isa/formats/misc.isa
@@ -214,8 +214,8 @@ let {{
if (miscRegInfo[miscReg][MISCREG_IMPLEMENTED]) {
if (isRead)
- return new Mrc15(machInst, rt, (IntRegIndex)miscReg, iss);
- return new Mcr15(machInst, (IntRegIndex)miscReg, rt, iss);
+ return new Mrc15(machInst, rt, miscReg, iss);
+ return new Mcr15(machInst, miscReg, rt, iss);
} else {
return new FailUnimplemented(isRead ? "mrc" : "mcr", machInst,
csprintf("%s %s", isRead ? "mrc" : "mcr",