dev-arm: Verify number of CPUs when restoring Generic Timer Cpts.
authorRichard Cooper <richard.cooper@arm.com>
Wed, 17 Jun 2020 14:30:51 +0000 (15:30 +0100)
committerRichard Cooper <richard.cooper@arm.com>
Tue, 7 Jul 2020 18:42:14 +0000 (18:42 +0000)
commit27e65633f117b655528bf56fb092b130dcdfcdbc
tree72a730cac50493d00aa2ea65a9e65012ec8e968f
parentbd14b1bcaa088e9a8385dd10cfbd4cc144db3ef3
dev-arm: Verify number of CPUs when restoring Generic Timer Cpts.

When restoring a checkpoint containing a generic timer, the checkpoint
expects to connect the timer to the same number of CPUs that were
present when the checkpoint was taken. If the number of CPUs in the
new simulation is different, deserialization will fail. In the case
that the number of CPUs expected by the checkpoint is greater than the
number of CPUs present, this will cause a segmentation fault caused by
reading off the end of the list of Thread Contexts.

This commit fixes the problem by checking the number of CPUs present
in the simulation matches the number of CPUs expected by the generic
timer checkpoint. If there is a mismatch, a fatal error is triggered
with an informative message to the user.

Change-Id: Iff9ad68d64e67b3df51682b7e4e272e5f355bcd6
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/30576
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
src/dev/arm/generic_timer.cc