hw: move handle_interrupt to Execution_context

ref #1078
This commit is contained in:
Martin Stein 2014-02-28 14:46:21 +01:00 committed by Norman Feske
parent 7cea03f695
commit ce9e43ae51
7 changed files with 64 additions and 43 deletions

View File

@ -25,7 +25,6 @@
/* core includes */
#include <kernel/pd.h>
#include <kernel/vm.h>
#include <kernel/irq.h>
#include <platform_pd.h>
#include <trustzone.h>
#include <timer.h>
@ -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();
}
}

View File

@ -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_ */

View File

@ -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 <kernel/scheduler.h>
#include <kernel/multiprocessor.h>
#include <kernel/irq.h>
#include <pic.h>
#include <timer.h>
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();
}

View File

@ -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:
/**

View File

@ -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;

View File

@ -89,7 +89,7 @@ class Kernel::Vm : public Object<Vm, MAX_VMS, Vm_ids, vm_ids, vm_pool>,
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();

View File

@ -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 \