mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-01 23:20:55 +00:00
parent
de99945af0
commit
7e1a2ac684
@ -28,11 +28,11 @@
|
|||||||
|
|
||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
|
|
||||||
static Pd_session *_pd_ptr;
|
static Env *_env_ptr;
|
||||||
static Pd_session &pd()
|
static Env &env()
|
||||||
{
|
{
|
||||||
if (_pd_ptr)
|
if (_env_ptr)
|
||||||
return *_pd_ptr;
|
return *_env_ptr;
|
||||||
|
|
||||||
class Missing_init_signal_thread { };
|
class Missing_init_signal_thread { };
|
||||||
throw Missing_init_signal_thread();
|
throw Missing_init_signal_thread();
|
||||||
@ -43,14 +43,16 @@ static Pd_session &pd()
|
|||||||
* On base-hw, we don't use a signal thread. We mereely save the PD session
|
* On base-hw, we don't use a signal thread. We mereely save the PD session
|
||||||
* pointer of the passed 'env' argument.
|
* pointer of the passed 'env' argument.
|
||||||
*/
|
*/
|
||||||
void Genode::init_signal_thread(Env &env) { _pd_ptr = &env.pd(); }
|
void Genode::init_signal_thread(Env &env) { _env_ptr = &env; }
|
||||||
|
|
||||||
|
|
||||||
void Genode::destroy_signal_thread() { }
|
void Genode::destroy_signal_thread() { }
|
||||||
|
|
||||||
|
|
||||||
void Genode::init_signal_receiver(Pd_session &, Parent &) { }
|
void Genode::init_signal_receiver(Pd_session &, Parent &) { }
|
||||||
|
|
||||||
|
|
||||||
Signal_receiver::Signal_receiver() : _pd(pd())
|
Signal_receiver::Signal_receiver() : _pd(env().pd())
|
||||||
{
|
{
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
||||||
@ -58,15 +60,15 @@ Signal_receiver::Signal_receiver() : _pd(pd())
|
|||||||
Cap_quota cap_upgrade { 0 };
|
Cap_quota cap_upgrade { 0 };
|
||||||
|
|
||||||
try {
|
try {
|
||||||
_cap = pd().alloc_signal_source();
|
_cap = env().pd().alloc_signal_source();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
catch (Out_of_ram) { ram_upgrade = Ram_quota { 2*1024*sizeof(long) }; }
|
catch (Out_of_ram) { ram_upgrade = Ram_quota { 2*1024*sizeof(long) }; }
|
||||||
catch (Out_of_caps) { cap_upgrade = Cap_quota { 4 }; }
|
catch (Out_of_caps) { cap_upgrade = Cap_quota { 4 }; }
|
||||||
|
|
||||||
internal_env().upgrade(Parent::Env::pd(),
|
env().upgrade(Parent::Env::pd(),
|
||||||
String<100>("ram_quota=", ram_upgrade, ", "
|
String<100>("ram_quota=", ram_upgrade, ", "
|
||||||
"cap_quota=", cap_upgrade).string());
|
"cap_quota=", cap_upgrade).string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +76,7 @@ Signal_receiver::Signal_receiver() : _pd(pd())
|
|||||||
void Signal_receiver::_platform_destructor()
|
void Signal_receiver::_platform_destructor()
|
||||||
{
|
{
|
||||||
/* release server resources of receiver */
|
/* release server resources of receiver */
|
||||||
pd().free_signal_source(_cap);
|
env().pd().free_signal_source(_cap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -112,7 +114,7 @@ Signal_context_capability Signal_receiver::manage(Signal_context * const c)
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
/* use signal context as imprint */
|
/* use signal context as imprint */
|
||||||
c->_cap = pd().alloc_context(_cap, (unsigned long)c);
|
c->_cap = env().pd().alloc_context(_cap, (unsigned long)c);
|
||||||
c->_receiver = this;
|
c->_receiver = this;
|
||||||
_contexts.insert_as_tail(c);
|
_contexts.insert_as_tail(c);
|
||||||
return c->_cap;
|
return c->_cap;
|
||||||
@ -120,9 +122,9 @@ Signal_context_capability Signal_receiver::manage(Signal_context * const c)
|
|||||||
catch (Out_of_ram) { ram_upgrade = Ram_quota { 1024*sizeof(long) }; }
|
catch (Out_of_ram) { ram_upgrade = Ram_quota { 1024*sizeof(long) }; }
|
||||||
catch (Out_of_caps) { cap_upgrade = Cap_quota { 4 }; }
|
catch (Out_of_caps) { cap_upgrade = Cap_quota { 4 }; }
|
||||||
|
|
||||||
internal_env().upgrade(Parent::Env::pd(),
|
env().upgrade(Parent::Env::pd(),
|
||||||
String<100>("ram_quota=", ram_upgrade, ", "
|
String<100>("ram_quota=", ram_upgrade, ", "
|
||||||
"cap_quota=", cap_upgrade).string());
|
"cap_quota=", cap_upgrade).string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
#include <base/internal/parent_socket_handle.h>
|
#include <base/internal/parent_socket_handle.h>
|
||||||
#include <base/internal/capability_space_tpl.h>
|
#include <base/internal/capability_space_tpl.h>
|
||||||
|
|
||||||
#include <deprecated/env.h>
|
|
||||||
|
|
||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
|
|
||||||
|
|
||||||
@ -134,36 +132,6 @@ static unsigned long get_env_ulong(const char *key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Platform *_platform_ptr;
|
|
||||||
|
|
||||||
|
|
||||||
Env_deprecated *Genode::env_deprecated()
|
|
||||||
{
|
|
||||||
if (!_platform_ptr) {
|
|
||||||
error("missing call of init_platform");
|
|
||||||
for (;;);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Impl : Env_deprecated, Noncopyable
|
|
||||||
{
|
|
||||||
Platform &_pf;
|
|
||||||
|
|
||||||
Impl(Platform &pf) : _pf(pf) { }
|
|
||||||
|
|
||||||
Parent *parent() override { return &_pf.parent; }
|
|
||||||
Cpu_session *cpu_session() override { return &_pf.cpu; }
|
|
||||||
Cpu_session_capability cpu_session_cap() override { return _pf.cpu.rpc_cap(); }
|
|
||||||
Region_map *rm_session() override { return &_pf.rm; }
|
|
||||||
Pd_session *pd_session() override { return &_pf.pd; }
|
|
||||||
Pd_session_capability pd_session_cap() override { return _pf.pd.rpc_cap(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
static Impl impl { *_platform_ptr };
|
|
||||||
|
|
||||||
return &impl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Capability<Parent> Platform::_obtain_parent_cap()
|
Capability<Parent> Platform::_obtain_parent_cap()
|
||||||
{
|
{
|
||||||
long const local_name = get_env_ulong("parent_local_name");
|
long const local_name = get_env_ulong("parent_local_name");
|
||||||
@ -196,8 +164,6 @@ Platform &Genode::init_platform()
|
|||||||
init_exception_handling(platform.pd, platform.rm);
|
init_exception_handling(platform.pd, platform.rm);
|
||||||
init_signal_receiver(platform.pd, platform.parent);
|
init_signal_receiver(platform.pd, platform.parent);
|
||||||
|
|
||||||
_platform_ptr = &platform;
|
|
||||||
|
|
||||||
return platform;
|
return platform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,91 +0,0 @@
|
|||||||
/*
|
|
||||||
* \brief Environment of a component
|
|
||||||
* \author Norman Feske
|
|
||||||
* \date 2006-07-01
|
|
||||||
*
|
|
||||||
* \deprecated This interface will be removed once all components are
|
|
||||||
* adjusted to the new API of base/component.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _INCLUDE__DEPRECATED__ENV_H_
|
|
||||||
#define _INCLUDE__DEPRECATED__ENV_H_
|
|
||||||
|
|
||||||
#include <parent/capability.h>
|
|
||||||
#include <parent/parent.h>
|
|
||||||
#include <region_map/region_map.h>
|
|
||||||
#include <cpu_session/cpu_session.h>
|
|
||||||
#include <cpu_session/capability.h>
|
|
||||||
#include <pd_session/capability.h>
|
|
||||||
#include <base/allocator.h>
|
|
||||||
|
|
||||||
namespace Genode {
|
|
||||||
|
|
||||||
struct Env_deprecated;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the interface to the component's environment
|
|
||||||
*
|
|
||||||
* \noapi
|
|
||||||
* \deprecated
|
|
||||||
*/
|
|
||||||
extern Env_deprecated *env_deprecated();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the interface to the component's environment
|
|
||||||
*
|
|
||||||
* \deprecated
|
|
||||||
*/
|
|
||||||
static inline Env_deprecated *env() __attribute__((deprecated));
|
|
||||||
static inline Env_deprecated *env()
|
|
||||||
{
|
|
||||||
return env_deprecated();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Component runtime environment
|
|
||||||
*
|
|
||||||
* The environment of a Genode component is defined by its parent. The 'Env'
|
|
||||||
* class allows the component to interact with its environment. It is
|
|
||||||
* initialized at the startup of the component.
|
|
||||||
*/
|
|
||||||
struct Genode::Env_deprecated : Interface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Communication channel to our parent
|
|
||||||
*/
|
|
||||||
virtual Parent *parent() = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CPU session of the component
|
|
||||||
*
|
|
||||||
* This session is used to create the threads of the component.
|
|
||||||
*/
|
|
||||||
virtual Cpu_session *cpu_session() = 0;
|
|
||||||
virtual Cpu_session_capability cpu_session_cap() = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Region-manager session of the component as created by the parent
|
|
||||||
*
|
|
||||||
* \deprecated This function exists for API compatibility only.
|
|
||||||
* The functionality of the former RM service is now
|
|
||||||
* provided by the 'Region_map' interface.
|
|
||||||
*/
|
|
||||||
virtual Region_map *rm_session() = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PD session of the component as created by the parent
|
|
||||||
*/
|
|
||||||
virtual Pd_session *pd_session() = 0;
|
|
||||||
virtual Pd_session_capability pd_session_cap() = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* _INCLUDE__DEPRECATED__ENV_H_ */
|
|
@ -122,7 +122,6 @@ _ZN6Genode14Signal_contextD0Ev T
|
|||||||
_ZN6Genode14Signal_contextD1Ev T
|
_ZN6Genode14Signal_contextD1Ev T
|
||||||
_ZN6Genode14Signal_contextD2Ev T
|
_ZN6Genode14Signal_contextD2Ev T
|
||||||
_ZN6Genode14cache_coherentEmm T
|
_ZN6Genode14cache_coherentEmm T
|
||||||
_ZN6Genode14env_deprecatedEv T
|
|
||||||
_ZN6Genode14ipc_reply_waitERKNS_17Native_capabilityENS_18Rpc_exception_codeERNS_11Msgbuf_baseES5_ T
|
_ZN6Genode14ipc_reply_waitERKNS_17Native_capabilityENS_18Rpc_exception_codeERNS_11Msgbuf_baseES5_ T
|
||||||
_ZN6Genode15Signal_receiver12local_submitENS_6Signal4DataE T
|
_ZN6Genode15Signal_receiver12local_submitENS_6Signal4DataE T
|
||||||
_ZN6Genode15Signal_receiver14pending_signalEv T
|
_ZN6Genode15Signal_receiver14pending_signalEv T
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
/* Genode includes */
|
/* Genode includes */
|
||||||
#include <base/env.h>
|
#include <base/env.h>
|
||||||
#include <deprecated/env.h>
|
|
||||||
|
|
||||||
/* base-internal includes */
|
/* base-internal includes */
|
||||||
#include <base/internal/globals.h>
|
#include <base/internal/globals.h>
|
||||||
@ -36,7 +35,7 @@ namespace Core {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class Core::Core_env : public Env_deprecated, Noncopyable
|
class Core::Core_env : public Noncopyable
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -87,16 +86,12 @@ class Core::Core_env : public Env_deprecated, Noncopyable
|
|||||||
|
|
||||||
Rpc_entrypoint &signal_ep();
|
Rpc_entrypoint &signal_ep();
|
||||||
|
|
||||||
/******************************
|
Parent *parent() { return nullptr; }
|
||||||
** Env_deprecated interface **
|
Region_map *rm_session() { return &_region_map; }
|
||||||
******************************/
|
Pd_session *pd_session() { return &_pd_session; }
|
||||||
|
Cpu_session *cpu_session() { ASSERT_NEVER_CALLED; }
|
||||||
Parent *parent() override { return nullptr; }
|
Cpu_session_capability cpu_session_cap() { ASSERT_NEVER_CALLED; }
|
||||||
Region_map *rm_session() override { return &_region_map; }
|
Pd_session_capability pd_session_cap() { return _pd_session.cap(); }
|
||||||
Pd_session *pd_session() override { return &_pd_session; }
|
|
||||||
Cpu_session *cpu_session() override { ASSERT_NEVER_CALLED; }
|
|
||||||
Cpu_session_capability cpu_session_cap() override { ASSERT_NEVER_CALLED; }
|
|
||||||
Pd_session_capability pd_session_cap() override { return _pd_session.cap(); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _CORE__INCLUDE__CORE_ENV_H_ */
|
#endif /* _CORE__INCLUDE__CORE_ENV_H_ */
|
||||||
|
@ -74,10 +74,6 @@ Core_env &Core::core_env()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Env_deprecated *Genode::env_deprecated() {
|
|
||||||
return &core_env(); }
|
|
||||||
|
|
||||||
|
|
||||||
Core::Platform &Core::platform_specific()
|
Core::Platform &Core::platform_specific()
|
||||||
{
|
{
|
||||||
static Platform _platform;
|
static Platform _platform;
|
||||||
|
@ -57,7 +57,6 @@ namespace Genode {
|
|||||||
void cxx_free_tls(void *thread);
|
void cxx_free_tls(void *thread);
|
||||||
|
|
||||||
Id_space<Parent::Client> &env_session_id_space();
|
Id_space<Parent::Client> &env_session_id_space();
|
||||||
Env &internal_env();
|
|
||||||
|
|
||||||
void prepare_init_main_thread();
|
void prepare_init_main_thread();
|
||||||
void bootstrap_component(Platform &);
|
void bootstrap_component(Platform &);
|
||||||
|
@ -18,18 +18,11 @@
|
|||||||
#include <base/connection.h>
|
#include <base/connection.h>
|
||||||
#include <base/service.h>
|
#include <base/service.h>
|
||||||
#include <base/env.h>
|
#include <base/env.h>
|
||||||
#include <deprecated/env.h>
|
|
||||||
|
|
||||||
/* base-internal includes */
|
/* base-internal includes */
|
||||||
#include <base/internal/globals.h>
|
#include <base/internal/globals.h>
|
||||||
#include <base/internal/platform.h>
|
#include <base/internal/platform.h>
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* XXX remove this pointer once 'Env_deprecated' is removed
|
|
||||||
*/
|
|
||||||
static Genode::Env *env_ptr = nullptr;
|
|
||||||
|
|
||||||
namespace Genode { struct Component_env; }
|
namespace Genode { struct Component_env; }
|
||||||
|
|
||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
@ -86,9 +79,7 @@ struct Genode::Component_env : Env
|
|||||||
Component_env(Platform &platform, Entrypoint &ep)
|
Component_env(Platform &platform, Entrypoint &ep)
|
||||||
:
|
:
|
||||||
_platform(platform), _ep(ep)
|
_platform(platform), _ep(ep)
|
||||||
{
|
{ }
|
||||||
env_ptr = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
Parent &parent() override { return _parent; }
|
Parent &parent() override { return _parent; }
|
||||||
Cpu_session &cpu() override { return _cpu; }
|
Cpu_session &cpu() override { return _cpu; }
|
||||||
@ -222,23 +213,6 @@ struct Genode::Component_env : Env
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
namespace Genode {
|
|
||||||
|
|
||||||
struct Startup;
|
|
||||||
|
|
||||||
extern void bootstrap_component();
|
|
||||||
|
|
||||||
Env &internal_env()
|
|
||||||
{
|
|
||||||
class Env_ptr_not_initialized { };
|
|
||||||
if (!env_ptr)
|
|
||||||
throw Env_ptr_not_initialized();
|
|
||||||
|
|
||||||
return *env_ptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
size_t Component::stack_size() __attribute__((weak));
|
size_t Component::stack_size() __attribute__((weak));
|
||||||
size_t Component::stack_size() { return 64*1024; }
|
size_t Component::stack_size() { return 64*1024; }
|
||||||
|
|
||||||
@ -259,6 +233,9 @@ void Genode::init_ldso_phdr(Env &) { }
|
|||||||
* We need to execute the constructor of the main entrypoint from a
|
* We need to execute the constructor of the main entrypoint from a
|
||||||
* class called 'Startup' as 'Startup' is a friend of 'Entrypoint'.
|
* class called 'Startup' as 'Startup' is a friend of 'Entrypoint'.
|
||||||
*/
|
*/
|
||||||
|
namespace Genode { struct Startup; }
|
||||||
|
|
||||||
|
|
||||||
struct Genode::Startup
|
struct Genode::Startup
|
||||||
{
|
{
|
||||||
Component_env env;
|
Component_env env;
|
||||||
|
@ -12,42 +12,10 @@
|
|||||||
* under the terms of the GNU Affero General Public License version 3.
|
* under the terms of the GNU Affero General Public License version 3.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <deprecated/env.h>
|
|
||||||
#include <base/internal/platform.h>
|
#include <base/internal/platform.h>
|
||||||
#include <base/connection.h>
|
|
||||||
#include <base/service.h>
|
|
||||||
|
|
||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
|
|
||||||
static Platform *_platform_ptr;
|
|
||||||
|
|
||||||
|
|
||||||
Env_deprecated *Genode::env_deprecated()
|
|
||||||
{
|
|
||||||
if (!_platform_ptr) {
|
|
||||||
error("missing call of init_platform");
|
|
||||||
for (;;);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Impl : Env_deprecated, Noncopyable
|
|
||||||
{
|
|
||||||
Platform &_pf;
|
|
||||||
|
|
||||||
Impl(Platform &pf) : _pf(pf) { }
|
|
||||||
|
|
||||||
Parent *parent() override { return &_pf.parent; }
|
|
||||||
Cpu_session *cpu_session() override { return &_pf.cpu; }
|
|
||||||
Cpu_session_capability cpu_session_cap() override { return _pf.cpu.rpc_cap(); }
|
|
||||||
Region_map *rm_session() override { return &_pf.rm; }
|
|
||||||
Pd_session *pd_session() override { return &_pf.pd; }
|
|
||||||
Pd_session_capability pd_session_cap() override { return _pf.pd.rpc_cap(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
static Impl impl { *_platform_ptr };
|
|
||||||
|
|
||||||
return &impl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Genode::init_parent_resource_requests(Genode::Env &env)
|
void Genode::init_parent_resource_requests(Genode::Env &env)
|
||||||
{
|
{
|
||||||
@ -68,8 +36,6 @@ Platform &Genode::init_platform()
|
|||||||
init_thread_bootstrap(platform.cpu, platform.parent.main_thread_cap());
|
init_thread_bootstrap(platform.cpu, platform.parent.main_thread_cap());
|
||||||
init_signal_receiver(platform.pd, platform.parent);
|
init_signal_receiver(platform.pd, platform.parent);
|
||||||
|
|
||||||
_platform_ptr = &platform;
|
|
||||||
|
|
||||||
return platform;
|
return platform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user