From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH 08/13] xen: XEN_DOMCTL_gethvmcontext hypercall
Date: Thu, 28 Nov 2013 18:56:56 +0000 [thread overview]
Message-ID: <1385665021-5392-9-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1385665021-5392-1-git-send-email-andrew.cooper3@citrix.com>
The semantics of XEN_DOMCTL_gethvmcontext are little interesting.
If the 'buffer' field of the structure is NULL, the hypercall is a request for
the required buffer size, which written into the 'size' paramater.
If 'buffer' is non NULL, Xen will write to the buffer, and update 'size' with
the amount of data written.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
coregrind/m_syswrap/syswrap-xen.c | 19 +++++++++++++++++++
include/vki/vki-xen-domctl.h | 9 ++++++++-
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index f99b1ab..f5053bb 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -581,6 +581,15 @@ PRE(domctl)
PRE_XEN_DOMCTL_READ(createdomain, flags);
break;
+ case VKI_XEN_DOMCTL_gethvmcontext:
+ /* Xen unconditionally reads the 'buffer' pointer */
+ __PRE_XEN_DOMCTL_READ(gethvmcontext, hvmcontext, buffer);
+ /* Xen only consumes 'size' if 'buffer' is non NULL. A NULL
+ * buffer is a request for the required size. */
+ if ( domctl->u.hvmcontext.buffer.p )
+ __PRE_XEN_DOMCTL_READ(gethvmcontext, hvmcontext, size);
+ break;
+
case VKI_XEN_DOMCTL_max_mem:
PRE_XEN_DOMCTL_READ(max_mem, max_memkb);
break;
@@ -1077,6 +1086,16 @@ POST(domctl){
POST_XEN_DOMCTL_WRITE(getvcpuinfo, cpu);
break;
+ case VKI_XEN_DOMCTL_gethvmcontext:
+ /* Xen unconditionally writes size... */
+ __POST_XEN_DOMCTL_WRITE(gethvmcontext, hvmcontext, size);
+ /* ...but only writes to the buffer if it was non NULL */
+ if ( domctl->u.hvmcontext.buffer.p )
+ POST_MEM_WRITE((Addr)domctl->u.hvmcontext.buffer.p,
+ sizeof(*domctl->u.hvmcontext.buffer.p)
+ * domctl->u.hvmcontext.size);
+ break;
+
case VKI_XEN_DOMCTL_scheduler_op:
if ( domctl->u.scheduler_op.cmd == VKI_XEN_DOMCTL_SCHEDOP_getinfo ) {
switch(domctl->u.scheduler_op.sched_id) {
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index 815e0a7..24191bd 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -243,6 +243,13 @@ struct vki_xen_guest_tsc_info {
typedef struct vki_xen_guest_tsc_info vki_xen_guest_tsc_info_t;
DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_guest_tsc_info_t);
+struct vki_xen_domctl_hvmcontext {
+ vki_uint32_t size; /* IN/OUT size of buffer */
+ VKI_XEN_GUEST_HANDLE_64(vki_uint8) buffer; /* IN/OUT */
+};
+typedef struct vki_xen_domctl_hvmcontext vki_xen_domctl_hvmcontext_t;
+DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_hvmcontext_t);
+
struct vki_xen_domctl_tsc_info {
VKI_XEN_GUEST_HANDLE_64(vki_xen_guest_tsc_info_t) out_info; /* OUT */
vki_xen_guest_tsc_info_t info; /* IN */
@@ -291,7 +298,7 @@ struct vki_xen_domctl {
//struct vki_xen_domctl_disable_migrate disable_migrate;
struct vki_xen_domctl_tsc_info tsc_info;
//struct vki_xen_domctl_real_mode_area real_mode_area;
- //struct vki_xen_domctl_hvmcontext hvmcontext;
+ struct vki_xen_domctl_hvmcontext hvmcontext;
//struct vki_xen_domctl_hvmcontext_partial hvmcontext_partial;
struct vki_xen_domctl_address_size address_size;
//struct vki_xen_domctl_sendtrigger sendtrigger;
--
1.7.10.4
next prev 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 ` [PATCH 06/13] xen: XENMEM_add_to_physmap hypercall Andrew Cooper
2013-11-29 11:17 ` Ian Campbell
2013-11-28 18:56 ` [PATCH 07/13] xen: XENMEM_remove_from_physmap hypercall Andrew Cooper
2013-11-28 18:56 ` Andrew Cooper [this message]
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-9-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).