Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/xen/include Add the HYPERVISOR_sysctl() hypercall.



details:   https://anonhg.NetBSD.org/src/rev/6b80b45d42e2
branches:  trunk
changeset: 763698:6b80b45d42e2
user:      jym <jym%NetBSD.org@localhost>
date:      Wed Mar 30 22:57:24 2011 +0000

description:
Add the HYPERVISOR_sysctl() hypercall.

Although the hypercall arguments (like struct sysctl_readconsole) are not
compatible between different XEN_SYSCTL_INTERFACE_VERSIONs (one of the
reasons why the sysctl calls should only be used by xentools directly),
it's still practical to have when one wants to query Xen's dmesg from
ddb(4) in case of a panic.

Note: additional code is needed for readconsole() functionality, but adding
the hypercall should not cause any harm.

diffstat:

 sys/arch/xen/include/amd64/hypercalls.h |   8 +++++++-
 sys/arch/xen/include/i386/hypercalls.h  |  14 +++++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)

diffs (46 lines):

diff -r d1307681b2b9 -r 6b80b45d42e2 sys/arch/xen/include/amd64/hypercalls.h
--- a/sys/arch/xen/include/amd64/hypercalls.h   Wed Mar 30 22:34:03 2011 +0000
+++ b/sys/arch/xen/include/amd64/hypercalls.h   Wed Mar 30 22:57:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hypercalls.h,v 1.5 2008/11/13 01:45:48 cegger Exp $ */
+/* $NetBSD: hypercalls.h,v 1.6 2011/03/30 22:57:24 jym Exp $ */
 /******************************************************************************
  * hypercall.h
  * 
@@ -406,4 +406,10 @@
        return _hypercall1(int, mca, mc);
 }
 
+static inline int
+HYPERVISOR_sysctl(void *sysctl)
+{
+       return _hypercall1(int, sysctl, sysctl);
+}
+
 #endif /* __HYPERCALL_H__ */
diff -r d1307681b2b9 -r 6b80b45d42e2 sys/arch/xen/include/i386/hypercalls.h
--- a/sys/arch/xen/include/i386/hypercalls.h    Wed Mar 30 22:34:03 2011 +0000
+++ b/sys/arch/xen/include/i386/hypercalls.h    Wed Mar 30 22:57:24 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hypercalls.h,v 1.10 2009/10/19 18:41:11 bouyer Exp $   */
+/*     $NetBSD: hypercalls.h,v 1.11 2011/03/30 22:57:24 jym Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -534,4 +534,16 @@
 
     return ret;
 }
+
+static __inline int
+HYPERVISOR_sysctl(void *sysctl)
+{
+    int ret;
+    unsigned long ign1;
+
+    _hypercall(__HYPERVISOR_sysctl, _harg("1" (sysctl)),
+       _harg("=a" (ret), "=b" (ign1)));
+
+    return ret;
+}
 #endif /* _XENI386_HYPERVISOR_H_ */



Home | Main Index | Thread Index | Old Index