From fc278fffb78512ff3d62a906804d6b285edd00c7 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Thu, 7 Jun 2018 17:17:16 +0100 Subject: arch-arm: BadMode checking if corresponding EL is implemented The old utility function called badMode was only checking if the mode passed as an argument was a recognized mode. It was not checking if the corresponding mode/EL was implemented. That function has been renamed to unknownMode and a new badMode has been introduced. This is used by the cpsrWriteByInstruction function. In this way any try to change the execution mode won't succeed if the mode hasn't been implemented. Change-Id: Ibfe385c5465b904acc0d2eb9647710891d72c9df Signed-off-by: Giacomo Travaglini Reviewed-by: Andreas Sandberg Reviewed-on: https://gem5-review.googlesource.com/11196 Maintainer: Andreas Sandberg --- src/arch/arm/isa/formats/uncond.isa | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/arch/arm/isa/formats/uncond.isa') diff --git a/src/arch/arm/isa/formats/uncond.isa b/src/arch/arm/isa/formats/uncond.isa index c376cd9ce..e0b07ab5a 100644 --- a/src/arch/arm/isa/formats/uncond.isa +++ b/src/arch/arm/isa/formats/uncond.isa @@ -166,7 +166,12 @@ def format ArmUnconditional() {{ const uint32_t val = ((machInst >> 20) & 0x5); if (val == 0x4) { const uint32_t mode = bits(machInst, 4, 0); - if (badMode32((OperatingMode)mode)) + // We check at decode stage if the mode exists even + // if the checking is re-done by Srs::execute. + // This is done because we will otherwise panic if + // trying to read the banked stack pointer of an + // unrecognized mode. + if (unknownMode32((OperatingMode)mode)) return new Unknown(machInst); switch (bits(machInst, 24, 21)) { case 0x2: -- cgit v1.2.3