mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 17:52:52 +00:00
parent
812a0c9eed
commit
830f6934f9
@ -23,17 +23,18 @@ namespace Genode { struct Pd_connection; }
|
||||
struct Genode::Pd_connection : Connection<Pd_session>, Pd_session_client
|
||||
{
|
||||
enum { RAM_QUOTA = 24*1024*sizeof(long)};
|
||||
enum Virt_space { UNCONSTRAIN = 0, CONSTRAIN = 1 };
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \param label session label
|
||||
*/
|
||||
Pd_connection(Env &env, char const *label = "")
|
||||
Pd_connection(Env &env, char const *label = "", Virt_space space = CONSTRAIN)
|
||||
:
|
||||
Connection<Pd_session>(env, session(env.parent(),
|
||||
"ram_quota=%u, cap_quota=%u, label=\"%s\"",
|
||||
RAM_QUOTA, CAP_QUOTA, label)),
|
||||
"ram_quota=%u, cap_quota=%u, label=\"%s\", virt_space=%u",
|
||||
RAM_QUOTA, CAP_QUOTA, label, space)),
|
||||
Pd_session_client(cap())
|
||||
{ }
|
||||
|
||||
|
@ -67,6 +67,7 @@ class Genode::Core_env : public Env_deprecated
|
||||
Session::Diag{false},
|
||||
*platform()->ram_alloc(),
|
||||
Ram_dataspace_factory::any_phys_range(),
|
||||
Ram_dataspace_factory::Virt_range { platform()->vm_start(), platform()->vm_size() },
|
||||
_region_map,
|
||||
*((Pager_entrypoint *)nullptr),
|
||||
"" /* args to native PD */)
|
||||
|
@ -44,6 +44,17 @@ class Genode::Pd_root : public Genode::Root_component<Genode::Pd_session_compone
|
||||
: Ram_dataspace_factory::any_phys_range();
|
||||
}
|
||||
|
||||
static Ram_dataspace_factory::Virt_range _virt_range_from_args(char const *args)
|
||||
{
|
||||
addr_t const constrained = Arg_string::find_arg(args, "virt_space").ulong_value(Genode::Pd_connection::Virt_space::CONSTRAIN);
|
||||
|
||||
if (!constrained)
|
||||
return Ram_dataspace_factory::Virt_range { 0x1000, 0UL - 0x2000 };
|
||||
|
||||
return Ram_dataspace_factory::Virt_range { platform()->vm_start(),
|
||||
platform()->vm_size() };
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
Pd_session_component *_create_session(const char *args)
|
||||
@ -55,6 +66,7 @@ class Genode::Pd_root : public Genode::Root_component<Genode::Pd_session_compone
|
||||
session_diag_from_args(args),
|
||||
_phys_alloc,
|
||||
_phys_range_from_args(args),
|
||||
_virt_range_from_args(args),
|
||||
_local_rm, _pager_ep, args);
|
||||
}
|
||||
|
||||
|
@ -108,6 +108,7 @@ class Genode::Pd_session_component : public Session_object<Pd_session>
|
||||
public:
|
||||
|
||||
typedef Ram_dataspace_factory::Phys_range Phys_range;
|
||||
typedef Ram_dataspace_factory::Virt_range Virt_range;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -118,6 +119,7 @@ class Genode::Pd_session_component : public Session_object<Pd_session>
|
||||
Diag diag,
|
||||
Range_allocator &phys_alloc,
|
||||
Phys_range phys_range,
|
||||
Virt_range virt_range,
|
||||
Region_map &local_rm,
|
||||
Pager_entrypoint &pager_ep,
|
||||
char const *args)
|
||||
@ -131,7 +133,7 @@ class Genode::Pd_session_component : public Session_object<Pd_session>
|
||||
_rpc_cap_factory(_sliced_heap),
|
||||
_native_pd(*this, args),
|
||||
_address_space(ep, _sliced_heap, pager_ep,
|
||||
platform()->vm_start(), platform()->vm_size()),
|
||||
virt_range.start, virt_range.size),
|
||||
_stack_area (ep, _sliced_heap, pager_ep, 0, stack_area_virtual_size()),
|
||||
_linker_area(ep, _sliced_heap, pager_ep, 0, LINKER_AREA_SIZE)
|
||||
{
|
||||
|
@ -33,9 +33,10 @@ class Genode::Ram_dataspace_factory : public Ram_allocator,
|
||||
public:
|
||||
|
||||
struct Phys_range { addr_t start, end; };
|
||||
|
||||
static Phys_range any_phys_range() { return { 0UL, ~0UL }; }
|
||||
|
||||
struct Virt_range { addr_t start, size; };
|
||||
|
||||
/*
|
||||
* Dimension '_ds_slab' such that slab blocks (including the
|
||||
* meta-data overhead of the sliced-heap blocks) are page sized.
|
||||
|
@ -64,9 +64,8 @@ void Platform::Device_pd::assign_pci(Genode::Io_mem_dataspace_capability io_mem_
|
||||
using namespace Genode;
|
||||
|
||||
Dataspace_client ds_client(io_mem_cap);
|
||||
addr_t const phys = ds_client.phys_addr();
|
||||
|
||||
addr_t page = _address_space.attach_at(io_mem_cap, phys);
|
||||
addr_t page = _address_space.attach(io_mem_cap);
|
||||
|
||||
/* sanity check */
|
||||
if (!page)
|
||||
|
@ -89,7 +89,7 @@ class Platform::Device_pd
|
||||
Device_pd(Genode::Env &env,
|
||||
Genode::Session_label const &label)
|
||||
:
|
||||
_pd(env, label.string()),
|
||||
_pd(env, label.string(), Genode::Pd_connection::Virt_space::UNCONSTRAIN),
|
||||
_label(label),
|
||||
_address_space(env, _pd.address_space())
|
||||
{ }
|
||||
|
Loading…
x
Reference in New Issue
Block a user