From 0ca47e89633e1e31637ae4f97690ac1de91a1254 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Wed, 25 Jul 2012 17:49:26 +0200 Subject: [PATCH] Support uncached 'Attached_ram_dataspace' The enable the use of 'Attached_ram_dataspace' objects as DMA buffers, we need to pass the 'cached' flag to the constructor. By default, the dataspace is cached, which corresponds to the original behaviour. --- os/include/os/attached_ram_dataspace.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/os/include/os/attached_ram_dataspace.h b/os/include/os/attached_ram_dataspace.h index 44a040ff72..9ac439e919 100644 --- a/os/include/os/attached_ram_dataspace.h +++ b/os/include/os/attached_ram_dataspace.h @@ -34,6 +34,7 @@ namespace Genode { Ram_session *_ram_session; Ram_dataspace_capability _ds; void *_local_addr; + bool const _cached; template static void _swap(T &v1, T &v2) { T tmp = v1; v1 = v2; v2 = tmp; } @@ -52,7 +53,7 @@ namespace Genode { if (!_size || !_ram_session) return; try { - _ds = _ram_session->alloc(_size); + _ds = _ram_session->alloc(_size, _cached); _local_addr = env()->rm_session()->attach(_ds); /* revert allocation if attaching the dataspace failed */ @@ -70,8 +71,11 @@ namespace Genode { * \throw Ram_session::Alloc_failed * \throw Rm_session::Attach_failed */ - Attached_ram_dataspace(Ram_session *ram_session, size_t size) - : _size(size), _ram_session(ram_session), _local_addr(0) + Attached_ram_dataspace(Ram_session *ram_session, size_t size, + bool cached = true) + : + _size(size), _ram_session(ram_session), _local_addr(0), + _cached(cached) { _alloc_and_attach(); }