44 lines
996 B
C++
44 lines
996 B
C++
/*
|
|
* \brief Kernel backend for protection domains
|
|
* \author Stefan Kalkowski
|
|
* \date 2015-03-20
|
|
*/
|
|
|
|
/*
|
|
* 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.
|
|
*/
|
|
|
|
/* Genode includes */
|
|
#include <util/bit_allocator.h>
|
|
|
|
/* core includes */
|
|
#include <kernel/pd.h>
|
|
|
|
using Asid_allocator = Genode::Bit_allocator<256>;
|
|
|
|
static Asid_allocator &alloc() {
|
|
return *unmanaged_singleton<Asid_allocator>(); }
|
|
|
|
|
|
Kernel::Pd::Pd(Kernel::Pd::Table * const table,
|
|
Genode::Platform_pd * const platform_pd)
|
|
: Kernel::Cpu::Pd((Genode::uint8_t)alloc().alloc()),
|
|
_table(table), _platform_pd(platform_pd) { }
|
|
|
|
|
|
Kernel::Pd::~Pd() {
|
|
/* clean up buffers of memory management */
|
|
Cpu::flush_tlb_by_pid(asid);
|
|
alloc().free(asid);
|
|
}
|
|
|
|
|
|
void Kernel::Pd::admit(Kernel::Cpu::Context * const c)
|
|
{
|
|
c->protection_domain(asid);
|
|
c->translation_table((addr_t)translation_table());
|
|
}
|