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

[Xen-devel] [PATCH 12/13] xen: XEN_SYSCTL_readconsole hypercall



Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 coregrind/m_syswrap/syswrap-xen.c |   17 +++++++++++++++++
 include/vki/vki-xen-sysctl.h      |   23 ++++++++++++++++++++++-
 2 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/coregrind/m_syswrap/syswrap-xen.c 
b/coregrind/m_syswrap/syswrap-xen.c
index 056f2b8..ffe4e22 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -433,6 +433,18 @@ PRE(sysctl) {
       __PRE_XEN_SYSCTL_READ(_sysctl, _sysctl, _field)
 
    switch (sysctl->cmd) {
+   case VKI_XEN_SYSCTL_readconsole:
+       /* These are all unconditionally read */
+       PRE_XEN_SYSCTL_READ(readconsole, clear);
+       PRE_XEN_SYSCTL_READ(readconsole, incremental);
+       PRE_XEN_SYSCTL_READ(readconsole, buffer);
+       PRE_XEN_SYSCTL_READ(readconsole, count);
+
+       /* 'index' only read if 'incremental' is nonzero */
+       if (sysctl->u.readconsole.incremental)
+           PRE_XEN_SYSCTL_READ(readconsole, index);
+       break;
+
    case VKI_XEN_SYSCTL_getdomaininfolist:
       switch (sysctl->interface_version)
       {
@@ -984,6 +996,11 @@ POST(sysctl)
       __POST_XEN_SYSCTL_WRITE(_sysctl, _sysctl, _field)
 
    switch (sysctl->cmd) {
+   case VKI_XEN_SYSCTL_readconsole:
+       POST_MEM_WRITE((Addr)sysctl->u.readconsole.buffer.p,
+                      sysctl->u.readconsole.count * sizeof(char));
+       break;
+
    case VKI_XEN_SYSCTL_getdomaininfolist:
       switch (sysctl->interface_version)
       {
diff --git a/include/vki/vki-xen-sysctl.h b/include/vki/vki-xen-sysctl.h
index 06cbaf6..f406bd0 100644
--- a/include/vki/vki-xen-sysctl.h
+++ b/include/vki/vki-xen-sysctl.h
@@ -38,6 +38,27 @@
 #define VKI_XEN_SYSCTL_scheduler_op                  19
 #define VKI_XEN_SYSCTL_coverage_op                   20
 
+struct vki_xen_sysctl_readconsole {
+    /* IN */
+    vki_uint8_t clear;
+    vki_uint8_t incremental;
+
+    vki_uint8_t pad0, pad1;
+
+    /*
+     * IN:  Start index for consumption if @incremental.
+     * OUT: End index after consuming from the console.
+     */
+    vki_uint32_t index;
+    VKI_XEN_GUEST_HANDLE_64(char) buffer; /* IN */
+
+    /*
+     * IN:  size of buffer.
+     * OUT: bytes written into buffer.
+     */
+    vki_uint32_t count;
+};
+
 struct vki_xen_sysctl_getdomaininfolist_00000008 {
     /* IN variables. */
     vki_xen_domid_t           first_domain;
@@ -138,7 +159,7 @@ struct vki_xen_sysctl {
     vki_uint32_t cmd;
     vki_uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
     union {
-        //struct vki_xen_sysctl_readconsole       readconsole;
+        struct vki_xen_sysctl_readconsole       readconsole;
         //struct vki_xen_sysctl_tbuf_op           tbuf_op;
         struct vki_xen_sysctl_physinfo_00000008 physinfo_00000008;
         struct vki_xen_sysctl_physinfo_0000000a physinfo_0000000a;
-- 
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®.