parent
7cea03f695
commit
ce9e43ae51
|
@ -25,7 +25,6 @@
|
||||||
/* core includes */
|
/* core includes */
|
||||||
#include <kernel/pd.h>
|
#include <kernel/pd.h>
|
||||||
#include <kernel/vm.h>
|
#include <kernel/vm.h>
|
||||||
#include <kernel/irq.h>
|
|
||||||
#include <platform_pd.h>
|
#include <platform_pd.h>
|
||||||
#include <trustzone.h>
|
#include <trustzone.h>
|
||||||
#include <timer.h>
|
#include <timer.h>
|
||||||
|
@ -155,36 +154,6 @@ namespace Kernel
|
||||||
|
|
||||||
addr_t core_tlb_base;
|
addr_t core_tlb_base;
|
||||||
unsigned core_pd_id;
|
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,14 +14,6 @@
|
||||||
#ifndef _KERNEL__KERNEL_H_
|
#ifndef _KERNEL__KERNEL_H_
|
||||||
#define _KERNEL__KERNEL_H_
|
#define _KERNEL__KERNEL_H_
|
||||||
|
|
||||||
namespace Kernel
|
namespace Kernel { unsigned core_id(); }
|
||||||
{
|
|
||||||
class Processor;
|
|
||||||
|
|
||||||
unsigned core_id();
|
|
||||||
|
|
||||||
void handle_interrupt(Processor * const processor,
|
|
||||||
unsigned const processor_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _KERNEL__KERNEL_H_ */
|
#endif /* _KERNEL__KERNEL_H_ */
|
||||||
|
|
52
base-hw/src/core/kernel/scheduler.cc
Normal file
52
base-hw/src/core/kernel/scheduler.cc
Normal 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();
|
||||||
|
}
|
|
@ -301,6 +301,13 @@ class Kernel::Execution_context : public Cpu_scheduler::Item
|
||||||
|
|
||||||
Processor * _processor;
|
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:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -236,10 +236,10 @@ void Thread::handle_exception(unsigned const processor_id)
|
||||||
_mmu_exception();
|
_mmu_exception();
|
||||||
return;
|
return;
|
||||||
case INTERRUPT_REQUEST:
|
case INTERRUPT_REQUEST:
|
||||||
handle_interrupt(_processor, processor_id);
|
_interrupt(processor_id);
|
||||||
return;
|
return;
|
||||||
case FAST_INTERRUPT_REQUEST:
|
case FAST_INTERRUPT_REQUEST:
|
||||||
handle_interrupt(_processor, processor_id);
|
_interrupt(processor_id);
|
||||||
return;
|
return;
|
||||||
case RESET:
|
case RESET:
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -89,7 +89,7 @@ class Kernel::Vm : public Object<Vm, MAX_VMS, Vm_ids, vm_ids, vm_pool>,
|
||||||
switch(_state->cpu_exception) {
|
switch(_state->cpu_exception) {
|
||||||
case Genode::Cpu_state::INTERRUPT_REQUEST:
|
case Genode::Cpu_state::INTERRUPT_REQUEST:
|
||||||
case Genode::Cpu_state::FAST_INTERRUPT_REQUEST:
|
case Genode::Cpu_state::FAST_INTERRUPT_REQUEST:
|
||||||
handle_interrupt(_processor, processor_id);
|
_interrupt(processor_id);
|
||||||
return;
|
return;
|
||||||
case Genode::Cpu_state::DATA_ABORT:
|
case Genode::Cpu_state::DATA_ABORT:
|
||||||
_state->dfar = Genode::Cpu::Dfar::read();
|
_state->dfar = Genode::Cpu::Dfar::read();
|
||||||
|
|
|
@ -52,6 +52,7 @@ SRC_CC += console.cc \
|
||||||
kernel/vm.cc \
|
kernel/vm.cc \
|
||||||
kernel/signal_receiver.cc \
|
kernel/signal_receiver.cc \
|
||||||
kernel/irq.cc \
|
kernel/irq.cc \
|
||||||
|
kernel/scheduler.cc \
|
||||||
kernel/multiprocessor.cc \
|
kernel/multiprocessor.cc \
|
||||||
rm_session_support.cc \
|
rm_session_support.cc \
|
||||||
trustzone.cc \
|
trustzone.cc \
|
||||||
|
|
Loading…
Reference in New Issue
Block a user