Assign threads to PD at its creation time
This patch replaces the former 'Pd_session::bind_thread' function by a PD-capability argument of the 'Cpu_session::create_thread' function, and removes the ancient thread-start protocol via 'Rm_session::add_client' and 'Cpu_session::set_pager'. Threads are now bound to PDs at their creation time and implicitly paged according to the address space of the PD. Note the API change: This patch changes the signature of the 'Child' and 'Process' constructors. There is a new 'address_space' argument, which represents the region map representing the child's address space. It is supplied separately to the PD session capability (which principally can be invoked to obtain the PD's address space) to allow the population of the address space without relying on an 'Pd_session::address_space' RPC call. Furthermore, a new (optional) env_pd argument allows the explicit overriding of the PD capability handed out to the child as part of its environment. It can be used to intercept the interaction of the child with its PD session at core. This is used by Noux. Issue #1938
This commit is contained in:
committed by
Christian Helmuth
parent
2bc8a0f76a
commit
b49e588c1c
@@ -62,5 +62,8 @@ Core_region_map::attach(Dataspace_capability ds_cap, size_t size,
|
||||
return virt_addr;
|
||||
};
|
||||
|
||||
return _ds_ep->apply(ds_cap, lambda);
|
||||
return _ep.apply(ds_cap, lambda);
|
||||
}
|
||||
|
||||
|
||||
void Core_region_map::detach(Local_addr) { }
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* \brief Core-local region map
|
||||
* \author Norman Feske
|
||||
* \date 2015-05-01
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _CORE__INCLUDE__CORE_RM_SESSION_H_
|
||||
#define _CORE__INCLUDE__CORE_RM_SESSION_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/printf.h>
|
||||
#include <region_map/region_map.h>
|
||||
|
||||
/* core includes */
|
||||
#include <dataspace_component.h>
|
||||
|
||||
namespace Genode { class Core_region_map; }
|
||||
|
||||
|
||||
class Genode::Core_region_map : public Region_map
|
||||
{
|
||||
private:
|
||||
|
||||
Rpc_entrypoint *_ds_ep;
|
||||
|
||||
public:
|
||||
|
||||
Core_region_map(Rpc_entrypoint *ds_ep): _ds_ep(ds_ep) { }
|
||||
|
||||
Local_addr attach(Dataspace_capability ds_cap, size_t size = 0,
|
||||
off_t offset = 0, bool use_local_addr = false,
|
||||
Local_addr local_addr = 0,
|
||||
bool executable = false) override;
|
||||
|
||||
void detach(Local_addr) override { }
|
||||
|
||||
Pager_capability add_client(Thread_capability) override {
|
||||
return Pager_capability(); }
|
||||
|
||||
void remove_client(Pager_capability) override { }
|
||||
|
||||
void fault_handler(Signal_context_capability) override { }
|
||||
|
||||
State state() override { return State(); }
|
||||
|
||||
Dataspace_capability dataspace() override { return Dataspace_capability(); }
|
||||
};
|
||||
|
||||
#endif /* _CORE__INCLUDE__CORE_RM_SESSION_H_ */
|
||||
@@ -75,7 +75,7 @@ class Genode::Platform_pd : public Address_space
|
||||
/**
|
||||
* Bind thread to protection domain
|
||||
*/
|
||||
void bind_thread(Platform_thread *thread);
|
||||
bool bind_thread(Platform_thread *thread);
|
||||
|
||||
/**
|
||||
* Unbind thread from protection domain
|
||||
|
||||
@@ -73,7 +73,7 @@ class Genode::Platform_thread : public List<Platform_thread>::Element
|
||||
* Constructor
|
||||
*/
|
||||
Platform_thread(size_t, const char *name = 0, unsigned priority = 0,
|
||||
addr_t utcb = 0);
|
||||
Affinity::Location = Affinity::Location(), addr_t utcb = 0);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
@@ -173,15 +173,6 @@ class Genode::Platform_thread : public List<Platform_thread>::Element
|
||||
*/
|
||||
const char *name() const { return "noname"; }
|
||||
|
||||
/**
|
||||
* Return pointer to the thread's PD
|
||||
*
|
||||
* Used to validate the success of the bind operation.
|
||||
*
|
||||
* XXX to be removed
|
||||
*/
|
||||
Platform_pd *pd() { return _pd; }
|
||||
|
||||
|
||||
/*****************************
|
||||
** seL4-specific interface **
|
||||
|
||||
@@ -18,14 +18,15 @@
|
||||
#include <rm_session/rm_session.h>
|
||||
#include <base/printf.h>
|
||||
|
||||
/* base-internal includes */
|
||||
#include <base/internal/page_size.h>
|
||||
|
||||
/* core includes */
|
||||
#include <core_cspace.h>
|
||||
|
||||
|
||||
namespace Genode {
|
||||
|
||||
constexpr size_t get_page_size_log2() { return 12; }
|
||||
constexpr size_t get_page_size() { return 1 << get_page_size_log2(); }
|
||||
constexpr addr_t get_page_mask() { return ~(get_page_size() - 1); }
|
||||
inline addr_t trunc_page(addr_t addr) { return addr & get_page_mask(); }
|
||||
inline addr_t round_page(addr_t addr) { return trunc_page(addr + get_page_size() - 1); }
|
||||
|
||||
@@ -52,7 +52,7 @@ static Pd_id_alloc &pd_id_alloc()
|
||||
}
|
||||
|
||||
|
||||
void Platform_pd::bind_thread(Platform_thread *thread)
|
||||
bool Platform_pd::bind_thread(Platform_thread *thread)
|
||||
{
|
||||
ASSERT(thread);
|
||||
|
||||
@@ -73,6 +73,7 @@ void Platform_pd::bind_thread(Platform_thread *thread)
|
||||
} else {
|
||||
_vm_space.map(thread->_info.ipc_buffer_phys, thread->INITIAL_IPC_BUFFER_VIRT, 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ void Platform_thread::install_mapping(Mapping const &mapping)
|
||||
|
||||
|
||||
Platform_thread::Platform_thread(size_t, const char *name, unsigned priority,
|
||||
addr_t utcb)
|
||||
Affinity::Location, addr_t utcb)
|
||||
:
|
||||
_name(name),
|
||||
_utcb(utcb),
|
||||
|
||||
@@ -62,7 +62,7 @@ class Stack_area_region_map : public Region_map
|
||||
Local_addr attach(Dataspace_capability ds_cap, /* ignored capability */
|
||||
size_t size, off_t offset,
|
||||
bool use_local_addr, Local_addr local_addr,
|
||||
bool executable)
|
||||
bool executable) override
|
||||
{
|
||||
size = round_page(size);
|
||||
|
||||
@@ -98,18 +98,13 @@ class Stack_area_region_map : public Region_map
|
||||
return local_addr;
|
||||
}
|
||||
|
||||
void detach(Local_addr local_addr) { PWRN("Not implemented!"); }
|
||||
void detach(Local_addr) override { PWRN("Not implemented!"); }
|
||||
|
||||
Pager_capability add_client(Thread_capability) {
|
||||
return Pager_capability(); }
|
||||
void fault_handler(Signal_context_capability) override { }
|
||||
|
||||
void remove_client(Pager_capability) { }
|
||||
State state() override { return State(); }
|
||||
|
||||
void fault_handler(Signal_context_capability) { }
|
||||
|
||||
State state() { return State(); }
|
||||
|
||||
Dataspace_capability dataspace() { return Dataspace_capability(); }
|
||||
Dataspace_capability dataspace() override { return Dataspace_capability(); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user