xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH 06/13] xen: XENMEM_add_to_physmap hypercall
Date: Thu, 28 Nov 2013 18:56:54 +0000	[thread overview]
Message-ID: <1385665021-5392-7-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1385665021-5392-1-git-send-email-andrew.cooper3@citrix.com>

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

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

--
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

  parent reply	other threads:[~2013-11-28 18:56 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-28 18:56 [PATCH 00/13] Valgrind patches for hypercalls Andrew Cooper
2013-11-28 18:56 ` [PATCH 01/13] xen: Fix XEN_SYSCTL_getdomaininfolist for version 0xa Andrew Cooper
2013-11-28 18:56 ` [PATCH 02/13] xen: Infratructure for XEN_TMEM_* hypercalls Andrew Cooper
2013-11-28 18:56 ` [PATCH 03/13] xen: XENMEM_maximum_ram_page hypercall Andrew Cooper
2013-11-28 18:56 ` [PATCH 04/13] xen: XENMEM_maximum_gpfn hypercall Andrew Cooper
2013-11-28 18:56 ` [PATCH 05/13] xen: XENMEM_machphys_mfn_list hypercall Andrew Cooper
2013-11-28 18:56 ` Andrew Cooper [this message]
2013-11-29 11:17   ` [PATCH 06/13] xen: XENMEM_add_to_physmap hypercall Ian Campbell
2013-11-28 18:56 ` [PATCH 07/13] xen: XENMEM_remove_from_physmap hypercall Andrew Cooper
2013-11-28 18:56 ` [PATCH 08/13] xen: XEN_DOMCTL_gethvmcontext hypercall Andrew Cooper
2013-11-28 18:56 ` [PATCH 09/13] xen: XEN_DOMCTL_getpageframeinfo3 hypercall Andrew Cooper
2013-11-28 18:56 ` [PATCH 10/13] xen: XEN_DOMCTL_sethvmcontext hypercall Andrew Cooper
2013-11-29 11:22   ` Ian Campbell
2013-11-28 18:56 ` [PATCH 11/13] xen: XEN_DOMCTL_shadow_op hypercall Andrew Cooper
2013-11-29 11:25   ` Ian Campbell
2013-11-29 11:27     ` Andrew Cooper
2013-11-28 18:57 ` [PATCH 12/13] xen: XEN_SYSCTL_readconsole hypercall Andrew Cooper
2013-11-28 18:57 ` [PATCH 13/13] xen: XEN_SYSCTL_debugkeys hypercall Andrew Cooper
2013-11-29 11:45 ` [PATCH 00/13] Valgrind patches for hypercalls Ian Campbell
2013-12-02 10:37   ` Ian Campbell
2013-12-02 10:46     ` Andrew Cooper
2013-12-02 10:49       ` Ian Campbell
2013-12-02 10:55         ` Andrew Cooper
2013-12-02 11:16           ` Ian Campbell
2013-12-02 14:25 ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1385665021-5392-7-git-send-email-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).