mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-21 10:01:57 +00:00
base: lay groundwork for base-linux caps change
Include the necessary hooks to introduce file descriptor based capabilities in base linux. Issue #3581
This commit is contained in:
parent
5eaaee0dbe
commit
a7a9855493
@ -10,5 +10,7 @@ LIBS += startup-fiasco syscall-fiasco
|
||||
|
||||
SRC_CC += capability.cc capability_raw.cc
|
||||
SRC_CC += rpc_dispatch_loop.cc
|
||||
SRC_CC += rpc_entrypoint_manage.cc
|
||||
SRC_CC += thread.cc thread_bootstrap.cc thread_myself.cc
|
||||
SRC_CC += stack_area_addr.cc
|
||||
SRC_CC += rpc_entry.cc
|
||||
|
@ -6,3 +6,4 @@ SRC_CC += thread_start.cc
|
||||
SRC_CC += cache.cc
|
||||
SRC_CC += capability_space.cc
|
||||
SRC_CC += signal_transmitter.cc signal.cc
|
||||
SRC_CC += platform.cc
|
||||
|
@ -204,10 +204,11 @@ void Genode::ipc_reply(Native_capability caller, Rpc_exception_code exc,
|
||||
}
|
||||
|
||||
|
||||
Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &last_caller,
|
||||
Rpc_exception_code exc,
|
||||
Msgbuf_base &reply_msg,
|
||||
Msgbuf_base &request_msg)
|
||||
Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &last_caller,
|
||||
Rpc_exception_code exc,
|
||||
Msgbuf_base &reply_msg,
|
||||
Msgbuf_base &request_msg,
|
||||
Rpc_entrypoint::Native_context &)
|
||||
{
|
||||
using namespace Fiasco;
|
||||
|
||||
@ -274,9 +275,10 @@ Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &last_caller,
|
||||
}
|
||||
|
||||
|
||||
Ipc_server::Ipc_server()
|
||||
Ipc_server::Ipc_server(Rpc_entrypoint::Native_context& native_context)
|
||||
:
|
||||
Native_capability(Capability_space::import(Fiasco::l4_myself(), Rpc_obj_key()))
|
||||
Native_capability(Capability_space::import(Fiasco::l4_myself(), Rpc_obj_key())),
|
||||
_native_context(native_context)
|
||||
{ }
|
||||
|
||||
|
||||
|
@ -10,6 +10,9 @@ LIBS += syscall-foc startup-foc
|
||||
|
||||
SRC_CC += spin_lock.cc cap_map.cc
|
||||
SRC_CC += rpc_dispatch_loop.cc
|
||||
SRC_CC += rpc_entrypoint_manage.cc
|
||||
SRC_CC += thread.cc thread_bootstrap.cc thread_myself.cc utcb.cc
|
||||
SRC_CC += capability.cc
|
||||
SRC_CC += signal_source_client.cc
|
||||
SRC_CC += platform.cc
|
||||
SRC_CC += rpc_entry.cc
|
||||
|
@ -316,10 +316,11 @@ void Genode::ipc_reply(Native_capability, Rpc_exception_code exc,
|
||||
}
|
||||
|
||||
|
||||
Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &,
|
||||
Rpc_exception_code exc,
|
||||
Msgbuf_base &reply_msg,
|
||||
Msgbuf_base &request_msg)
|
||||
Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &,
|
||||
Rpc_exception_code exc,
|
||||
Msgbuf_base &reply_msg,
|
||||
Msgbuf_base &request_msg,
|
||||
Rpc_entrypoint::Native_context &)
|
||||
{
|
||||
Receive_window &rcv_window = Thread::myself()->native_thread().rcv_window;
|
||||
|
||||
@ -370,9 +371,10 @@ Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &,
|
||||
}
|
||||
|
||||
|
||||
Ipc_server::Ipc_server()
|
||||
Ipc_server::Ipc_server(Rpc_entrypoint::Native_context& native_context)
|
||||
:
|
||||
Native_capability((Cap_index*)Fiasco::l4_utcb_tcr()->user[Fiasco::UTCB_TCR_BADGE])
|
||||
Native_capability((Cap_index*)Fiasco::l4_utcb_tcr()->user[Fiasco::UTCB_TCR_BADGE]),
|
||||
_native_context(native_context)
|
||||
{
|
||||
Thread::myself()->native_thread().rcv_window.init();
|
||||
}
|
||||
|
@ -10,5 +10,7 @@ include $(BASE_DIR)/lib/mk/base-common.inc
|
||||
LIBS += syscall-hw
|
||||
|
||||
SRC_CC += rpc_dispatch_loop.cc
|
||||
SRC_CC += rpc_entrypoint_manage.cc
|
||||
SRC_CC += thread.cc thread_myself.cc thread_bootstrap.cc
|
||||
SRC_CC += signal_transmitter.cc
|
||||
SRC_CC += rpc_entry.cc
|
||||
|
@ -7,5 +7,6 @@ SRC_CC += raw_write_string.cc
|
||||
SRC_CC += signal_receiver.cc
|
||||
SRC_CC += stack_area_addr.cc
|
||||
SRC_CC += native_utcb.cc
|
||||
SRC_CC += platform.cc
|
||||
|
||||
LIBS += startup-hw base-hw-common cxx timeout-hw
|
||||
|
@ -130,10 +130,11 @@ void Genode::ipc_reply(Native_capability, Rpc_exception_code exc,
|
||||
}
|
||||
|
||||
|
||||
Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &,
|
||||
Rpc_exception_code exc,
|
||||
Msgbuf_base &reply_msg,
|
||||
Msgbuf_base &request_msg)
|
||||
Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &,
|
||||
Rpc_exception_code exc,
|
||||
Msgbuf_base &reply_msg,
|
||||
Msgbuf_base &request_msg,
|
||||
Rpc_entrypoint::Native_context &)
|
||||
{
|
||||
Native_utcb &utcb = *Thread::myself()->utcb();
|
||||
|
||||
@ -162,10 +163,11 @@ Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &,
|
||||
}
|
||||
|
||||
|
||||
Ipc_server::Ipc_server()
|
||||
Ipc_server::Ipc_server(Rpc_entrypoint::Native_context& _native_context)
|
||||
:
|
||||
Native_capability(Thread::myself() ? Thread::myself()->native_thread().cap
|
||||
: Hw::_main_thread_cap)
|
||||
: Hw::_main_thread_cap),
|
||||
_native_context(_native_context)
|
||||
{ }
|
||||
|
||||
|
||||
|
@ -10,5 +10,8 @@ LIBS += syscall-linux
|
||||
|
||||
SRC_CC += region_map_mmap.cc debug.cc
|
||||
SRC_CC += rpc_dispatch_loop.cc
|
||||
SRC_CC += rpc_entrypoint_manage.cc
|
||||
SRC_CC += thread_env.cc
|
||||
SRC_CC += capability.cc
|
||||
SRC_CC += platform.cc
|
||||
SRC_CC += rpc_entry.cc
|
||||
|
@ -462,10 +462,11 @@ void Genode::ipc_reply(Native_capability caller, Rpc_exception_code exc,
|
||||
}
|
||||
|
||||
|
||||
Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &last_caller,
|
||||
Rpc_exception_code exc,
|
||||
Msgbuf_base &reply_msg,
|
||||
Msgbuf_base &request_msg)
|
||||
Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &last_caller,
|
||||
Rpc_exception_code exc,
|
||||
Msgbuf_base &reply_msg,
|
||||
Msgbuf_base &request_msg,
|
||||
Rpc_entrypoint::Native_context &)
|
||||
{
|
||||
/* when first called, there was no request yet */
|
||||
if (last_caller.valid() && exc.value != Rpc_exception_code::INVALID_OBJECT)
|
||||
@ -514,9 +515,10 @@ Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &last_caller,
|
||||
}
|
||||
|
||||
|
||||
Ipc_server::Ipc_server()
|
||||
Ipc_server::Ipc_server(Rpc_entrypoint::Native_context& _native_context)
|
||||
:
|
||||
Native_capability(Capability_space::import(Rpc_destination(), Rpc_obj_key()))
|
||||
Native_capability(Capability_space::import(Rpc_destination(), Rpc_obj_key())),
|
||||
_native_context(_native_context)
|
||||
{
|
||||
/*
|
||||
* If 'thread' is 0, the constructor was called by the main thread. By
|
||||
|
@ -4,3 +4,4 @@ LIBS += base-nova-common cxx timeout
|
||||
SRC_CC += thread_start.cc
|
||||
SRC_CC += cache.cc
|
||||
SRC_CC += signal.cc
|
||||
SRC_CC += platform.cc
|
||||
|
@ -10,5 +10,7 @@ LIBS += startup-okl4 syscall-okl4
|
||||
|
||||
SRC_CC += capability.cc capability_raw.cc
|
||||
SRC_CC += rpc_dispatch_loop.cc
|
||||
SRC_CC += rpc_entrypoint_manage.cc
|
||||
SRC_CC += thread.cc thread_bootstrap.cc thread_myself.cc
|
||||
SRC_CC += stack_area_addr.cc
|
||||
SRC_CC += rpc_entry.cc
|
||||
|
@ -6,3 +6,4 @@ SRC_CC += cache.cc
|
||||
SRC_CC += capability_space.cc
|
||||
SRC_CC += signal_transmitter.cc
|
||||
SRC_CC += signal.cc
|
||||
SRC_CC += platform.cc
|
||||
|
@ -195,10 +195,11 @@ void Genode::ipc_reply(Native_capability caller, Rpc_exception_code exc,
|
||||
}
|
||||
|
||||
|
||||
Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &last_caller,
|
||||
Rpc_exception_code exc,
|
||||
Msgbuf_base &reply_msg,
|
||||
Msgbuf_base &request_msg)
|
||||
Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &last_caller,
|
||||
Rpc_exception_code exc,
|
||||
Msgbuf_base &reply_msg,
|
||||
Msgbuf_base &request_msg,
|
||||
Rpc_entrypoint::Native_context &)
|
||||
{
|
||||
L4_MsgTag_t rcv_tag;
|
||||
|
||||
@ -237,9 +238,10 @@ static inline Okl4::L4_ThreadId_t thread_get_my_global_id()
|
||||
}
|
||||
|
||||
|
||||
Ipc_server::Ipc_server()
|
||||
Ipc_server::Ipc_server(Rpc_entrypoint::Native_context& _native_context)
|
||||
:
|
||||
Native_capability(Capability_space::import(thread_get_my_global_id(), Rpc_obj_key()))
|
||||
Native_capability(Capability_space::import(thread_get_my_global_id(), Rpc_obj_key())),
|
||||
_native_context(_native_context)
|
||||
{ }
|
||||
|
||||
|
||||
|
@ -10,8 +10,10 @@ LIBS += startup-pistachio syscall-pistachio
|
||||
|
||||
SRC_CC += capability.cc capability_raw.cc
|
||||
SRC_CC += rpc_dispatch_loop.cc
|
||||
SRC_CC += rpc_entrypoint_manage.cc
|
||||
SRC_CC += thread.cc thread_bootstrap.cc thread_myself.cc
|
||||
SRC_CC += stack_area_addr.cc
|
||||
SRC_CC += rpc_entry.cc
|
||||
|
||||
# suppress warning caused by Pistachio's 'l4/message.h'
|
||||
CC_WARN += -Wno-array-bounds
|
||||
|
@ -7,3 +7,4 @@ SRC_CC += cache.cc
|
||||
SRC_CC += capability_space.cc
|
||||
SRC_CC += signal_transmitter.cc
|
||||
SRC_CC += signal.cc
|
||||
SRC_CC += platform.cc
|
||||
|
@ -185,10 +185,11 @@ void Genode::ipc_reply(Native_capability caller, Rpc_exception_code exc,
|
||||
}
|
||||
|
||||
|
||||
Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &last_caller,
|
||||
Rpc_exception_code exc,
|
||||
Msgbuf_base &reply_msg,
|
||||
Msgbuf_base &request_msg)
|
||||
Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &last_caller,
|
||||
Rpc_exception_code exc,
|
||||
Msgbuf_base &reply_msg,
|
||||
Msgbuf_base &request_msg,
|
||||
Rpc_entrypoint::Native_context &)
|
||||
{
|
||||
bool need_to_wait = true;
|
||||
|
||||
@ -237,9 +238,10 @@ Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &last_caller,
|
||||
}
|
||||
|
||||
|
||||
Ipc_server::Ipc_server()
|
||||
Ipc_server::Ipc_server(Rpc_entrypoint::Native_context& _native_context)
|
||||
:
|
||||
Native_capability(Capability_space::import(Pistachio::L4_Myself(), Rpc_obj_key()))
|
||||
Native_capability(Capability_space::import(Pistachio::L4_Myself(), Rpc_obj_key())),
|
||||
_native_context(_native_context)
|
||||
{ }
|
||||
|
||||
|
||||
|
@ -9,6 +9,9 @@ include $(BASE_DIR)/lib/mk/base-common.inc
|
||||
LIBS += startup-sel4 syscall-sel4
|
||||
|
||||
SRC_CC += rpc_dispatch_loop.cc
|
||||
SRC_CC += rpc_entrypoint_manage.cc
|
||||
SRC_CC += thread.cc thread_myself.cc thread_bootstrap.cc
|
||||
SRC_CC += capability.cc capability_raw.cc
|
||||
SRC_CC += stack_area_addr.cc
|
||||
SRC_CC += platform.cc
|
||||
SRC_CC += rpc_entry.cc
|
||||
|
@ -359,10 +359,11 @@ void Genode::ipc_reply(Native_capability, Rpc_exception_code exc,
|
||||
}
|
||||
|
||||
|
||||
Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &,
|
||||
Rpc_exception_code exc,
|
||||
Msgbuf_base &reply_msg,
|
||||
Msgbuf_base &request_msg)
|
||||
Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &,
|
||||
Rpc_exception_code exc,
|
||||
Msgbuf_base &reply_msg,
|
||||
Msgbuf_base &request_msg,
|
||||
Rpc_entrypoint::Native_context &)
|
||||
{
|
||||
/* allocate and define receive selector */
|
||||
if (!rcv_sel())
|
||||
@ -391,9 +392,10 @@ Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &,
|
||||
}
|
||||
|
||||
|
||||
Ipc_server::Ipc_server()
|
||||
Ipc_server::Ipc_server(Rpc_entrypoint::Native_context& _native_context)
|
||||
:
|
||||
Native_capability(Capability_space::create_ep_cap(*Thread::myself()))
|
||||
Native_capability(Capability_space::create_ep_cap(*Thread::myself())),
|
||||
_native_context(_native_context)
|
||||
{ }
|
||||
|
||||
|
||||
|
20
repos/base/include/base/platform.h
Normal file
20
repos/base/include/base/platform.h
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* \brief Platform dependant hook after binary ready
|
||||
* \author Stefan Thoeni
|
||||
* \date 2019-12-13
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2019 Genode Labs GmbH
|
||||
* Copyright (C) 2019 gapfruit AG
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__PLATFORM_H_
|
||||
#define _INCLUDE__PLATFORM_H_
|
||||
|
||||
void binary_ready_hook_for_platform();
|
||||
|
||||
#endif /* _INCLUDE__PLATFORM_H_ */
|
@ -1,11 +1,13 @@
|
||||
/*
|
||||
* \brief Server-side API of the RPC framework
|
||||
* \author Norman Feske
|
||||
* \author Stefan Thöni
|
||||
* \date 2006-04-28
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006-2017 Genode Labs GmbH
|
||||
* Copyright (C) 2006-2020 Genode Labs GmbH
|
||||
* Copyright (C) 2020 gapfruit AG
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
@ -278,7 +280,6 @@ struct Genode::Rpc_object : Rpc_object_base, Rpc_dispatcher<RPC_INTERFACE, SERVE
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* RPC entrypoint serving RPC objects
|
||||
*
|
||||
@ -301,6 +302,10 @@ class Genode::Rpc_entrypoint : Thread, public Object_pool<Rpc_object_base>
|
||||
*/
|
||||
friend class Signal_receiver;
|
||||
|
||||
public:
|
||||
|
||||
class Native_context;
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
@ -320,6 +325,8 @@ class Genode::Rpc_entrypoint : Thread, public Object_pool<Rpc_object_base>
|
||||
*/
|
||||
static void _activation_entry();
|
||||
|
||||
static size_t _native_stack_size(size_t stack_size);
|
||||
|
||||
struct Exit : Genode::Interface
|
||||
{
|
||||
GENODE_RPC(Rpc_exit, void, _exit);
|
||||
@ -344,6 +351,7 @@ class Genode::Rpc_entrypoint : Thread, public Object_pool<Rpc_object_base>
|
||||
Pd_session &_pd_session; /* for creating capabilities */
|
||||
Exit_handler _exit_handler { };
|
||||
Capability<Exit> _exit_cap { };
|
||||
Native_context *_native_context { nullptr };
|
||||
|
||||
/**
|
||||
* Access to kernel-specific part of the PD session interface
|
||||
@ -399,6 +407,12 @@ class Genode::Rpc_entrypoint : Thread, public Object_pool<Rpc_object_base>
|
||||
*/
|
||||
void entry() override;
|
||||
|
||||
/**
|
||||
* Called by implementation specific entry function
|
||||
* with created native context
|
||||
*/
|
||||
void _entry(Native_context& native_context);
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
@ -415,8 +429,12 @@ class Genode::Rpc_entrypoint : Thread, public Object_pool<Rpc_object_base>
|
||||
char const *name, bool start_on_construction = true,
|
||||
Affinity::Location location = Affinity::Location());
|
||||
|
||||
Rpc_entrypoint(Genode::Rpc_entrypoint const &) = delete;
|
||||
|
||||
~Rpc_entrypoint();
|
||||
|
||||
Genode::Rpc_entrypoint operator=(Genode::Rpc_entrypoint const &) = delete;
|
||||
|
||||
/**
|
||||
* Associate RPC object with the entry point
|
||||
*/
|
||||
|
@ -17,6 +17,7 @@
|
||||
/* Genode includes */
|
||||
#include <base/stdint.h>
|
||||
#include <base/ipc.h>
|
||||
#include <base/rpc_server.h>
|
||||
|
||||
namespace Genode {
|
||||
|
||||
@ -44,17 +45,25 @@ namespace Genode {
|
||||
/**
|
||||
* Send result of previous RPC request and wait for new one
|
||||
*/
|
||||
Rpc_request ipc_reply_wait(Reply_capability const &caller,
|
||||
Rpc_exception_code reply_exc,
|
||||
Msgbuf_base &reply_msg,
|
||||
Msgbuf_base &request_msg);
|
||||
Rpc_request ipc_reply_wait(Reply_capability const &caller,
|
||||
Rpc_exception_code reply_exc,
|
||||
Msgbuf_base &reply_msg,
|
||||
Msgbuf_base &request_msg,
|
||||
Rpc_entrypoint::Native_context &native_context);
|
||||
}
|
||||
|
||||
|
||||
struct Genode::Ipc_server : Native_capability
|
||||
class Genode::Ipc_server : public Native_capability
|
||||
{
|
||||
Ipc_server();
|
||||
~Ipc_server();
|
||||
private:
|
||||
|
||||
Rpc_entrypoint::Native_context& _native_context;
|
||||
|
||||
public:
|
||||
|
||||
Ipc_server(Rpc_entrypoint::Native_context& native_context);
|
||||
|
||||
~Ipc_server();
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__BASE__INTERNAL__IPC_SERVER_H_ */
|
||||
|
22
repos/base/src/lib/base/platform.cc
Normal file
22
repos/base/src/lib/base/platform.cc
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* \brief Platform dependant hook after binary ready
|
||||
* \author Stefan Thoeni
|
||||
* \date 2019-12-13
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2019 Genode Labs GmbH
|
||||
* Copyright (C) 2019 gapfruit AG
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
|
||||
/* base-internal includes */
|
||||
#include <base/platform.h>
|
||||
|
||||
void binary_ready_hook_for_platform()
|
||||
{
|
||||
}
|
||||
|
@ -20,33 +20,11 @@
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
/***********************
|
||||
** Server entrypoint **
|
||||
***********************/
|
||||
|
||||
Untyped_capability Rpc_entrypoint::_manage(Rpc_object_base *obj)
|
||||
void Rpc_entrypoint::_entry(Native_context& native_context)
|
||||
{
|
||||
/* don't manage RPC object twice */
|
||||
if (obj->cap().valid()) {
|
||||
warning("attempt to manage RPC object twice");
|
||||
return obj->cap();
|
||||
}
|
||||
_native_context = &native_context;
|
||||
|
||||
Untyped_capability new_obj_cap = _alloc_rpc_cap(_pd_session, _cap);
|
||||
|
||||
/* add server object to object pool */
|
||||
obj->cap(new_obj_cap);
|
||||
insert(obj);
|
||||
|
||||
/* return capability that uses the object id as badge */
|
||||
return new_obj_cap;
|
||||
}
|
||||
|
||||
|
||||
void Rpc_entrypoint::entry()
|
||||
{
|
||||
Ipc_server srv;
|
||||
Ipc_server srv(native_context);
|
||||
_cap = srv;
|
||||
_cap_valid.unlock();
|
||||
|
||||
@ -63,7 +41,7 @@ void Rpc_entrypoint::entry()
|
||||
|
||||
while (!_exit_handler.exit) {
|
||||
|
||||
Rpc_request const request = ipc_reply_wait(_caller, exc, _snd_buf, _rcv_buf);
|
||||
Rpc_request const request = ipc_reply_wait(_caller, exc, _snd_buf, _rcv_buf, native_context);
|
||||
_caller = request.caller;
|
||||
|
||||
Ipc_unmarshaller unmarshaller(_rcv_buf);
|
||||
|
40
repos/base/src/lib/base/rpc_entry.cc
Normal file
40
repos/base/src/lib/base/rpc_entry.cc
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* \brief Default version of platform-specific part of RPC framework
|
||||
* \author Stefan Thöni
|
||||
* \date 2020-01-30
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006-2020 Genode Labs GmbH
|
||||
* Copyright (C) 2020 gapfruit AG
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/rpc_server.h>
|
||||
|
||||
/* base-internal includes */
|
||||
#include <base/internal/ipc_server.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
class Rpc_entrypoint::Native_context
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
void Rpc_entrypoint::entry()
|
||||
{
|
||||
Native_context context { };
|
||||
_entry(context);
|
||||
}
|
||||
|
||||
|
||||
size_t Rpc_entrypoint::_native_stack_size(size_t stack_size)
|
||||
{
|
||||
return stack_size + sizeof(Native_context);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ Rpc_entrypoint::Rpc_entrypoint(Pd_session *pd_session, size_t stack_size,
|
||||
char const *name, bool start_on_construction,
|
||||
Affinity::Location location)
|
||||
:
|
||||
Thread(Cpu_session::Weight::DEFAULT_WEIGHT, name, stack_size, location),
|
||||
Thread(Cpu_session::Weight::DEFAULT_WEIGHT, name, _native_stack_size(stack_size), location),
|
||||
_cap(Untyped_capability()),
|
||||
_cap_valid(Lock::LOCKED), _delay_start(Lock::LOCKED),
|
||||
_delay_exit(Lock::LOCKED),
|
||||
|
45
repos/base/src/lib/base/rpc_entrypoint_manage.cc
Normal file
45
repos/base/src/lib/base/rpc_entrypoint_manage.cc
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* \brief Default version of platform-specific part of RPC framework
|
||||
* \author Norman Feske
|
||||
* \date 2006-05-12
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <util/retry.h>
|
||||
#include <base/rpc_server.h>
|
||||
|
||||
/* base-internal includes */
|
||||
#include <base/internal/ipc_server.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
/***********************
|
||||
** Server entrypoint **
|
||||
***********************/
|
||||
|
||||
Untyped_capability Rpc_entrypoint::_manage(Rpc_object_base *obj)
|
||||
{
|
||||
/* don't manage RPC object twice */
|
||||
if (obj->cap().valid()) {
|
||||
warning("attempt to manage RPC object twice");
|
||||
return obj->cap();
|
||||
}
|
||||
|
||||
Untyped_capability new_obj_cap = _alloc_rpc_cap(_pd_session, _cap);
|
||||
|
||||
/* add server object to object pool */
|
||||
obj->cap(new_obj_cap);
|
||||
insert(obj);
|
||||
|
||||
/* return capability that uses the object id as badge */
|
||||
return new_obj_cap;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <util/string.h>
|
||||
#include <base/thread.h>
|
||||
#include <base/heap.h>
|
||||
#include <base/platform.h>
|
||||
|
||||
/* base-internal includes */
|
||||
#include <base/internal/unmanaged_singleton.h>
|
||||
@ -783,6 +784,8 @@ void Component::construct(Genode::Env &env)
|
||||
|
||||
binary_ready_hook_for_gdb();
|
||||
|
||||
binary_ready_hook_for_platform();
|
||||
|
||||
/* start binary */
|
||||
binary_ptr->call_entry_point(env);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user