Instead of organizing page tables within slab blocks and allocating such blocks dynamically on demand, replace the page table allocator with a simple, static alternative. The new page table allocator is dimensioned at compile-time. When a PD runs out of page-tables, we simply flush its current mappings, and re-use the freed tables. The only exception is core/kernel that should not produce any page faults. Thereby it has to be ensured that core has enough page tables to populate it's virtual memory. A positive side-effect of this static approach is that the accounting of memory used for page-tables is now possible again. In the dynamic case there was no protocol existent that solved the problem of donating memory to core during a page fault. Fix #1588
42 lines
993 B
C++
42 lines
993 B
C++
/*
|
|
* \brief Class for kernel data that is needed to manage a specific CPU
|
|
* \author Martin Stein
|
|
* \author Stefan Kalkowski
|
|
* \date 2014-01-14
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 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 <assert.h>
|
|
#include <kernel/cpu.h>
|
|
#include <kernel/kernel.h>
|
|
#include <kernel/pd.h>
|
|
|
|
using namespace Kernel;
|
|
|
|
|
|
Cpu_idle::Cpu_idle(Cpu * const cpu) : Cpu_job(Cpu_priority::min, 0)
|
|
{
|
|
Cpu_job::cpu(cpu);
|
|
cpu_exception = RESET;
|
|
ip = (addr_t)&_main;
|
|
sp = (addr_t)&_stack[stack_size];
|
|
init_thread((addr_t)core_pd()->translation_table(), core_pd()->asid);
|
|
}
|
|
|
|
|
|
void Cpu_idle::exception(unsigned const cpu)
|
|
{
|
|
switch (cpu_exception) {
|
|
case INTERRUPT_REQUEST: _interrupt(cpu); return;
|
|
case FAST_INTERRUPT_REQUEST: _interrupt(cpu); return;
|
|
case RESET: return;
|
|
default: assert(0); }
|
|
}
|