base: remove env_deprecated from rpc_cap_alloc

Issue #4784
This commit is contained in:
Norman Feske 2023-03-10 14:09:14 +01:00
parent 223e185b83
commit 441186468c
9 changed files with 81 additions and 21 deletions

View File

@ -16,11 +16,12 @@
/* base-internal includes */
#include <base/internal/native_thread.h>
#include <base/internal/globals.h>
/* core includes */
#include <types.h>
using namespace Genode;
using namespace Core;
void Genode::init_rpc_cap_alloc(Parent &) { }
Native_capability Rpc_entrypoint::_alloc_rpc_cap(Pd_session &, Native_capability,

View File

@ -174,5 +174,7 @@ Platform_env::Platform_env()
/* register TID and PID of the main thread at core */
Linux_native_cpu_client native_cpu(cpu_session()->native_cpu());
native_cpu.thread_id(parent()->main_thread_cap(), lx_getpid(), lx_gettid());
init_rpc_cap_alloc(_parent());
}

View File

@ -14,14 +14,28 @@
/* Genode includes */
#include <base/env.h>
#include <base/rpc_server.h>
#include <deprecated/env.h>
/* base-internal includes */
#include <base/internal/native_thread.h>
#include <base/internal/globals.h>
using namespace Genode;
static Parent *_parent_ptr;
static Parent &_parent()
{
if (_parent_ptr)
return *_parent_ptr;
error("missing call of init_rpc_cap_alloc");
for (;;);
}
void Genode::init_rpc_cap_alloc(Parent &parent) { _parent_ptr = &parent; }
Native_capability Rpc_entrypoint::_alloc_rpc_cap(Pd_session& pd, Native_capability,
addr_t)
{
@ -34,9 +48,9 @@ Native_capability Rpc_entrypoint::_alloc_rpc_cap(Pd_session& pd, Native_capabili
catch (Out_of_ram) { ram_upgrade = Ram_quota { 2*1024*sizeof(long) }; }
catch (Out_of_caps) { cap_upgrade = Cap_quota { 4 }; }
env_deprecated()->parent()->upgrade(Parent::Env::pd(),
String<100>("ram_quota=", ram_upgrade, ", "
"cap_quota=", cap_upgrade).string());
_parent().upgrade(Parent::Env::pd(),
String<100>("ram_quota=", ram_upgrade, ", "
"cap_quota=", cap_upgrade).string());
}
return Thread::native_thread().epoll.alloc_rpc_cap();

View File

@ -19,12 +19,18 @@
#include <rpc_cap_factory.h>
#include <imprint_badge.h>
using namespace Core;
/* base-internal includes */
#include <base/internal/globals.h>
using namespace Genode;
static Rpc_cap_factory &rpc_cap_factory()
void Genode::init_rpc_cap_alloc(Parent &) { }
static Core::Rpc_cap_factory &rpc_cap_factory()
{
static Rpc_cap_factory inst(platform().core_mem_alloc());
static Core::Rpc_cap_factory inst(Core::platform().core_mem_alloc());
return inst;
}

View File

@ -16,7 +16,6 @@
#include <util/retry.h>
#include <base/rpc_server.h>
#include <pd_session/client.h>
#include <deprecated/env.h>
/* base-internal includes */
#include <base/internal/globals.h>
@ -27,6 +26,20 @@
using namespace Genode;
static Parent *_parent_ptr;
static Parent &_parent()
{
if (_parent_ptr)
return *_parent_ptr;
error("missing call of init_rpc_cap_alloc");
for (;;);
}
void Genode::init_rpc_cap_alloc(Parent &parent) { _parent_ptr = &parent; }
Native_capability Rpc_entrypoint::_alloc_rpc_cap(Pd_session &pd, Native_capability ep,
addr_t entry)
{
@ -48,9 +61,9 @@ Native_capability Rpc_entrypoint::_alloc_rpc_cap(Pd_session &pd, Native_capabili
catch (Out_of_ram) { ram_upgrade = Ram_quota { 2*1024*sizeof(long) }; }
catch (Out_of_caps) { cap_upgrade = Cap_quota { 4 }; }
env_deprecated()->parent()->upgrade(Parent::Env::pd(),
String<100>("ram_quota=", ram_upgrade, ", "
"cap_quota=", cap_upgrade).string());
_parent().upgrade(Parent::Env::pd(),
String<100>("ram_quota=", ram_upgrade, ", "
"cap_quota=", cap_upgrade).string());
}
}

View File

@ -18,12 +18,18 @@
#include <platform_generic.h>
#include <rpc_cap_factory.h>
using namespace Core;
/* base-internal includes */
#include <base/internal/globals.h>
using namespace Genode;
static Rpc_cap_factory &rpc_cap_factory()
void Genode::init_rpc_cap_alloc(Parent &) { }
static Core::Rpc_cap_factory &rpc_cap_factory()
{
static Rpc_cap_factory inst(platform().core_mem_alloc());
static Core::Rpc_cap_factory inst(Core::platform().core_mem_alloc());
return inst;
}

View File

@ -38,6 +38,7 @@ namespace Genode {
void init_root_proxy(Env &);
void init_tracing(Env &);
void init_log(Parent &);
void init_rpc_cap_alloc(Parent &);
void init_parent_resource_requests(Env &);
void init_heartbeat_monitoring(Env &);
void deinit_heartbeat_monitoring();

View File

@ -16,11 +16,27 @@
#include <util/retry.h>
#include <base/rpc_server.h>
#include <pd_session/client.h>
#include <deprecated/env.h>
/* base-internal includes */
#include <base/internal/globals.h>
using namespace Genode;
static Parent *_parent_ptr;
static Parent &_parent()
{
if (_parent_ptr)
return *_parent_ptr;
error("missing call of init_rpc_cap_alloc");
for (;;);
}
void Genode::init_rpc_cap_alloc(Parent &parent) { _parent_ptr = &parent; }
Native_capability Rpc_entrypoint::_alloc_rpc_cap(Pd_session &pd,
Native_capability, addr_t)
{
@ -33,9 +49,9 @@ Native_capability Rpc_entrypoint::_alloc_rpc_cap(Pd_session &pd,
catch (Out_of_ram) { ram_upgrade = Ram_quota { 2*1024*sizeof(long) }; }
catch (Out_of_caps) { cap_upgrade = Cap_quota { 4 }; }
env_deprecated()->parent()->upgrade(Parent::Env::pd(),
String<100>("ram_quota=", ram_upgrade, ", "
"cap_quota=", cap_upgrade).string());
_parent().upgrade(Parent::Env::pd(),
String<100>("ram_quota=", ram_upgrade, ", "
"cap_quota=", cap_upgrade).string());
}
}

View File

@ -99,6 +99,7 @@ extern "C" void init_main_thread()
*/
(void)env_deprecated();
init_log(*env_deprecated()->parent());
init_rpc_cap_alloc(*env_deprecated()->parent());
/* create a thread object for the main thread */
main_thread();