diff --git a/repos/base-codezero/src/core/include/platform_pd.h b/repos/base-codezero/src/core/include/platform_pd.h index 32a00397c3..efa5d2fa6d 100644 --- a/repos/base-codezero/src/core/include/platform_pd.h +++ b/repos/base-codezero/src/core/include/platform_pd.h @@ -14,6 +14,9 @@ #ifndef _CORE__INCLUDE__PLATFORM_PD_H_ #define _CORE__INCLUDE__PLATFORM_PD_H_ +/* Genode includes */ +#include + /* core includes */ #include #include @@ -42,7 +45,8 @@ namespace Genode { * Constructors */ Platform_pd(bool core); - Platform_pd(char const *, signed pd_id = -1, bool create = true); + Platform_pd(Allocator * md_alloc, size_t ram_quota, + char const *, signed pd_id = -1, bool create = true); /** * Destructor diff --git a/repos/base-codezero/src/core/platform_pd.cc b/repos/base-codezero/src/core/platform_pd.cc index 78f39e1f17..b2c64cde85 100644 --- a/repos/base-codezero/src/core/platform_pd.cc +++ b/repos/base-codezero/src/core/platform_pd.cc @@ -98,7 +98,8 @@ Platform_pd::Platform_pd(bool core) } -Platform_pd::Platform_pd(char const *, signed pd_id, bool create) +Platform_pd::Platform_pd(Allocator * md_alloc, size_t ram_quota, + char const *, signed pd_id, bool create) : _space_id(TASK_ID_INVALID) { _space_id = TASK_ID_INVALID; diff --git a/repos/base-fiasco/src/core/include/platform_pd.h b/repos/base-fiasco/src/core/include/platform_pd.h index f89c79107d..1ee5d521a6 100644 --- a/repos/base-fiasco/src/core/include/platform_pd.h +++ b/repos/base-fiasco/src/core/include/platform_pd.h @@ -17,6 +17,7 @@ #ifndef _CORE__INCLUDE__PLATFORM_PD_H_ #define _CORE__INCLUDE__PLATFORM_PD_H_ +#include #include #include @@ -142,7 +143,8 @@ namespace Genode { /** * Constructor */ - Platform_pd(char const *, signed pd_id = PD_INVALID, + Platform_pd(Allocator * md_alloc, size_t ram_quota, + char const *, signed pd_id = PD_INVALID, bool create = true); /** diff --git a/repos/base-fiasco/src/core/platform.cc b/repos/base-fiasco/src/core/platform.cc index dcbaeda48d..9cf4ac3264 100644 --- a/repos/base-fiasco/src/core/platform.cc +++ b/repos/base-fiasco/src/core/platform.cc @@ -490,7 +490,8 @@ Platform::Platform() : /* setup pd object for core pd */ _core_label[0] = 0; - _core_pd = new(core_mem_alloc()) Platform_pd(_core_label, myself.id.task, false); + _core_pd = new(core_mem_alloc()) Platform_pd(nullptr, 0, _core_label, + myself.id.task, false); /* * We setup the thread object for thread0 in core pd using a special diff --git a/repos/base-fiasco/src/core/platform_pd.cc b/repos/base-fiasco/src/core/platform_pd.cc index 95489c0eba..3de1043930 100644 --- a/repos/base-fiasco/src/core/platform_pd.cc +++ b/repos/base-fiasco/src/core/platform_pd.cc @@ -236,7 +236,8 @@ void Platform_pd::unbind_thread(Platform_thread *thread) } -Platform_pd::Platform_pd(char const *, signed pd_id, bool create) +Platform_pd::Platform_pd(Allocator * md_alloc, size_t ram_quota, + char const *, signed pd_id, bool create) { /* check correct init */ if (!_init) diff --git a/repos/base-foc/src/core/include/pd_session_component.h b/repos/base-foc/src/core/include/pd_session_component.h index d3e4fd5ed6..9f17b5424d 100644 --- a/repos/base-foc/src/core/include/pd_session_component.h +++ b/repos/base-foc/src/core/include/pd_session_component.h @@ -34,7 +34,8 @@ namespace Genode { public: - Pd_session_component(Rpc_entrypoint *thread_ep, const char *args) + Pd_session_component(Rpc_entrypoint *thread_ep, + Allocator *md_alloc, const char *args) : _thread_ep(thread_ep) { } diff --git a/repos/base-host/src/core/include/platform_pd.h b/repos/base-host/src/core/include/platform_pd.h index 2a2ac7c8d5..1af1304105 100644 --- a/repos/base-host/src/core/include/platform_pd.h +++ b/repos/base-host/src/core/include/platform_pd.h @@ -27,7 +27,8 @@ namespace Genode { * Constructors */ Platform_pd(bool core); - Platform_pd(char const *, signed pd_id = -1, bool create = true); + Platform_pd(Allocator * md_alloc, size_t ram_quota, + char const *, signed pd_id = -1, bool create = true); /** * Destructor diff --git a/repos/base-host/src/core/platform_pd.cc b/repos/base-host/src/core/platform_pd.cc index 95c8072be3..6e325a585b 100644 --- a/repos/base-host/src/core/platform_pd.cc +++ b/repos/base-host/src/core/platform_pd.cc @@ -43,7 +43,8 @@ Platform_pd::Platform_pd(bool core) } -Platform_pd::Platform_pd(char const *, signed pd_id, bool create) +Platform_pd::Platform_pd(Allocator * md_alloc, size_t ram_quota, + char const *, signed pd_id, bool create) { PWRN("not yet implemented"); } diff --git a/repos/base-hw/src/core/include/platform_pd.h b/repos/base-hw/src/core/include/platform_pd.h index 6701c1e596..c02cb8fbf6 100644 --- a/repos/base-hw/src/core/include/platform_pd.h +++ b/repos/base-hw/src/core/include/platform_pd.h @@ -66,7 +66,9 @@ namespace Genode * * \param label name of protection domain */ - Platform_pd(char const *label) : _main_thread(0), _label(label) + Platform_pd(Allocator * md_alloc, size_t ram_quota, + char const *label) + : _main_thread(0), _label(label) { Lock::Guard guard(_lock); diff --git a/repos/base-linux/src/core/include/pd_session_component.h b/repos/base-linux/src/core/include/pd_session_component.h index 5bfff995b0..952b011064 100644 --- a/repos/base-linux/src/core/include/pd_session_component.h +++ b/repos/base-linux/src/core/include/pd_session_component.h @@ -15,6 +15,7 @@ #define _CORE__INCLUDE__PD_SESSION_COMPONENT_H_ /* Genode includes */ +#include #include #include @@ -43,9 +44,12 @@ namespace Genode { /** * Constructor * - * \param ds_ep entrypoint where the dataspaces are managed + * \param ds_ep entrypoint where the dataspaces are managed + * \param md_alloc meta-data allocator + * \param args additional session arguments */ - Pd_session_component(Rpc_entrypoint *ds_ep, const char *args); + Pd_session_component(Rpc_entrypoint *ds_ep, Allocator * md_alloc, + const char *args); ~Pd_session_component(); diff --git a/repos/base-linux/src/core/pd_session_component.cc b/repos/base-linux/src/core/pd_session_component.cc index ff451fd270..50532139c3 100644 --- a/repos/base-linux/src/core/pd_session_component.cc +++ b/repos/base-linux/src/core/pd_session_component.cc @@ -305,7 +305,9 @@ static const char *get_env(const char *key) ** PD session interface ** **************************/ -Pd_session_component::Pd_session_component(Rpc_entrypoint *ep, const char *args) +Pd_session_component::Pd_session_component(Rpc_entrypoint * ep, + Allocator * md_alloc, + const char * args) : _pid(0), _uid(0), _gid(0), _ds_ep(ep) { diff --git a/repos/base-nova/src/core/include/pd_session_component.h b/repos/base-nova/src/core/include/pd_session_component.h index 3f84cf0ac0..9a03447512 100644 --- a/repos/base-nova/src/core/include/pd_session_component.h +++ b/repos/base-nova/src/core/include/pd_session_component.h @@ -52,8 +52,13 @@ namespace Genode { public: - Pd_session_component(Rpc_entrypoint *thread_ep, const char *args) - : _label(args), _pd(_label.string), _thread_ep(thread_ep) { } + Pd_session_component(Rpc_entrypoint *thread_ep, + Allocator * md_alloc, char const *args) + : _label(args), + _pd(md_alloc, + Arg_string::find_arg(args, "ram_quota").long_value(0), + _label.string), + _thread_ep(thread_ep) { } /**************************/ diff --git a/repos/base-nova/src/core/include/platform_pd.h b/repos/base-nova/src/core/include/platform_pd.h index 5fca479a92..343ebc9522 100644 --- a/repos/base-nova/src/core/include/platform_pd.h +++ b/repos/base-nova/src/core/include/platform_pd.h @@ -14,6 +14,7 @@ #ifndef _CORE__INCLUDE__PLATFORM_PD_H_ #define _CORE__INCLUDE__PLATFORM_PD_H_ +#include #include #include @@ -39,7 +40,8 @@ namespace Genode { /** * Constructors */ - Platform_pd(char const *, signed pd_id = -1, bool create = true); + Platform_pd(Allocator * md_alloc, size_t ram_quota, + char const *, signed pd_id = -1, bool create = true); /** * Destructor diff --git a/repos/base-nova/src/core/platform_pd.cc b/repos/base-nova/src/core/platform_pd.cc index 85efee48ba..3682a61c4d 100644 --- a/repos/base-nova/src/core/platform_pd.cc +++ b/repos/base-nova/src/core/platform_pd.cc @@ -46,7 +46,8 @@ int Platform_pd::assign_parent(Native_capability parent) } -Platform_pd::Platform_pd(char const *, signed pd_id, bool create) +Platform_pd::Platform_pd(Allocator * md_alloc, size_t ram_quota, + char const *, signed pd_id, bool create) : _thread_cnt(0), _pd_sel(~0UL) { } diff --git a/repos/base-okl4/src/core/include/pd_session_component.h b/repos/base-okl4/src/core/include/pd_session_component.h index 1ecca1e3bb..a9ef20add5 100644 --- a/repos/base-okl4/src/core/include/pd_session_component.h +++ b/repos/base-okl4/src/core/include/pd_session_component.h @@ -33,7 +33,8 @@ namespace Genode { public: - Pd_session_component(Rpc_entrypoint *thread_ep, const char *args) + Pd_session_component(Rpc_entrypoint *thread_ep, + Allocator *md_alloc, const char *args) : _thread_ep(thread_ep) { } diff --git a/repos/base-pistachio/src/core/include/platform_pd.h b/repos/base-pistachio/src/core/include/platform_pd.h index f6ac71fcb0..f34feab883 100644 --- a/repos/base-pistachio/src/core/include/platform_pd.h +++ b/repos/base-pistachio/src/core/include/platform_pd.h @@ -14,6 +14,7 @@ #ifndef _CORE__INCLUDE__PLATFORM_PD_H_ #define _CORE__INCLUDE__PLATFORM_PD_H_ +#include #include #include @@ -183,7 +184,8 @@ namespace Genode { * Constructors */ Platform_pd(bool core); - Platform_pd(char const *, signed pd_id = PD_INVALID, + Platform_pd(Allocator * md_alloc, size_t ram_quota, + char const *, signed pd_id = PD_INVALID, bool create = true); /** diff --git a/repos/base-pistachio/src/core/platform_pd.cc b/repos/base-pistachio/src/core/platform_pd.cc index 3b22ab8d30..cbc189aee6 100644 --- a/repos/base-pistachio/src/core/platform_pd.cc +++ b/repos/base-pistachio/src/core/platform_pd.cc @@ -340,7 +340,8 @@ Platform_pd::Platform_pd(bool core) : } -Platform_pd::Platform_pd(char const *, signed pd_id, bool create) +Platform_pd::Platform_pd(Allocator * md_alloc, size_t ram_quota, + char const *, signed pd_id, bool create) { if (!create) panic("create must be true."); diff --git a/repos/base/src/core/include/pd_root.h b/repos/base/src/core/include/pd_root.h index 1d14e62a07..6a8f7630ce 100644 --- a/repos/base/src/core/include/pd_root.h +++ b/repos/base/src/core/include/pd_root.h @@ -21,34 +21,40 @@ #include namespace Genode { - - class Pd_root : public Root_component - { - private: - - Rpc_entrypoint *_thread_ep; - - protected: - - Pd_session_component *_create_session(const char *args) { - return new (md_alloc()) Pd_session_component(_thread_ep, args); } - - public: - - /** - * Constructor - * - * \param session_ep entry point for managing pd session objects - * \param thread_ep entry point for managing threads - * \param md_alloc meta-data allocator to be used by root component - */ - Pd_root(Rpc_entrypoint *session_ep, - Rpc_entrypoint *thread_ep, - Allocator *md_alloc) - : - Root_component(session_ep, md_alloc), - _thread_ep(thread_ep) { } - }; + class Pd_root; } + +class Genode::Pd_root +: public Genode::Root_component +{ + private: + + Rpc_entrypoint *_thread_ep; + Allocator *_md_alloc; + + protected: + + Pd_session_component *_create_session(const char *args) + { + return new (md_alloc()) Pd_session_component(_thread_ep, + _md_alloc, args); + } + + public: + + /** + * Constructor + * + * \param session_ep entry point for managing pd session objects + * \param thread_ep entry point for managing threads + * \param md_alloc meta-data allocator to be used by root component + */ + Pd_root(Rpc_entrypoint *session_ep, + Rpc_entrypoint *thread_ep, + Allocator *md_alloc) + : Root_component(session_ep, md_alloc), + _thread_ep(thread_ep), _md_alloc(md_alloc) { } +}; + #endif /* _CORE__INCLUDE__PD_ROOT_H_ */ diff --git a/repos/base/src/core/include/pd_session_component.h b/repos/base/src/core/include/pd_session_component.h index efe47d7584..13f6daba1e 100644 --- a/repos/base/src/core/include/pd_session_component.h +++ b/repos/base/src/core/include/pd_session_component.h @@ -52,8 +52,13 @@ namespace Genode { public: - Pd_session_component(Rpc_entrypoint *thread_ep, char const *args) - : _label(args), _pd(_label.string), _thread_ep(thread_ep) { } + Pd_session_component(Rpc_entrypoint *thread_ep, + Allocator * md_alloc, char const *args) + : _label(args), + _pd(md_alloc, + Arg_string::find_arg(args, "ram_quota").long_value(0), + _label.string), + _thread_ep(thread_ep) { } /**************************/