mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-19 15:43:56 +00:00
base: new 'Ram_allocator' interface
The 'Ram_allocator' interface contains the subset of the RAM session interface that is needed to satisfy the needs of the 'Heap' and 'Sliced_heap'. Its small size makes it ideal for intercepting memory allocations as done by the new 'Constrained_ram_allocator' wrapper class, which is meant to replace the existing 'base/allocator_guard.h' and 'os/ram_session_guard.h'. Issue #2398
This commit is contained in:
committed by
Christian Helmuth
parent
5a468919bb
commit
ff68d77c7d
@ -48,7 +48,7 @@ namespace Genode {
|
||||
{
|
||||
private:
|
||||
|
||||
Lock _lock;
|
||||
Lock mutable _lock;
|
||||
|
||||
public:
|
||||
|
||||
@ -82,6 +82,12 @@ namespace Genode {
|
||||
RAM_SESSION_IMPL::free(ds);
|
||||
}
|
||||
|
||||
size_t dataspace_size(Ram_dataspace_capability ds) const override
|
||||
{
|
||||
Lock::Guard lock_guard(_lock);
|
||||
return RAM_SESSION_IMPL::dataspace_size(ds);
|
||||
}
|
||||
|
||||
int ref_account(Ram_session_capability session)
|
||||
{
|
||||
Lock::Guard lock_guard(_lock);
|
||||
|
@ -100,7 +100,7 @@ namespace Genode {
|
||||
/**
|
||||
* Check if dataspace is owned by a specified object
|
||||
*/
|
||||
bool owner(Dataspace_owner * const o) const { return _owner == o; }
|
||||
bool owner(Dataspace_owner const *o) const { return _owner == o; }
|
||||
|
||||
/**
|
||||
* Detach dataspace from all rm sessions.
|
||||
|
@ -78,23 +78,24 @@ class Stack_area_region_map : public Genode::Region_map
|
||||
};
|
||||
|
||||
|
||||
class Stack_area_ram_session : public Genode::Ram_session
|
||||
struct Stack_area_ram_session : Genode::Ram_session
|
||||
{
|
||||
public:
|
||||
|
||||
Genode::Ram_dataspace_capability alloc(Genode::size_t size,
|
||||
Genode::Cache_attribute) {
|
||||
return Genode::Ram_dataspace_capability(); }
|
||||
Genode::Ram_dataspace_capability alloc(Genode::size_t size,
|
||||
Genode::Cache_attribute) override {
|
||||
return Genode::Ram_dataspace_capability(); }
|
||||
|
||||
void free(Genode::Ram_dataspace_capability) { }
|
||||
void free(Genode::Ram_dataspace_capability) override { }
|
||||
|
||||
int ref_account(Genode::Ram_session_capability) { return 0; }
|
||||
Genode::size_t dataspace_size(Genode::Ram_dataspace_capability) const override { return 0; }
|
||||
|
||||
int transfer_quota(Genode::Ram_session_capability, Genode::size_t) { return 0; }
|
||||
int ref_account(Genode::Ram_session_capability) override { return 0; }
|
||||
|
||||
Genode::size_t quota() { return 0; }
|
||||
int transfer_quota(Genode::Ram_session_capability, Genode::size_t) override { return 0; }
|
||||
|
||||
Genode::size_t used() { return 0; }
|
||||
Genode::size_t quota() override { return 0; }
|
||||
|
||||
Genode::size_t used() override { return 0; }
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user