mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-19 03:06:39 +00:00
parent
d31492040c
commit
5783ba4b1f
25
repos/base/src/base/env/context_area.cc
vendored
25
repos/base/src/base/env/context_area.cc
vendored
@ -14,15 +14,32 @@
|
||||
#include <rm_session/connection.h>
|
||||
#include <base/env.h>
|
||||
#include <base/thread.h>
|
||||
#include <platform_env_common.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
struct Context_area_rm_session : Genode::Rm_connection
|
||||
struct Expanding_rm_connection : Connection<Rm_session>, Expanding_rm_session_client
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \param start start of the managed VM-region
|
||||
* \param size size of the VM-region to manage
|
||||
*/
|
||||
Expanding_rm_connection(addr_t start = ~0UL, size_t size = 0) :
|
||||
Connection<Rm_session>(
|
||||
session("ram_quota=64K, start=0x%p, size=0x%zx",
|
||||
start, size)),
|
||||
Expanding_rm_session_client(cap()) { }
|
||||
};
|
||||
|
||||
|
||||
struct Context_area_rm_session : Expanding_rm_connection
|
||||
{
|
||||
Context_area_rm_session()
|
||||
: Genode::Rm_connection(0, Genode::Native_config::context_area_virtual_size())
|
||||
: Expanding_rm_connection(0, Native_config::context_area_virtual_size())
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
addr_t local_base = Native_config::context_area_virtual_base();
|
||||
size_t size = Native_config::context_area_virtual_size();
|
||||
|
||||
|
30
repos/base/src/base/env/platform_env.h
vendored
30
repos/base/src/base/env/platform_env.h
vendored
@ -30,41 +30,11 @@
|
||||
|
||||
|
||||
namespace Genode {
|
||||
struct Expanding_rm_session_client;
|
||||
struct Expanding_cpu_session_client;
|
||||
class Platform_env;
|
||||
}
|
||||
|
||||
|
||||
struct Genode::Expanding_rm_session_client
|
||||
:
|
||||
Upgradeable_client<Genode::Rm_session_client>
|
||||
{
|
||||
Expanding_rm_session_client(Rm_session_capability cap)
|
||||
: Upgradeable_client<Genode::Rm_session_client>(cap) { }
|
||||
|
||||
Local_addr attach(Dataspace_capability ds, size_t size, off_t offset,
|
||||
bool use_local_addr, Local_addr local_addr,
|
||||
bool executable)
|
||||
{
|
||||
return retry<Rm_session::Out_of_metadata>(
|
||||
[&] () {
|
||||
return Rm_session_client::attach(ds, size, offset,
|
||||
use_local_addr,
|
||||
local_addr,
|
||||
executable); },
|
||||
[&] () { upgrade_ram(8*1024); });
|
||||
}
|
||||
|
||||
Pager_capability add_client(Thread_capability thread)
|
||||
{
|
||||
return retry<Rm_session::Out_of_metadata>(
|
||||
[&] () { return Rm_session_client::add_client(thread); },
|
||||
[&] () { upgrade_ram(8*1024); });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct Genode::Expanding_cpu_session_client : Upgradeable_client<Genode::Cpu_session_client>
|
||||
{
|
||||
Expanding_cpu_session_client(Genode::Cpu_session_capability cap)
|
||||
|
29
repos/base/src/base/env/platform_env_common.h
vendored
29
repos/base/src/base/env/platform_env_common.h
vendored
@ -82,6 +82,35 @@ struct Upgradeable_client : CLIENT
|
||||
};
|
||||
|
||||
|
||||
struct Genode::Expanding_rm_session_client
|
||||
:
|
||||
Upgradeable_client<Genode::Rm_session_client>
|
||||
{
|
||||
Expanding_rm_session_client(Rm_session_capability cap)
|
||||
: Upgradeable_client<Genode::Rm_session_client>(cap) { }
|
||||
|
||||
Local_addr attach(Dataspace_capability ds, size_t size, off_t offset,
|
||||
bool use_local_addr, Local_addr local_addr,
|
||||
bool executable)
|
||||
{
|
||||
return retry<Rm_session::Out_of_metadata>(
|
||||
[&] () {
|
||||
return Rm_session_client::attach(ds, size, offset,
|
||||
use_local_addr,
|
||||
local_addr,
|
||||
executable); },
|
||||
[&] () { upgrade_ram(8*1024); });
|
||||
}
|
||||
|
||||
Pager_capability add_client(Thread_capability thread)
|
||||
{
|
||||
return retry<Rm_session::Out_of_metadata>(
|
||||
[&] () { return Rm_session_client::add_client(thread); },
|
||||
[&] () { upgrade_ram(8*1024); });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct Genode::Expanding_ram_session_client : Upgradeable_client<Genode::Ram_session_client>
|
||||
{
|
||||
Expanding_ram_session_client(Ram_session_capability cap)
|
||||
|
Loading…
Reference in New Issue
Block a user