[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 06/13] xen: XENMEM_add_to_physmap hypercall



Xen reads the entire structure, and if the space is _gmfn, will write the
structure back

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

--
TODO: verifiy whether the POST_MEM_WRITE is requred if it is entirely
contained within the space identified by the PRE_MEM_READs
---
 coregrind/m_syswrap/syswrap-xen.c |   23 +++++++++++++++++++++++
 include/vki/vki-xen-memory.h      |   15 +++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/coregrind/m_syswrap/syswrap-xen.c 
b/coregrind/m_syswrap/syswrap-xen.c
index 76e8b4a..60a5f3d 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -172,6 +172,22 @@ PRE(memory_op)
       break;
    }
 
+   case VKI_XENMEM_add_to_physmap: {
+       struct vki_xen_add_to_physmap *arg =
+           (struct vki_xen_add_to_physmap *)ARG2;
+       PRE_MEM_READ("XENMEM_add_to_physmap domid",
+                    (Addr)&arg->domid, sizeof(arg->domid));
+       PRE_MEM_READ("XENMEM_add_to_physmap size",
+                    (Addr)&arg->size, sizeof(arg->size));
+       PRE_MEM_READ("XENMEM_add_to_physmap space",
+                    (Addr)&arg->space, sizeof(arg->space));
+       PRE_MEM_READ("XENMEM_add_to_physmap idx",
+                    (Addr)&arg->idx, sizeof(arg->idx));
+       PRE_MEM_READ("XENMEM_add_to_physmap gpfn",
+                    (Addr)&arg->gpfn, sizeof(arg->gpfn));
+       break;
+   };
+
    case VKI_XENMEM_get_sharing_freed_pages:
    case VKI_XENMEM_get_sharing_shared_pages:
       break;
@@ -774,6 +790,13 @@ POST(memory_op)
        break;
    }
 
+   case VKI_XENMEM_add_to_physmap: {
+       struct vki_xen_add_to_physmap *arg =
+           (struct vki_xen_add_to_physmap *)ARG2;
+       if (arg->space == VKI_XENMAPSPACE_gmfn_range)
+           POST_MEM_WRITE(ARG2, sizeof(*arg));
+   }
+
    case VKI_XENMEM_get_sharing_freed_pages:
    case VKI_XENMEM_get_sharing_shared_pages:
        /* No outputs */
diff --git a/include/vki/vki-xen-memory.h b/include/vki/vki-xen-memory.h
index 208d642..d7e8df5 100644
--- a/include/vki/vki-xen-memory.h
+++ b/include/vki/vki-xen-memory.h
@@ -46,6 +46,21 @@ struct vki_xen_machphys_mfn_list {
     unsigned int nr_extents; /* OUT */
 };
 
+struct vki_xen_add_to_physmap {
+    vki_xen_domid_t domid;
+    vki_uint16_t size;
+
+#define VKI_XENMAPSPACE_shared_info  0
+#define VKI_XENMAPSPACE_grant_table  1
+#define VKI_XENMAPSPACE_gmfn         2
+#define VKI_XENMAPSPACE_gmfn_range   3
+#define VKI_XENMAPSPACE_gmfn_foreign 4
+
+    unsigned int space;
+    vki_xen_ulong_t idx;
+    vki_xen_pfn_t gpfn;
+};
+
 #endif // __VKI_XEN_MEMORY_H
 
 /*--------------------------------------------------------------------*/
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.