mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-13 04:38:20 +00:00
committed by
Christian Helmuth
parent
487e8ea934
commit
e6d20aba93
@ -53,7 +53,8 @@ class Genode::Region_map_component : public Rpc_object<Region_map>,
|
||||
void add_client(Rm_client &) { }
|
||||
void remove_client(Rm_client &) { }
|
||||
|
||||
Local_addr attach(Dataspace_capability, size_t, off_t, bool, Local_addr, bool) {
|
||||
Local_addr attach(Dataspace_capability, size_t, off_t, bool,
|
||||
Local_addr, bool, bool) {
|
||||
return (addr_t)0; }
|
||||
|
||||
void detach(Local_addr) { }
|
||||
|
@ -43,7 +43,8 @@ class Stack_area_region_map : public Genode::Region_map
|
||||
* Attach backing store to stack area
|
||||
*/
|
||||
Local_addr attach(Genode::Dataspace_capability, Genode::size_t size,
|
||||
Genode::off_t, bool, Local_addr local_addr, bool)
|
||||
Genode::off_t, bool, Local_addr local_addr, bool,
|
||||
bool) override
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
@ -61,17 +62,17 @@ class Stack_area_region_map : public Genode::Region_map
|
||||
return local_addr;
|
||||
}
|
||||
|
||||
void detach(Local_addr local_addr)
|
||||
void detach(Local_addr local_addr) override
|
||||
{
|
||||
Genode::warning("stack area detach from ", (void*)local_addr,
|
||||
" - not implemented");
|
||||
}
|
||||
|
||||
void fault_handler(Genode::Signal_context_capability) { }
|
||||
void fault_handler(Genode::Signal_context_capability) override { }
|
||||
|
||||
State state() { return State(); }
|
||||
State state() override { return State(); }
|
||||
|
||||
Genode::Dataspace_capability dataspace() {
|
||||
Genode::Dataspace_capability dataspace() override {
|
||||
return Genode::Dataspace_capability(); }
|
||||
};
|
||||
|
||||
|
@ -77,7 +77,8 @@ class Genode::Region_map_mmap : public Region_map, public Dataspace
|
||||
bool use_local_addr,
|
||||
addr_t local_addr,
|
||||
bool executable,
|
||||
bool overmap = false);
|
||||
bool overmap,
|
||||
bool writeable);
|
||||
|
||||
/**
|
||||
* Determine size of dataspace
|
||||
@ -115,25 +116,25 @@ class Genode::Region_map_mmap : public Region_map, public Dataspace
|
||||
** Region map interface **
|
||||
**************************/
|
||||
|
||||
Local_addr attach(Dataspace_capability ds, size_t size,
|
||||
off_t, bool, Local_addr, bool executable);
|
||||
Local_addr attach(Dataspace_capability, size_t size, off_t, bool,
|
||||
Local_addr, bool, bool) override;
|
||||
|
||||
void detach(Local_addr local_addr);
|
||||
void detach(Local_addr) override;
|
||||
|
||||
void fault_handler(Signal_context_capability) { }
|
||||
void fault_handler(Signal_context_capability) override { }
|
||||
|
||||
State state() { return State(); }
|
||||
State state() override { return State(); }
|
||||
|
||||
|
||||
/*************************
|
||||
** Dataspace interface **
|
||||
*************************/
|
||||
|
||||
size_t size() { return _size; }
|
||||
size_t size() override { return _size; }
|
||||
|
||||
addr_t phys_addr() { return 0; }
|
||||
addr_t phys_addr() override { return 0; }
|
||||
|
||||
bool writable() { return true; }
|
||||
bool writable() override { return true; }
|
||||
|
||||
/**
|
||||
* Return pseudo dataspace capability of the RM session
|
||||
@ -142,7 +143,7 @@ class Genode::Region_map_mmap : public Region_map, public Dataspace
|
||||
* as argument to 'Region_map_mmap::attach'. It is not a
|
||||
* real capability.
|
||||
*/
|
||||
Dataspace_capability dataspace() {
|
||||
Dataspace_capability dataspace() override {
|
||||
return Local_capability<Dataspace>::local_cap(this); }
|
||||
};
|
||||
|
||||
|
@ -39,10 +39,10 @@ Region_map::Local_addr
|
||||
Region_map_client::attach(Dataspace_capability ds, size_t size,
|
||||
off_t offset, bool use_local_addr,
|
||||
Region_map::Local_addr local_addr,
|
||||
bool executable)
|
||||
bool executable, bool writeable)
|
||||
{
|
||||
return _local(*this)->attach(ds, size, offset, use_local_addr,
|
||||
local_addr, executable);
|
||||
local_addr, executable, writeable);
|
||||
}
|
||||
|
||||
|
||||
|
@ -123,10 +123,11 @@ void *Region_map_mmap::_map_local(Dataspace_capability ds,
|
||||
bool use_local_addr,
|
||||
addr_t local_addr,
|
||||
bool executable,
|
||||
bool overmap)
|
||||
bool overmap,
|
||||
bool writeable)
|
||||
{
|
||||
int const fd = _dataspace_fd(ds);
|
||||
bool const writable = _dataspace_writable(ds);
|
||||
bool const writable = _dataspace_writable(ds) && writeable;
|
||||
|
||||
int const flags = MAP_SHARED | (overmap ? MAP_FIXED : 0);
|
||||
int const prot = PROT_READ
|
||||
@ -172,7 +173,7 @@ Region_map::Local_addr Region_map_mmap::attach(Dataspace_capability ds,
|
||||
size_t size, off_t offset,
|
||||
bool use_local_addr,
|
||||
Region_map::Local_addr local_addr,
|
||||
bool executable)
|
||||
bool executable, bool writeable)
|
||||
{
|
||||
Lock::Guard lock_guard(lock());
|
||||
|
||||
@ -239,7 +240,7 @@ Region_map::Local_addr Region_map_mmap::attach(Dataspace_capability ds,
|
||||
* argument as the region was reserved by a PROT_NONE mapping.
|
||||
*/
|
||||
if (_is_attached())
|
||||
_map_local(ds, region_size, offset, true, _base + (addr_t)local_addr, executable, true);
|
||||
_map_local(ds, region_size, offset, true, _base + (addr_t)local_addr, executable, true, writeable);
|
||||
|
||||
return (void *)local_addr;
|
||||
|
||||
@ -290,7 +291,7 @@ Region_map::Local_addr Region_map_mmap::attach(Dataspace_capability ds,
|
||||
*/
|
||||
_map_local(region.dataspace(), region.size(), region.offset(),
|
||||
true, rm->_base + region.start() + region.offset(),
|
||||
executable, true);
|
||||
executable, true, writeable);
|
||||
}
|
||||
|
||||
return rm->_base;
|
||||
@ -304,7 +305,7 @@ Region_map::Local_addr Region_map_mmap::attach(Dataspace_capability ds,
|
||||
* Note, we do not overmap.
|
||||
*/
|
||||
void *addr = _map_local(ds, region_size, offset, use_local_addr,
|
||||
local_addr, executable);
|
||||
local_addr, executable, false, writeable);
|
||||
|
||||
_add_to_rmap(Region((addr_t)addr, offset, ds, region_size));
|
||||
|
||||
|
Reference in New Issue
Block a user