4e98a0f64a
The distinction between Kernel::Thread and Kernel::Thread_base is unnecessary as currently all Hw platforms would have the same content in the latter class. Thus I've merged Kernel::Thread_base into Kernel::Thread. Thereby, Kernel::Thread_event can be moved to kernel/thread.h. Ref #1652
49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
/*
|
|
* \brief Kernel backend for execution contexts in userland
|
|
* \author Adrian-Ken Rueegsegger
|
|
* \author Reto Buerki
|
|
* \date 2015-04-28
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2015 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/thread.h>
|
|
#include <pic.h>
|
|
|
|
using namespace Kernel;
|
|
|
|
void Thread::exception(unsigned const cpu)
|
|
{
|
|
switch (trapno) {
|
|
case PAGE_FAULT:
|
|
_mmu_exception();
|
|
return;
|
|
case NO_MATH_COPROC:
|
|
if (_cpu->retry_fpu_instr(&_lazy_state)) { return; }
|
|
PWRN("%s -> %s: FPU error", pd_label(), label());
|
|
_stop();
|
|
return;
|
|
case UNDEFINED_INSTRUCTION:
|
|
PWRN("%s -> %s: undefined instruction at ip=%p",
|
|
pd_label(), label(), (void*)ip);
|
|
_stop();
|
|
case SUPERVISOR_CALL:
|
|
_call();
|
|
return;
|
|
}
|
|
if (trapno >= INTERRUPTS_START && trapno <= INTERRUPTS_END) {
|
|
pic()->irq_occurred(trapno);
|
|
_interrupt(cpu);
|
|
return;
|
|
}
|
|
PWRN("%s -> %s: triggered unknown exception %lu with error code %lu"
|
|
" at ip=%p", pd_label(), label(), trapno, errcode, (void*)ip);
|
|
_stop();
|
|
}
|