From 1c2f76cd2a99200cea3cd5abd56e8a5efed40d29 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Fri, 25 Jan 2013 16:26:23 +0100 Subject: [PATCH] nova: add support to specify dma mapping flag --- base-nova/include/nova/syscall-generic.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/base-nova/include/nova/syscall-generic.h b/base-nova/include/nova/syscall-generic.h index 07cf248885..b6e89bd929 100644 --- a/base-nova/include/nova/syscall-generic.h +++ b/base-nova/include/nova/syscall-generic.h @@ -472,11 +472,13 @@ namespace Nova { bool append_item(Crd crd, mword_t sel_hotspot, bool kern_pd = false, bool update_guest_pt = false, - bool translate_map = false) + bool translate_map = false, + bool dma_mem = false) { /* transfer items start at the end of the UTCB */ items += 1 << 16; - Item *item = reinterpret_cast(this) + (PAGE_SIZE_BYTE / sizeof(struct Item)) - (items >> 16); + Item *item = reinterpret_cast(this); + item += (PAGE_SIZE_BYTE / sizeof(struct Item)) - (items >> 16); /* check that there is enough space left on UTCB */ if (msg + msg_words() >= reinterpret_cast(item)) { @@ -490,7 +492,13 @@ namespace Nova { /* update guest page table */ unsigned g = update_guest_pt ? (1 << 10) : 0; - item->hotspot = crd.hotspot(sel_hotspot) | g | h | (translate_map ? 2 : 1); + /* mark memory dma able */ + unsigned d = dma_mem ? (1 << 9) : 0; + + /* set type of delegation, either 'map' or 'translate and map' */ + unsigned m = translate_map ? 2 : 1; + + item->hotspot = crd.hotspot(sel_hotspot) | g | h | d | m; item->crd = crd.value(); return true;