summaryrefslogtreecommitdiff
path: root/src/dev/arm
diff options
context:
space:
mode:
authorTiago Muck <tiago.muck@arm.com>2019-05-16 16:25:17 -0500
committerTiago Mück <tiago.muck@arm.com>2019-10-18 22:44:26 +0000
commit1c047f8b92f5708bbef50d24cf47902d5da313e3 (patch)
treeebf7d6e9cd44081eba92f8d251ccd6a5f15c6984 /src/dev/arm
parent36e59917a72b5d654b115bf995cbba659b069874 (diff)
downloadgem5-1c047f8b92f5708bbef50d24cf47902d5da313e3.tar.xz
dev-arm: Check for gem5 extensions in GicV2
Using GicV2 without setting the gem5_extensions parameter in a config with more than 8 is not allowed to prevent overflow of the 8-bit mask. Change-Id: I780c6985e8f44ed780b4f74f9a27805124e23a7b Signed-off-by: Tiago Mück <tiago.muck@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/19288 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/dev/arm')
-rw-r--r--src/dev/arm/gic_v2.hh9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/dev/arm/gic_v2.hh b/src/dev/arm/gic_v2.hh
index f9b66b827..410414075 100644
--- a/src/dev/arm/gic_v2.hh
+++ b/src/dev/arm/gic_v2.hh
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, 2015-2018 ARM Limited
+ * Copyright (c) 2010, 2013, 2015-2019 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -309,8 +309,11 @@ class GicV2 : public BaseGic, public BaseGicRegisters
if (gem5ExtensionsEnabled) {
ctx_mask = ctx;
} else {
- // convert the CPU id number into a bit mask
- ctx_mask = power(2, ctx);
+ fatal_if(ctx >= 8,
+ "%s requires the gem5_extensions parameter to support "
+ "more than 8 cores\n", name());
+ // convert the CPU id number into a bit mask
+ ctx_mask = 1 << ctx;
}
return ctx_mask;
} else {