mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 10:46:25 +00:00
lx_kit: get buffer dataspace from virt addr
Introduce a method to access the dataspace capability of the underlying backing store for a memory allocation. This is necessary for drivers where the memory is managed manually and the capability needs to be given to a client. Issue #4325.
This commit is contained in:
parent
cd7a65a313
commit
327ec61ee3
@ -105,6 +105,7 @@ class Lx_kit::Mem_allocator
|
||||
Cache cache_attr);
|
||||
|
||||
Attached_dataspace & alloc_dataspace(size_t size);
|
||||
Dataspace_capability attached_dataspace_cap(void *addr);
|
||||
|
||||
void * alloc(size_t size, size_t align);
|
||||
addr_t dma_addr(void * addr);
|
||||
|
@ -49,6 +49,19 @@ Genode::Attached_dataspace & Lx_kit::Mem_allocator::alloc_dataspace(size_t size)
|
||||
}
|
||||
|
||||
|
||||
Genode::Dataspace_capability Lx_kit::Mem_allocator::attached_dataspace_cap(void * addr)
|
||||
{
|
||||
Genode::Dataspace_capability ret { };
|
||||
|
||||
_virt_to_dma.apply(Buffer_info::Query_addr(addr),
|
||||
[&] (Buffer_info const & info) {
|
||||
ret = info.buffer.ds().cap();
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void * Lx_kit::Mem_allocator::alloc(size_t size, size_t align)
|
||||
{
|
||||
if (!size)
|
||||
|
Loading…
Reference in New Issue
Block a user