diff options
-rw-r--r-- | src/include/arch/ppc.H | 7 | ||||
-rw-r--r-- | src/kernel/cpumgr.C | 8 | ||||
-rw-r--r-- | src/kernel/scheduler.C | 6 |
3 files changed, 11 insertions, 10 deletions
diff --git a/src/include/arch/ppc.H b/src/include/arch/ppc.H index d5ad34d9f..a87f339f2 100644 --- a/src/include/arch/ppc.H +++ b/src/include/arch/ppc.H @@ -106,6 +106,13 @@ inline uint64_t getTB() } ALWAYS_INLINE +inline void setDEC(uint64_t _dec) +{ + register uint64_t dec = _dec; + asm volatile("mtdec %0" :: "r" (dec)); +} + +ALWAYS_INLINE inline void sync() { asm volatile("sync"); diff --git a/src/kernel/cpumgr.C b/src/kernel/cpumgr.C index 7a4e1c2bd..46d1baa93 100644 --- a/src/kernel/cpumgr.C +++ b/src/kernel/cpumgr.C @@ -68,9 +68,7 @@ void CpuManager::startCPU(ssize_t i) if (currentCPU) { setSPRG3((uint64_t) cv_cpus[i]->idle_task); - - register uint64_t decrementer = TimeManager::getTimeSliceCount(); - asm volatile("mtdec %0" :: "r"(decrementer)); + setDEC(TimeManager::getTimeSliceCount()); } return; } @@ -78,9 +76,7 @@ void CpuManager::startCPU(ssize_t i) void CpuManager::startSlaveCPU(cpu_t* cpu) { setSPRG3((uint64_t) cpu->idle_task); - - register uint64_t decrementer = TimeManager::getTimeSliceCount(); - asm volatile("mtdec %0" :: "r"(decrementer)); + setDEC(TimeManager::getTimeSliceCount()); return; } diff --git a/src/kernel/scheduler.C b/src/kernel/scheduler.C index 48902de7c..cb3cb5e95 100644 --- a/src/kernel/scheduler.C +++ b/src/kernel/scheduler.C @@ -27,13 +27,11 @@ void Scheduler::setNextRunnable() { t = CpuManager::getCurrentCPU()->idle_task; // TODO: Set short decrementer. - register uint64_t decrementer = TimeManager::getTimeSliceCount(); - asm volatile("mtdec %0" :: "r"(decrementer)); + setDEC(TimeManager::getTimeSliceCount()); } else // Set normal timeslice to decrementer. { - register uint64_t decrementer = TimeManager::getTimeSliceCount(); - asm volatile("mtdec %0" :: "r"(decrementer)); + setDEC(TimeManager::getTimeSliceCount()); } TaskManager::setCurrentTask(t); |