2015-02-06 17:29:30 +01:00
|
|
|
/*
|
2015-03-13 09:20:28 +01:00
|
|
|
* \brief Class for kernel data that is needed to manage a specific CPU
|
|
|
|
* \author Reto Buerki
|
|
|
|
* \date 2015-02-09
|
2015-02-06 17:29:30 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2015-03-13 09:20:28 +01:00
|
|
|
* Copyright (C) 2015 Genode Labs GmbH
|
2015-02-06 17:29:30 +01:00
|
|
|
*
|
|
|
|
* 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/cpu.h>
|
2015-03-02 14:36:06 +01:00
|
|
|
#include <kernel/kernel.h>
|
2015-02-06 17:29:30 +01:00
|
|
|
|
|
|
|
using namespace Kernel;
|
|
|
|
|
|
|
|
|
2015-03-02 14:36:06 +01:00
|
|
|
Cpu_idle::Cpu_idle(Cpu * const cpu) : Cpu_job(Cpu_priority::min, 0)
|
|
|
|
{
|
|
|
|
Cpu_job::cpu(cpu);
|
|
|
|
ip = (addr_t)&_main;
|
|
|
|
sp = (addr_t)&_stack[stack_size];
|
|
|
|
init_thread((addr_t)core_pd()->translation_table(), core_pd()->id());
|
|
|
|
}
|
2015-02-06 17:29:30 +01:00
|
|
|
|
|
|
|
|
2015-03-02 14:36:06 +01:00
|
|
|
void Cpu_idle::exception(unsigned const cpu)
|
|
|
|
{
|
2015-03-09 10:38:13 +01:00
|
|
|
if (trapno == RESET) {
|
|
|
|
return;
|
|
|
|
} else if (trapno >= INTERRUPTS_START && trapno <= INTERRUPTS_END) {
|
|
|
|
_interrupt(cpu);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
assert(0);
|
2015-03-02 14:36:06 +01:00
|
|
|
}
|