2016-12-01 17:37:08 +01:00
|
|
|
/*
|
2016-06-21 12:58:00 +02:00
|
|
|
* \brief Helper class to make the Genode Env globally available
|
|
|
|
* \author Sebastian Sumpf
|
|
|
|
* \date 2016-06-21
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 13:23:52 +01:00
|
|
|
* Copyright (C) 2016-2017 Genode Labs GmbH
|
2016-06-21 12:58:00 +02:00
|
|
|
*
|
2017-02-20 13:23:52 +01:00
|
|
|
* This file is distributed under the terms of the GNU General Public License
|
|
|
|
* version 2.
|
2016-06-21 12:58:00 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _LX_KIT__ENV_H_
|
|
|
|
#define _LX_KIT__ENV_H_
|
|
|
|
|
|
|
|
#include <base/attached_rom_dataspace.h>
|
|
|
|
#include <base/env.h>
|
|
|
|
#include <base/heap.h>
|
2016-12-01 17:37:08 +01:00
|
|
|
#include <util/reconstructible.h>
|
2016-06-21 12:58:00 +02:00
|
|
|
|
|
|
|
namespace Lx_kit {
|
|
|
|
class Env;
|
|
|
|
|
|
|
|
Env &env();
|
|
|
|
|
2017-02-07 10:37:56 +01:00
|
|
|
Env &construct_env(Genode::Env &env);
|
2016-06-21 12:58:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
class Lx_kit::Env
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
|
|
|
Genode::Env &_env;
|
|
|
|
Genode::Heap _heap { _env.ram(), _env.rm() };
|
|
|
|
Genode::Attached_rom_dataspace _config { _env, "config" };
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
Env(Genode::Env &env) : _env(env) { }
|
|
|
|
|
|
|
|
Genode::Env &env() { return _env; }
|
|
|
|
Genode::Heap &heap() { return _heap; }
|
|
|
|
Genode::Attached_rom_dataspace &config_rom() { return _config; }
|
2019-01-21 14:30:54 +01:00
|
|
|
Genode::Ram_allocator &ram() { return _env.ram(); }
|
2017-02-07 10:37:56 +01:00
|
|
|
Genode::Region_map &rm() { return _env.rm(); }
|
2016-06-21 12:58:00 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _LX_KIT__ENV_H_ */
|