diff options
-rwxr-xr-x | src/build/debug/simics-debug-framework.py | 4 | ||||
-rw-r--r-- | src/include/arch/ppc.H | 1 | ||||
-rw-r--r-- | src/include/kernel/timemgr.H | 46 | ||||
-rw-r--r-- | src/kernel/timemgr.C | 19 |
4 files changed, 47 insertions, 23 deletions
diff --git a/src/build/debug/simics-debug-framework.py b/src/build/debug/simics-debug-framework.py index bda3bb6c0..80268e0d2 100755 --- a/src/build/debug/simics-debug-framework.py +++ b/src/build/debug/simics-debug-framework.py @@ -498,6 +498,10 @@ def magic_instruction_callback(user_arg, cpu, arg): if arg == 7009: # MAGIC_MEMORYLEAK_FUNCTION magic_memoryleak_function(cpu) + if arg == 7011: #MAGIC_SIMICS_CHECK + cpu.r3 = 1 + print "TimeManager::cv_isSimicsRunning = true" + if arg == 7055: # MAGIC_CONTINUOUS_TRACE hb_tracBinaryBuffer = cpu.r4 hb_tracBinaryBufferSz = cpu.r5 diff --git a/src/include/arch/ppc.H b/src/include/arch/ppc.H index 46c78d754..cb21f5b24 100644 --- a/src/include/arch/ppc.H +++ b/src/include/arch/ppc.H @@ -395,6 +395,7 @@ enum MAGIC_RANDOM = 7008, // generate random number MAGIC_MEMORYLEAK_FUNCTION = 7009, // A memory was function called. MAGIC_FAKEPAYLOAD_ENTER = 7010, // Entered the fake payload. + MAGIC_SIMICS_CHECK = 7011, // Check if system is running on simics MAGIC_CONTINUOUS_TRACE = 7055, // extract mixed trace buffer }; diff --git a/src/include/kernel/timemgr.H b/src/include/kernel/timemgr.H index 3f6d658d7..dd02e15e5 100644 --- a/src/include/kernel/timemgr.H +++ b/src/include/kernel/timemgr.H @@ -1,26 +1,25 @@ -/* IBM_PROLOG_BEGIN_TAG - * This is an automatically generated prolog. - * - * $Source: src/include/kernel/timemgr.H $ - * - * IBM CONFIDENTIAL - * - * COPYRIGHT International Business Machines Corp. 2010-2012 - * - * p1 - * - * Object Code Only (OCO) source materials - * Licensed Internal Code Source Materials - * IBM HostBoot Licensed Internal Code - * - * The source code for this program is not published or other- - * wise divested of its trade secrets, irrespective of what has - * been deposited with the U.S. Copyright Office. - * - * Origin: 30 - * - * IBM_PROLOG_END_TAG - */ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/kernel/timemgr.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2010,2013 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #ifndef __KERNEL_TIMEMGR_H #define __KERNEL_TIMEMGR_H @@ -146,6 +145,7 @@ class TimeManager /** Frequency of the timebase register in Hz. (ticks per second) */ static uint64_t iv_timebaseFreq; + static bool cv_isSimicsRunning; }; #endif diff --git a/src/kernel/timemgr.C b/src/kernel/timemgr.C index fd4c55853..03f9aee79 100644 --- a/src/kernel/timemgr.C +++ b/src/kernel/timemgr.C @@ -28,6 +28,17 @@ uint64_t TimeManager::iv_timebaseFreq = 0xFFFFFFFF; +bool isSimicsRunning() __attribute__((alias("__isSimicsRunning"))); +extern "C" void __isSimicsRunning() NEVER_INLINE; + +void __isSimicsRunning() +{ + asm volatile("li 3, 0"); + MAGIC_INSTRUCTION(MAGIC_SIMICS_CHECK); +} + +bool TimeManager::cv_isSimicsRunning = isSimicsRunning(); + void TimeManager::init() { Singleton<TimeManager>::instance()._init(); @@ -114,6 +125,13 @@ uint64_t TimeManager::getIdleTimeSliceCount() { uint64_t sliceCount = getTimeSliceCount(); + // In Simics we want to idle longer to improve overall performance. Set + // the idle baseline at 10x normal idle frequency. + if (cv_isSimicsRunning) + { + sliceCount *= 10; + } + // Get a delayed task, if there is one _TimeManager_Delay_t* node = _get_delaylist()->front(); @@ -133,6 +151,7 @@ uint64_t TimeManager::getIdleTimeSliceCount() sliceCount = 1; } } + return sliceCount; } |