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
67 lines
1.4 KiB
C++
67 lines
1.4 KiB
C++
/*
|
|
* \brief Kernel back-end for execution contexts in userland
|
|
* \author Martin Stein
|
|
* \author Reto Buerki
|
|
* \author Stefan Kalkowski
|
|
* \date 2013-11-11
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2013-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 <kernel/pd.h>
|
|
#include <kernel/kernel.h>
|
|
|
|
using namespace Kernel;
|
|
|
|
|
|
/********************
|
|
** Kernel::Thread **
|
|
********************/
|
|
|
|
void Thread::_mmu_exception()
|
|
{
|
|
_become_inactive(AWAITS_RESUME);
|
|
_fault_pd = (addr_t)_pd->platform_pd();
|
|
_fault_signal = (addr_t)_fault.signal_context();
|
|
_fault_addr = Cpu::Cr2::read();
|
|
|
|
/**
|
|
* core should never raise a page-fault,
|
|
* if this happens print out an error message with debug information
|
|
*/
|
|
if (_pd == Kernel::core_pd())
|
|
PERR("Pagefault in core thread (%s): ip=%p fault=%p",
|
|
label(), (void*)ip, (void*)_fault_addr);
|
|
|
|
_fault.submit();
|
|
return;
|
|
}
|
|
|
|
|
|
void Thread::_init() { }
|
|
|
|
|
|
void Thread::_call_update_pd() { }
|
|
|
|
|
|
/*************************
|
|
** Kernel::Cpu_context **
|
|
*************************/
|
|
|
|
void Kernel::Cpu_context::_init(size_t const stack_size, addr_t const table)
|
|
{
|
|
/*
|
|
* the stack pointer already contains the stack base address
|
|
* of all CPU's kernel stacks, on this uni-processor platform
|
|
* it is sufficient to increase it by the stack's size
|
|
*/
|
|
sp = sp + stack_size;
|
|
}
|