diff --git a/base-hw/src/core/kernel/kernel.cc b/base-hw/src/core/kernel/kernel.cc index c738c858bd..1e6bdcac7f 100644 --- a/base-hw/src/core/kernel/kernel.cc +++ b/base-hw/src/core/kernel/kernel.cc @@ -25,7 +25,6 @@ /* core includes */ #include #include -#include #include #include #include @@ -155,36 +154,6 @@ namespace Kernel addr_t core_tlb_base; unsigned core_pd_id; - - /** - * Handle interrupt request - * - * \param processor kernel object of targeted processor - * \param processor_id kernel name of targeted processor - */ - void handle_interrupt(Processor * const processor, - unsigned const processor_id) - { - /* determine handling for specific interrupt */ - unsigned irq_id; - if (pic()->take_request(irq_id)) - { - /* check wether the interrupt is a scheduling timeout */ - if (timer()->interrupt_id(processor_id) == irq_id) - { - /* handle scheduling timeout */ - processor->scheduler()->yield(); - timer()->clear_interrupt(processor_id); - reset_lap_time(processor_id); - } else { - - /* try to inform the user interrupt-handler */ - Irq::occurred(irq_id); - } - } - /* end interrupt request at controller */ - pic()->finish_request(); - } } diff --git a/base-hw/src/core/kernel/kernel.h b/base-hw/src/core/kernel/kernel.h index c66257c96a..9ce45e57f3 100644 --- a/base-hw/src/core/kernel/kernel.h +++ b/base-hw/src/core/kernel/kernel.h @@ -14,14 +14,6 @@ #ifndef _KERNEL__KERNEL_H_ #define _KERNEL__KERNEL_H_ -namespace Kernel -{ - class Processor; - - unsigned core_id(); - - void handle_interrupt(Processor * const processor, - unsigned const processor_id); -} +namespace Kernel { unsigned core_id(); } #endif /* _KERNEL__KERNEL_H_ */ diff --git a/base-hw/src/core/kernel/scheduler.cc b/base-hw/src/core/kernel/scheduler.cc new file mode 100644 index 0000000000..beff96021c --- /dev/null +++ b/base-hw/src/core/kernel/scheduler.cc @@ -0,0 +1,52 @@ +/* + * \brief Round-robin scheduler + * \author Martin Stein + * \date 2014-02-28 + */ + +/* + * Copyright (C) 2012-2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +/* core includes */ +#include +#include +#include +#include +#include + +using namespace Kernel; + +namespace Kernel +{ + Pic * pic(); + Timer * timer(); + void reset_lap_time(unsigned const); +} + + +void Kernel::Execution_context::_interrupt(unsigned const processor_id) +{ + /* determine handling for specific interrupt */ + unsigned irq_id; + if (pic()->take_request(irq_id)) + { + /* check wether the interrupt is a scheduling timeout */ + if (timer()->interrupt_id(processor_id) == irq_id) + { + /* handle scheduling timeout */ + _processor->scheduler()->yield(); + timer()->clear_interrupt(processor_id); + reset_lap_time(processor_id); + } else { + + /* try to inform the user interrupt-handler */ + Irq::occurred(irq_id); + } + } + /* end interrupt request at controller */ + pic()->finish_request(); +} diff --git a/base-hw/src/core/kernel/scheduler.h b/base-hw/src/core/kernel/scheduler.h index a09253cd4f..fe05fd9292 100644 --- a/base-hw/src/core/kernel/scheduler.h +++ b/base-hw/src/core/kernel/scheduler.h @@ -301,6 +301,13 @@ class Kernel::Execution_context : public Cpu_scheduler::Item Processor * _processor; + /** + * Handle an interrupt exception that occured during execution + * + * \param processor_id kernel name of targeted processor + */ + void _interrupt(unsigned const processor_id); + public: /** diff --git a/base-hw/src/core/kernel/thread.cc b/base-hw/src/core/kernel/thread.cc index 338539b50c..cf7920c46e 100644 --- a/base-hw/src/core/kernel/thread.cc +++ b/base-hw/src/core/kernel/thread.cc @@ -236,10 +236,10 @@ void Thread::handle_exception(unsigned const processor_id) _mmu_exception(); return; case INTERRUPT_REQUEST: - handle_interrupt(_processor, processor_id); + _interrupt(processor_id); return; case FAST_INTERRUPT_REQUEST: - handle_interrupt(_processor, processor_id); + _interrupt(processor_id); return; case RESET: return; diff --git a/base-hw/src/core/kernel/vm.h b/base-hw/src/core/kernel/vm.h index ac33eb1cf6..fcf5c39e07 100644 --- a/base-hw/src/core/kernel/vm.h +++ b/base-hw/src/core/kernel/vm.h @@ -89,7 +89,7 @@ class Kernel::Vm : public Object, switch(_state->cpu_exception) { case Genode::Cpu_state::INTERRUPT_REQUEST: case Genode::Cpu_state::FAST_INTERRUPT_REQUEST: - handle_interrupt(_processor, processor_id); + _interrupt(processor_id); return; case Genode::Cpu_state::DATA_ABORT: _state->dfar = Genode::Cpu::Dfar::read(); diff --git a/base-hw/src/core/target.inc b/base-hw/src/core/target.inc index 49d66c08dc..a1120827b9 100644 --- a/base-hw/src/core/target.inc +++ b/base-hw/src/core/target.inc @@ -52,6 +52,7 @@ SRC_CC += console.cc \ kernel/vm.cc \ kernel/signal_receiver.cc \ kernel/irq.cc \ + kernel/scheduler.cc \ kernel/multiprocessor.cc \ rm_session_support.cc \ trustzone.cc \