From ec41000dadd5256fd90f0bfdc97264946e50a3aa Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Sat, 27 Sep 2014 09:08:37 -0400 Subject: 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. --- src/arch/arm/isa/formats/misc.isa | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/arch/arm/isa/formats') 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", -- cgit v1.2.3