88b358c5ef
This patch establishes the sole use of generic headers across all kernels. The common 'native_capability.h' is based on the version of base-sel4. All traditional L4 kernels and Linux use the same implementation of the capability-lifetime management. On base-hw, NOVA, Fiasco.OC, and seL4, custom implementations (based on their original mechanisms) are used, with the potential to unify them further in the future. This change achieves binary compatibility of dynamically linked programs across all kernels. Furthermore, the patch introduces a Native_capability::print method, which allows the easy output of the kernel-specific capability representation using the base/log.h API. Issue #1993
50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
/*
|
|
* \brief VM session component for 'base-hw'
|
|
* \author Stefan Kalkowski
|
|
* \date 2012-10-08
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2012-2013 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.
|
|
*/
|
|
|
|
#include <kernel/core_interface.h>
|
|
#include <vm_session_component.h>
|
|
#include <core_env.h>
|
|
|
|
using namespace Genode;
|
|
|
|
|
|
void Vm_session_component::exception_handler(Signal_context_capability handler)
|
|
{
|
|
if (!create((void*)_ds.core_local_addr(), Capability_space::capid(handler),
|
|
nullptr))
|
|
{
|
|
PWRN("Cannot instantiate vm kernel object twice,"
|
|
"or invalid signal context?");
|
|
}
|
|
}
|
|
|
|
|
|
Vm_session_component::Vm_session_component(Rpc_entrypoint *ds_ep,
|
|
size_t ram_quota)
|
|
: _ds_ep(ds_ep), _ds(_ds_size(), _alloc_ds(ram_quota), UNCACHED, true, 0),
|
|
_ds_cap(static_cap_cast<Dataspace>(_ds_ep->manage(&_ds)))
|
|
{
|
|
_ds.assign_core_local_addr(core_env()->rm_session()->attach(_ds_cap));
|
|
}
|
|
|
|
|
|
Vm_session_component::~Vm_session_component()
|
|
{
|
|
/* dissolve VM dataspace from service entry point */
|
|
_ds_ep->dissolve(&_ds);
|
|
|
|
/* free region in allocator */
|
|
core_env()->rm_session()->detach(_ds.core_local_addr());
|
|
platform()->ram_alloc()->free((void*)_ds.phys_addr());
|
|
}
|