Replace 'Env' interface with modern one
The original 'Env' interface as returned by 'Genode::env()' has been renamed to 'Env_deprecated' and moved to deprecated/env.h. The new version of base/env.h contains the interface passed to modern components that use the component API via base/component.h. Issue #1832
This commit is contained in:
parent
7274ca997d
commit
4f69772ecc
|
@ -197,9 +197,9 @@ namespace Genode {
|
||||||
Entrypoint *entrypoint() { return &_entrypoint; }
|
Entrypoint *entrypoint() { return &_entrypoint; }
|
||||||
|
|
||||||
|
|
||||||
/*******************
|
/******************************
|
||||||
** Env interface **
|
** Env_deprecated interface **
|
||||||
*******************/
|
******************************/
|
||||||
|
|
||||||
Parent *parent() override { return &_core_parent; }
|
Parent *parent() override { return &_core_parent; }
|
||||||
Ram_session *ram_session() override { return &_ram_session; }
|
Ram_session *ram_session() override { return &_ram_session; }
|
||||||
|
|
|
@ -60,7 +60,7 @@ struct Genode::Expanding_cpu_session_client
|
||||||
* Common base class of the 'Platform_env' implementations for core and
|
* Common base class of the 'Platform_env' implementations for core and
|
||||||
* non-core processes.
|
* non-core processes.
|
||||||
*/
|
*/
|
||||||
class Genode::Platform_env_base : public Env
|
class Genode::Platform_env_base : public Env_deprecated
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -389,9 +389,9 @@ class Genode::Platform_env_base : public Env
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|
||||||
/*******************
|
/******************************
|
||||||
** Env interface **
|
** Env_deprecated interface **
|
||||||
*******************/
|
******************************/
|
||||||
|
|
||||||
Ram_session *ram_session() override { return &_ram_session_client; }
|
Ram_session *ram_session() override { return &_ram_session_client; }
|
||||||
Ram_session_capability ram_session_cap() override { return _ram_session_cap; }
|
Ram_session_capability ram_session_cap() override { return _ram_session_cap; }
|
||||||
|
@ -499,9 +499,9 @@ class Genode::Platform_env : public Platform_env_base, public Emergency_ram_rese
|
||||||
void release() { ram_session()->free(_emergency_ram_ds); }
|
void release() { ram_session()->free(_emergency_ram_ds); }
|
||||||
|
|
||||||
|
|
||||||
/*******************
|
/******************************
|
||||||
** Env interface **
|
** Env_deprecated interface **
|
||||||
*******************/
|
******************************/
|
||||||
|
|
||||||
Parent *parent() override { return &_parent(); }
|
Parent *parent() override { return &_parent(); }
|
||||||
Heap *heap() override { return &_heap; }
|
Heap *heap() override { return &_heap; }
|
||||||
|
|
|
@ -86,15 +86,15 @@ namespace Genode {
|
||||||
* component's entrypoint is activated.
|
* component's entrypoint is activated.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern void (*call_component_construct)(Genode::Environment &) __attribute__((weak));
|
extern void (*call_component_construct)(Genode::Env &) __attribute__((weak));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lx_hybrid_component_construct(Genode::Environment &env)
|
static void lx_hybrid_component_construct(Genode::Env &env)
|
||||||
{
|
{
|
||||||
Component::construct(env);
|
Component::construct(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
void (*Genode::call_component_construct)(Genode::Environment &) = &lx_hybrid_component_construct;
|
void (*Genode::call_component_construct)(Genode::Env &) = &lx_hybrid_component_construct;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Static constructors are handled by the Linux startup code - so implement
|
* Static constructors are handled by the Linux startup code - so implement
|
||||||
|
|
|
@ -51,7 +51,7 @@ char const * Component::name() { return "lx_hybrid_ctors"; }
|
||||||
/*
|
/*
|
||||||
* Component implements classical main function in construct.
|
* Component implements classical main function in construct.
|
||||||
*/
|
*/
|
||||||
void Component::construct(Genode::Environment &env)
|
void Component::construct(Genode::Env &env)
|
||||||
{
|
{
|
||||||
printf("--- lx_hybrid global static constructor test ---\n");
|
printf("--- lx_hybrid global static constructor test ---\n");
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ struct Unexpected_errno_change { };
|
||||||
/*
|
/*
|
||||||
* Component implements classical main function in construct.
|
* Component implements classical main function in construct.
|
||||||
*/
|
*/
|
||||||
void Component::construct(Genode::Environment &env)
|
void Component::construct(Genode::Env &env)
|
||||||
{
|
{
|
||||||
Genode::printf("--- thread-local errno test ---\n");
|
Genode::printf("--- thread-local errno test ---\n");
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ char const * Component::name() { return "lx_hybrid_exception"; }
|
||||||
/*
|
/*
|
||||||
* Component implements classical main function in construct.
|
* Component implements classical main function in construct.
|
||||||
*/
|
*/
|
||||||
void Component::construct(Genode::Environment &env)
|
void Component::construct(Genode::Env &env)
|
||||||
{
|
{
|
||||||
printf("--- lx_hybrid exception test ---\n");
|
printf("--- lx_hybrid exception test ---\n");
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ char const * Component::name() { return "lx_hybrid_pthread_ipc"; }
|
||||||
/*
|
/*
|
||||||
* Component implements classical main function in construct.
|
* Component implements classical main function in construct.
|
||||||
*/
|
*/
|
||||||
void Component::construct(Genode::Environment &env)
|
void Component::construct(Genode::Env &env)
|
||||||
{
|
{
|
||||||
Genode::printf("--- pthread IPC test ---\n");
|
Genode::printf("--- pthread IPC test ---\n");
|
||||||
|
|
||||||
|
|
|
@ -14,16 +14,10 @@
|
||||||
#ifndef _INCLUDE__BASE__COMPONENT_H_
|
#ifndef _INCLUDE__BASE__COMPONENT_H_
|
||||||
#define _INCLUDE__BASE__COMPONENT_H_
|
#define _INCLUDE__BASE__COMPONENT_H_
|
||||||
|
|
||||||
|
#include <base/env.h>
|
||||||
#include <base/stdint.h>
|
#include <base/stdint.h>
|
||||||
#include <parent/parent.h>
|
|
||||||
#include <base/entrypoint.h>
|
|
||||||
#include <ram_session/capability.h>
|
|
||||||
#include <cpu_session/capability.h>
|
|
||||||
#include <rm_session/rm_session.h>
|
|
||||||
#include <pd_session/pd_session.h>
|
|
||||||
|
|
||||||
|
namespace Genode { struct Env; }
|
||||||
namespace Genode { struct Environment; }
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,48 +25,22 @@ namespace Genode { struct Environment; }
|
||||||
*/
|
*/
|
||||||
namespace Component
|
namespace Component
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Return stack size of the component's initial entrypoint
|
||||||
|
*/
|
||||||
Genode::size_t stack_size();
|
Genode::size_t stack_size();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return component name
|
||||||
|
*/
|
||||||
char const *name();
|
char const *name();
|
||||||
void construct(Genode::Environment &);
|
|
||||||
|
/**
|
||||||
|
* Construct component
|
||||||
|
*
|
||||||
|
* \param env interface to the component's execution environment
|
||||||
|
*/
|
||||||
|
void construct(Genode::Env &env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct Genode::Environment
|
|
||||||
{
|
|
||||||
virtual Parent &parent() = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* RAM session of the component
|
|
||||||
*
|
|
||||||
* The RAM Session represents a budget of memory (quota) that is available
|
|
||||||
* to the component. This budget can be used to allocate RAM dataspaces.
|
|
||||||
*/
|
|
||||||
virtual Ram_session &ram() = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CPU session of the component
|
|
||||||
*
|
|
||||||
* This session is used to create the threads of the component.
|
|
||||||
*/
|
|
||||||
virtual Cpu_session &cpu() = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Region map of the component's address space
|
|
||||||
*/
|
|
||||||
virtual Region_map &rm() = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PD session of the component as created by the parent
|
|
||||||
*/
|
|
||||||
virtual Pd_session &pd() = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Entrypoint for handling RPC requests and signals
|
|
||||||
*/
|
|
||||||
virtual Entrypoint &ep() = 0;
|
|
||||||
|
|
||||||
virtual Ram_session_capability ram_session_cap() = 0;
|
|
||||||
virtual Cpu_session_capability cpu_session_cap() = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* _INCLUDE__BASE__COMPONENT_H_ */
|
#endif /* _INCLUDE__BASE__COMPONENT_H_ */
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
namespace Genode {
|
namespace Genode {
|
||||||
class Startup;
|
class Startup;
|
||||||
class Entrypoint;
|
class Entrypoint;
|
||||||
class Environment;
|
class Env;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class Genode::Entrypoint : Genode::Noncopyable
|
||||||
void entry() override { ep._process_incoming_signals(); }
|
void entry() override { ep._process_incoming_signals(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
Environment &_env;
|
Env &_env;
|
||||||
|
|
||||||
Volatile_object<Rpc_entrypoint> _rpc_ep;
|
Volatile_object<Rpc_entrypoint> _rpc_ep;
|
||||||
|
|
||||||
|
@ -100,11 +100,11 @@ class Genode::Entrypoint : Genode::Noncopyable
|
||||||
/**
|
/**
|
||||||
* Called by the startup code only
|
* Called by the startup code only
|
||||||
*/
|
*/
|
||||||
Entrypoint(Environment &env);
|
Entrypoint(Env &env);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Entrypoint(Environment &env, size_t stack_size, char const *name);
|
Entrypoint(Env &env, size_t stack_size, char const *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Associate RPC object with the entry point
|
* Associate RPC object with the entry point
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/*
|
/*
|
||||||
* \brief Environment of a component
|
* \brief Component environment
|
||||||
* \author Norman Feske
|
* \author Norman Feske
|
||||||
* \date 2006-07-01
|
* \date 2015-12-17
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2006-2013 Genode Labs GmbH
|
* Copyright (C) 2015 Genode Labs GmbH
|
||||||
*
|
*
|
||||||
* This file is part of the Genode OS framework, which is distributed
|
* This file is part of the Genode OS framework, which is distributed
|
||||||
* under the terms of the GNU General Public License version 2.
|
* under the terms of the GNU General Public License version 2.
|
||||||
|
@ -14,111 +14,56 @@
|
||||||
#ifndef _INCLUDE__BASE__ENV_H_
|
#ifndef _INCLUDE__BASE__ENV_H_
|
||||||
#define _INCLUDE__BASE__ENV_H_
|
#define _INCLUDE__BASE__ENV_H_
|
||||||
|
|
||||||
#include <parent/capability.h>
|
|
||||||
#include <parent/parent.h>
|
#include <parent/parent.h>
|
||||||
#include <region_map/region_map.h>
|
#include <base/entrypoint.h>
|
||||||
#include <rm_session/rm_session.h> /* deprecated, kept for API compatibility only */
|
#include <ram_session/capability.h>
|
||||||
#include <ram_session/ram_session.h>
|
|
||||||
#include <cpu_session/cpu_session.h>
|
|
||||||
#include <cpu_session/capability.h>
|
#include <cpu_session/capability.h>
|
||||||
#include <pd_session/capability.h>
|
#include <rm_session/rm_session.h>
|
||||||
#include <base/allocator.h>
|
#include <pd_session/pd_session.h>
|
||||||
#include <base/snprintf.h>
|
|
||||||
#include <base/lock.h>
|
|
||||||
|
|
||||||
namespace Genode {
|
/* maintain compatibility to deprecated API */
|
||||||
|
#include <deprecated/env.h>
|
||||||
struct Env;
|
|
||||||
|
|
||||||
/**
|
namespace Genode { struct Env; }
|
||||||
* Return the interface to the component's environment
|
|
||||||
*/
|
|
||||||
extern Env *env();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
struct Genode::Env
|
||||||
{
|
{
|
||||||
virtual ~Env() { }
|
virtual Parent &parent() = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* Communication channel to our parent
|
|
||||||
*/
|
|
||||||
virtual Parent *parent() = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RAM session of the component
|
* RAM session of the component
|
||||||
*
|
*
|
||||||
* The RAM Session represents a budget of memory (quota) that is
|
* The RAM Session represents a budget of memory (quota) that is available
|
||||||
* available to the component. This budget can be used to allocate
|
* to the component. This budget can be used to allocate RAM dataspaces.
|
||||||
* RAM dataspaces.
|
|
||||||
*/
|
*/
|
||||||
virtual Ram_session *ram_session() = 0;
|
virtual Ram_session &ram() = 0;
|
||||||
virtual Ram_session_capability ram_session_cap() = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CPU session of the component
|
* CPU session of the component
|
||||||
*
|
*
|
||||||
* This session is used to create the threads of the component.
|
* This session is used to create the threads of the component.
|
||||||
*/
|
*/
|
||||||
virtual Cpu_session *cpu_session() = 0;
|
virtual Cpu_session &cpu() = 0;
|
||||||
virtual Cpu_session_capability cpu_session_cap() = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Region-manager session of the component as created by the parent
|
* Region map of the component's address space
|
||||||
*
|
|
||||||
* \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;
|
virtual Region_map &rm() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PD session of the component as created by the parent
|
* PD session of the component as created by the parent
|
||||||
*/
|
*/
|
||||||
virtual Pd_session *pd_session() = 0;
|
virtual Pd_session &pd() = 0;
|
||||||
virtual Pd_session_capability pd_session_cap() = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Heap backed by the RAM session of the environment
|
* Entrypoint for handling RPC requests and signals
|
||||||
*/
|
*/
|
||||||
virtual Allocator *heap() = 0;
|
virtual Entrypoint &ep() = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* Reload parent capability and reinitialize environment resources
|
|
||||||
*
|
|
||||||
* This function is solely used for implementing fork semantics.
|
|
||||||
* After forking a process, the new child process is executed
|
|
||||||
* within a copy of the address space of the forking process.
|
|
||||||
* Thereby, the new process inherits the original 'env' object of
|
|
||||||
* the forking process, which is meaningless in the context of the
|
|
||||||
* new process. By calling this function, the new process is able
|
|
||||||
* to reinitialize its 'env' with meaningful capabilities obtained
|
|
||||||
* via its updated parent capability.
|
|
||||||
*
|
|
||||||
* \noapi
|
|
||||||
*/
|
|
||||||
virtual void reinit(Native_capability::Dst, long) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reinitialize main-thread object
|
|
||||||
*
|
|
||||||
* \param stack_area_rm new RM session of the stack area
|
|
||||||
*
|
|
||||||
* This function is solely used for implementing fork semantics
|
|
||||||
* as provided by the Noux environment.
|
|
||||||
*
|
|
||||||
* \noapi
|
|
||||||
*/
|
|
||||||
virtual void reinit_main_thread(Capability<Region_map> &stack_area_rm) = 0;
|
|
||||||
|
|
||||||
|
virtual Ram_session_capability ram_session_cap() = 0;
|
||||||
|
virtual Cpu_session_capability cpu_session_cap() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _INCLUDE__BASE__ENV_H_ */
|
#endif /* _INCLUDE__BASE__ENV_H_ */
|
||||||
|
|
125
repos/base/include/deprecated/env.h
Normal file
125
repos/base/include/deprecated/env.h
Normal file
|
@ -0,0 +1,125 @@
|
||||||
|
/*
|
||||||
|
* \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-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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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 <rm_session/rm_session.h> /* deprecated, kept for API compatibility only */
|
||||||
|
#include <ram_session/ram_session.h>
|
||||||
|
#include <cpu_session/cpu_session.h>
|
||||||
|
#include <cpu_session/capability.h>
|
||||||
|
#include <pd_session/capability.h>
|
||||||
|
#include <base/allocator.h>
|
||||||
|
#include <base/snprintf.h>
|
||||||
|
#include <base/lock.h>
|
||||||
|
|
||||||
|
namespace Genode {
|
||||||
|
|
||||||
|
struct Env_deprecated;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the interface to the component's environment
|
||||||
|
*/
|
||||||
|
extern Env_deprecated *env();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Communication channel to our parent
|
||||||
|
*/
|
||||||
|
virtual Parent *parent() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RAM session of the component
|
||||||
|
*
|
||||||
|
* The RAM Session represents a budget of memory (quota) that is
|
||||||
|
* available to the component. This budget can be used to allocate
|
||||||
|
* RAM dataspaces.
|
||||||
|
*/
|
||||||
|
virtual Ram_session *ram_session() = 0;
|
||||||
|
virtual Ram_session_capability ram_session_cap() = 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Heap backed by the RAM session of the environment
|
||||||
|
*/
|
||||||
|
virtual Allocator *heap() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reload parent capability and reinitialize environment resources
|
||||||
|
*
|
||||||
|
* This function is solely used for implementing fork semantics.
|
||||||
|
* After forking a process, the new child process is executed
|
||||||
|
* within a copy of the address space of the forking process.
|
||||||
|
* Thereby, the new process inherits the original 'env' object of
|
||||||
|
* the forking process, which is meaningless in the context of the
|
||||||
|
* new process. By calling this function, the new process is able
|
||||||
|
* to reinitialize its 'env' with meaningful capabilities obtained
|
||||||
|
* via its updated parent capability.
|
||||||
|
*
|
||||||
|
* \noapi
|
||||||
|
*/
|
||||||
|
virtual void reinit(Native_capability::Dst, long) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reinitialize main-thread object
|
||||||
|
*
|
||||||
|
* \param stack_area_rm new RM session of the stack area
|
||||||
|
*
|
||||||
|
* This function is solely used for implementing fork semantics
|
||||||
|
* as provided by the Noux environment.
|
||||||
|
*
|
||||||
|
* \noapi
|
||||||
|
*/
|
||||||
|
virtual void reinit_main_thread(Capability<Region_map> &stack_area_rm) = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* _INCLUDE__DEPRECATED__ENV_H_ */
|
|
@ -19,11 +19,11 @@
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
struct Environment : Genode::Environment
|
struct Env : Genode::Env
|
||||||
{
|
{
|
||||||
Genode::Entrypoint &_ep;
|
Genode::Entrypoint &_ep;
|
||||||
|
|
||||||
Environment(Genode::Entrypoint &ep) : _ep(ep) { }
|
Env(Genode::Entrypoint &ep) : _ep(ep) { }
|
||||||
|
|
||||||
Genode::Parent &parent() override { return *Genode::env()->parent(); }
|
Genode::Parent &parent() override { return *Genode::env()->parent(); }
|
||||||
Genode::Ram_session &ram() override { return *Genode::env()->ram_session(); }
|
Genode::Ram_session &ram() override { return *Genode::env()->ram_session(); }
|
||||||
|
@ -59,7 +59,7 @@ namespace Genode {
|
||||||
*/
|
*/
|
||||||
struct Genode::Startup
|
struct Genode::Startup
|
||||||
{
|
{
|
||||||
::Environment env { ep };
|
::Env env { ep };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The construction of the main entrypoint does never return.
|
* The construction of the main entrypoint does never return.
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace Genode {
|
||||||
void init_signal_thread();
|
void init_signal_thread();
|
||||||
void destroy_signal_thread();
|
void destroy_signal_thread();
|
||||||
|
|
||||||
extern void (*call_component_construct)(Genode::Environment &);
|
extern void (*call_component_construct)(Genode::Env &);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,8 +133,8 @@ namespace {
|
||||||
|
|
||||||
struct Constructor_component : Rpc_object<Constructor, Constructor_component>
|
struct Constructor_component : Rpc_object<Constructor, Constructor_component>
|
||||||
{
|
{
|
||||||
Environment &env;
|
Env &env;
|
||||||
Constructor_component(Environment &env) : env(env) { }
|
Constructor_component(Env &env) : env(env) { }
|
||||||
|
|
||||||
void construct()
|
void construct()
|
||||||
{
|
{
|
||||||
|
@ -149,7 +149,7 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Entrypoint::Entrypoint(Environment &env)
|
Entrypoint::Entrypoint(Env &env)
|
||||||
:
|
:
|
||||||
_env(env),
|
_env(env),
|
||||||
_rpc_ep(&env.pd(), Component::stack_size(), Component::name())
|
_rpc_ep(&env.pd(), Component::stack_size(), Component::name())
|
||||||
|
@ -181,7 +181,7 @@ Entrypoint::Entrypoint(Environment &env)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Entrypoint::Entrypoint(Environment &env, size_t stack_size, char const *name)
|
Entrypoint::Entrypoint(Env &env, size_t stack_size, char const *name)
|
||||||
:
|
:
|
||||||
_env(env),
|
_env(env),
|
||||||
_rpc_ep(&env.pd(), stack_size, name)
|
_rpc_ep(&env.pd(), stack_size, name)
|
||||||
|
|
2
repos/base/src/base/env/env.cc
vendored
2
repos/base/src/base/env/env.cc
vendored
|
@ -19,7 +19,7 @@ namespace Genode {
|
||||||
/*
|
/*
|
||||||
* Request pointer to static environment of the Genode application
|
* Request pointer to static environment of the Genode application
|
||||||
*/
|
*/
|
||||||
Env *env()
|
Env_deprecated *env()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* By placing the environment as static object here, we ensure that its
|
* By placing the environment as static object here, we ensure that its
|
||||||
|
|
|
@ -110,7 +110,7 @@ namespace Genode {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Core_env : public Env
|
class Core_env : public Env_deprecated
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ Core_env * Genode::core_env()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Env * Genode::env() {
|
Env_deprecated * Genode::env() {
|
||||||
return core_env(); }
|
return core_env(); }
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,8 @@ struct Genode::Expanding_cpu_session_client : Upgradeable_client<Genode::Cpu_ses
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Genode::Platform_env : public Genode::Env, public Emergency_ram_reserve
|
class Genode::Platform_env : public Genode::Env_deprecated,
|
||||||
|
public Emergency_ram_reserve
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -145,9 +146,9 @@ class Genode::Platform_env : public Genode::Env, public Emergency_ram_reserve
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************
|
/******************************
|
||||||
** Env interface **
|
** Env_deprecated interface **
|
||||||
*******************/
|
******************************/
|
||||||
|
|
||||||
Parent *parent() override { return &_parent_client; }
|
Parent *parent() override { return &_parent_client; }
|
||||||
Ram_session *ram_session() override { return &_resources.ram; }
|
Ram_session *ram_session() override { return &_resources.ram; }
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
* Genode::component_entry_point() as a trampoline to
|
* Genode::component_entry_point() as a trampoline to
|
||||||
* call_component_construct().
|
* call_component_construct().
|
||||||
*/
|
*/
|
||||||
ENTRY(_ZN6Genode21component_entry_pointERNS_11EnvironmentE)
|
ENTRY(_ZN6Genode21component_entry_pointERNS_3EnvE)
|
||||||
|
|
||||||
PHDRS
|
PHDRS
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,7 @@ SECTIONS
|
||||||
_prog_img_beg = .;
|
_prog_img_beg = .;
|
||||||
|
|
||||||
/* put entry code at the start of the text segment / raw binary */
|
/* put entry code at the start of the text segment / raw binary */
|
||||||
*(.text._ZN6Genode21component_entry_pointERNS_11EnvironmentE)
|
*(.text._ZN6Genode21component_entry_pointERNS_3EnvE)
|
||||||
|
|
||||||
*(.text .stub .text.* .gnu.linkonce.t.*)
|
*(.text .stub .text.* .gnu.linkonce.t.*)
|
||||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||||
|
|
|
@ -357,7 +357,7 @@ struct Linker::Binary : Root_object, Elf_object
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void call_entry_point(Genode::Environment &env)
|
void call_entry_point(Genode::Env &env)
|
||||||
{
|
{
|
||||||
/* call static construtors and register destructors */
|
/* call static construtors and register destructors */
|
||||||
Func * const ctors_start = (Func *)lookup_symbol("_ctors_start");
|
Func * const ctors_start = (Func *)lookup_symbol("_ctors_start");
|
||||||
|
@ -371,7 +371,7 @@ struct Linker::Binary : Root_object, Elf_object
|
||||||
/* call component entry point */
|
/* call component entry point */
|
||||||
/* XXX the function type for call_component_construct() is a candidate
|
/* XXX the function type for call_component_construct() is a candidate
|
||||||
* for a base-internal header */
|
* for a base-internal header */
|
||||||
typedef void (*Entry)(Genode::Environment &);
|
typedef void (*Entry)(Genode::Env &);
|
||||||
Entry const entry = reinterpret_cast<Entry>(_file->entry);
|
Entry const entry = reinterpret_cast<Entry>(_file->entry);
|
||||||
|
|
||||||
entry(env);
|
entry(env);
|
||||||
|
@ -543,7 +543,7 @@ char const * Component::name() { return "ep"; }
|
||||||
|
|
||||||
struct Failed_to_load_program { };
|
struct Failed_to_load_program { };
|
||||||
|
|
||||||
void Component::construct(Genode::Environment &env)
|
void Component::construct(Genode::Env &env)
|
||||||
{
|
{
|
||||||
/* load program headers of linker now */
|
/* load program headers of linker now */
|
||||||
if (!Ld::linker()->file())
|
if (!Ld::linker()->file())
|
||||||
|
|
|
@ -34,15 +34,15 @@ namespace Genode {
|
||||||
* component's entrypoint is activated.
|
* component's entrypoint is activated.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern void (*call_component_construct)(Genode::Environment &) __attribute__((weak));
|
extern void (*call_component_construct)(Genode::Env &) __attribute__((weak));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void default_component_construct(Genode::Environment &env)
|
static void default_component_construct(Genode::Env &env)
|
||||||
{
|
{
|
||||||
Component::construct(env);
|
Component::construct(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
void (*Genode::call_component_construct)(Genode::Environment &) = &default_component_construct;
|
void (*Genode::call_component_construct)(Genode::Env &) = &default_component_construct;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************
|
/****************************************************
|
||||||
|
@ -71,8 +71,8 @@ extern char **genode_envp;
|
||||||
|
|
||||||
extern int main(int argc, char **argv, char **envp);
|
extern int main(int argc, char **argv, char **envp);
|
||||||
|
|
||||||
void Component::construct(Genode::Environment &env) __attribute__((weak));
|
void Component::construct(Genode::Env &env) __attribute__((weak));
|
||||||
void Component::construct(Genode::Environment &env)
|
void Component::construct(Genode::Env &env)
|
||||||
{
|
{
|
||||||
/* call real main function */
|
/* call real main function */
|
||||||
exit_status = main(genode_argc, genode_argv, genode_envp);
|
exit_status = main(genode_argc, genode_argv, genode_envp);
|
||||||
|
|
|
@ -20,12 +20,12 @@
|
||||||
|
|
||||||
/* FIXME move to base-internal header */
|
/* FIXME move to base-internal header */
|
||||||
namespace Genode {
|
namespace Genode {
|
||||||
extern void (*call_component_construct)(Environment &);
|
extern void (*call_component_construct)(Env &);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Genode {
|
namespace Genode {
|
||||||
|
|
||||||
void component_entry_point(Genode::Environment &env)
|
void component_entry_point(Genode::Env &env)
|
||||||
{
|
{
|
||||||
call_component_construct(env);
|
call_component_construct(env);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,8 @@
|
||||||
namespace Libc {
|
namespace Libc {
|
||||||
class Task;
|
class Task;
|
||||||
|
|
||||||
void (*original_call_component_construct)(Genode::Environment &);
|
void (*original_call_component_construct)(Genode::Env &);
|
||||||
void call_component_construct(Genode::Environment &env);
|
void call_component_construct(Genode::Env &env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ class Libc::Task : public Genode::Rpc_object<Task_resume, Libc::Task>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Genode::Environment &_env;
|
Genode::Env &_env;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Application context and execution state
|
* Application context and execution state
|
||||||
|
@ -91,7 +91,7 @@ class Libc::Task : public Genode::Rpc_object<Task_resume, Libc::Task>
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Task(Genode::Environment &env) : _env(env) { }
|
Task(Genode::Env &env) : _env(env) { }
|
||||||
|
|
||||||
~Task() { PERR("%s should not be executed!", __PRETTY_FUNCTION__); }
|
~Task() { PERR("%s should not be executed!", __PRETTY_FUNCTION__); }
|
||||||
|
|
||||||
|
@ -184,9 +184,9 @@ namespace Libc {
|
||||||
****************************/
|
****************************/
|
||||||
|
|
||||||
/* XXX needs base-internal header? */
|
/* XXX needs base-internal header? */
|
||||||
namespace Genode { extern void (*call_component_construct)(Genode::Environment &); }
|
namespace Genode { extern void (*call_component_construct)(Genode::Env &); }
|
||||||
|
|
||||||
void Libc::call_component_construct(Genode::Environment &env)
|
void Libc::call_component_construct(Genode::Env &env)
|
||||||
{
|
{
|
||||||
task = unmanaged_singleton<Libc::Task>(env);
|
task = unmanaged_singleton<Libc::Task>(env);
|
||||||
task->run();
|
task->run();
|
||||||
|
|
|
@ -152,7 +152,7 @@ struct Main
|
||||||
struct Sdl_videodriver_not_supported { };
|
struct Sdl_videodriver_not_supported { };
|
||||||
struct Sdl_setvideomode_failed { };
|
struct Sdl_setvideomode_failed { };
|
||||||
|
|
||||||
Genode::Environment &env;
|
Genode::Env &env;
|
||||||
|
|
||||||
int fb_width { config_arg("width", 1024) };
|
int fb_width { config_arg("width", 1024) };
|
||||||
int fb_height { config_arg("height", 768) };
|
int fb_height { config_arg("height", 768) };
|
||||||
|
@ -172,7 +172,7 @@ struct Main
|
||||||
Input::Handler_component input_handler_component { input_session };
|
Input::Handler_component input_handler_component { input_session };
|
||||||
Input::Handler_client input_handler_client { env.ep().manage(input_handler_component) };
|
Input::Handler_client input_handler_client { env.ep().manage(input_handler_component) };
|
||||||
|
|
||||||
Main(Genode::Environment &env) : env(env)
|
Main(Genode::Env &env) : env(env)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Initialize libSDL window
|
* Initialize libSDL window
|
||||||
|
@ -214,6 +214,6 @@ struct Main
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Genode::size_t Component::stack_size() { return 4*1024*sizeof(long); }
|
Genode::size_t Component::stack_size() { return 4*1024*sizeof(long); }
|
||||||
char const * Component::name() { return "fb_sdl"; }
|
char const * Component::name() { return "fb_sdl"; }
|
||||||
void Component::construct(Genode::Environment &env) { static Main inst(env); }
|
void Component::construct(Genode::Env &env) { static Main inst(env); }
|
||||||
|
|
|
@ -27,10 +27,10 @@ char const *Component::name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Genode::Environment *_env;
|
static Genode::Env *_env;
|
||||||
|
|
||||||
|
|
||||||
void Component::construct(Genode::Environment &env)
|
void Component::construct(Genode::Env &env)
|
||||||
{
|
{
|
||||||
_env = &env;
|
_env = &env;
|
||||||
Server::construct(env.ep());
|
Server::construct(env.ep());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user