diff --git a/base-hw/src/core/kernel/kernel.cc b/base-hw/src/core/kernel/kernel.cc index 5dc32cbb17..35bf8d58dc 100644 --- a/base-hw/src/core/kernel/kernel.cc +++ b/base-hw/src/core/kernel/kernel.cc @@ -83,7 +83,7 @@ namespace Kernel /** * Start a new scheduling lap */ - void reset_lap_time(unsigned const processor_id) + void reset_scheduling_time(unsigned const processor_id) { unsigned const tics = timer()->ms_to_tics(USER_LAP_TIME_MS); timer()->start_one_shot(tics, processor_id); @@ -268,7 +268,7 @@ extern "C" void init_kernel_multiprocessor() /* kernel initialization finished */ init_platform(); } - reset_lap_time(processor_id); + reset_scheduling_time(processor_id); } @@ -291,14 +291,17 @@ extern "C" void kernel() * scheduling of the local activities in a way that an update would return * an occupant other than that whose exception caused the kernel entry. */ - scheduler->occupant()->exception(processor_id); + Execution_context * const old_occupant = scheduler->occupant(); + old_occupant->exception(processor_id); /* * The processor local as well as remote exception-handling may have * changed the scheduling of the local activities. Hence we must update the * processor occupant. */ - scheduler->update_occupant()->proceed(processor_id); + Execution_context * const new_occupant = scheduler->update_occupant(); + if (old_occupant != new_occupant) { reset_scheduling_time(processor_id); } + new_occupant->proceed(processor_id); } diff --git a/base-hw/src/core/kernel/scheduler.cc b/base-hw/src/core/kernel/scheduler.cc index 46cd4dfaa9..4ce8aad920 100644 --- a/base-hw/src/core/kernel/scheduler.cc +++ b/base-hw/src/core/kernel/scheduler.cc @@ -23,7 +23,6 @@ namespace Kernel { Pic * pic(); Timer * timer(); - void reset_lap_time(unsigned const); } @@ -39,7 +38,6 @@ void Kernel::Execution_context::_interrupt(unsigned const processor_id) /* handle scheduling timeout */ __processor->scheduler()->yield_occupation(); timer()->clear_interrupt(processor_id); - reset_lap_time(processor_id); } else { /* try to inform the user interrupt-handler */ diff --git a/base-hw/src/core/kernel/thread.cc b/base-hw/src/core/kernel/thread.cc index b1e460e579..28793865d8 100644 --- a/base-hw/src/core/kernel/thread.cc +++ b/base-hw/src/core/kernel/thread.cc @@ -33,8 +33,6 @@ unsigned Thread::pd_id() const { return _pd ? _pd->id() : 0; } bool Thread::_core() const { return pd_id() == core_id(); } -namespace Kernel { void reset_lap_time(unsigned const processor_id); } - void Thread::_signal_context_kill_pending() { assert(_state == SCHEDULED); @@ -251,7 +249,6 @@ void Thread::exception(unsigned const processor_id) default: PERR("unknown exception"); _stop(); - reset_lap_time(processor_id); } } @@ -976,6 +973,5 @@ void Thread::_call(unsigned const processor_id) default: PERR("unknown kernel call"); _stop(); - reset_lap_time(processor_id); } }