summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dev/arm/generic_timer.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/dev/arm/generic_timer.cc b/src/dev/arm/generic_timer.cc
index 1b8d917e9..d33090d74 100644
--- a/src/dev/arm/generic_timer.cc
+++ b/src/dev/arm/generic_timer.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2015 ARM Limited
+ * Copyright (c) 2013, 2015, 2017 ARM Limited
* All rights reserved.
*
* The license below extends only to copyright in the software and shall
@@ -307,6 +307,11 @@ GenericTimer::createTimers(unsigned cpus)
void
GenericTimer::setMiscReg(int reg, unsigned cpu, MiscReg val)
{
+ // This method might have been called from another context if we
+ // are running in multi-core KVM. Migrate to the SimObject's event
+ // queue to prevent surprising race conditions.
+ EventQueue::ScopedMigration migrate(eventQueue());
+
CoreTimers &core(getTimers(cpu));
switch (reg) {
@@ -399,6 +404,11 @@ GenericTimer::setMiscReg(int reg, unsigned cpu, MiscReg val)
MiscReg
GenericTimer::readMiscReg(int reg, unsigned cpu)
{
+ // This method might have been called from another context if we
+ // are running in multi-core KVM. Migrate to the SimObject's event
+ // queue to prevent surprising race conditions.
+ EventQueue::ScopedMigration migrate(eventQueue());
+
CoreTimers &core(getTimers(cpu));
switch (reg) {