aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common
diff options
context:
space:
mode:
authorEmmanuel Ackaouy <ack@xensource.com>2007-01-05 17:34:28 +0000
committerEmmanuel Ackaouy <ack@xensource.com>2007-01-05 17:34:28 +0000
commit6224725e9357f6056cff046ba5da4c52f0bace8c (patch)
tree9ad38da55854dcad3fa52415aaebdb711c59aa85 /xen/common
parentc1990f10a76daa10ea01dd11e9ca6fc92cf55716 (diff)
downloadxen-6224725e9357f6056cff046ba5da4c52f0bace8c.tar.gz
xen-6224725e9357f6056cff046ba5da4c52f0bace8c.tar.bz2
xen-6224725e9357f6056cff046ba5da4c52f0bace8c.zip
Add logic to generate headers reflecting the compatibility mode layout
of hypercall arguments. Provide infrastructure for accessing handles passed from compatibility mode guests. Vector those hypercalls not needing any translation to their native implementations. Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'xen/common')
-rw-r--r--xen/common/Makefile2
-rw-r--r--xen/common/compat/Makefile4
-rw-r--r--xen/common/compat/kernel.c59
-rw-r--r--xen/common/kernel.c19
4 files changed, 80 insertions, 4 deletions
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 017348e065..680fd60b8c 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -35,5 +35,7 @@ obj-$(xenoprof) += xenoprof.o
obj-$(CONFIG_XENCOMM) += xencomm.o
+subdir-$(CONFIG_COMPAT) += compat
+
# Object file contains changeset and compiler information.
version.o: $(BASEDIR)/include/xen/compile.h
diff --git a/xen/common/compat/Makefile b/xen/common/compat/Makefile
new file mode 100644
index 0000000000..39e1c8ee3d
--- /dev/null
+++ b/xen/common/compat/Makefile
@@ -0,0 +1,4 @@
+obj-y += kernel.o
+
+# extra dependencies
+kernel.o: ../kernel.c
diff --git a/xen/common/compat/kernel.c b/xen/common/compat/kernel.c
new file mode 100644
index 0000000000..0618dbe8ad
--- /dev/null
+++ b/xen/common/compat/kernel.c
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * kernel.c
+ */
+
+#include <xen/config.h>
+#include <xen/init.h>
+#include <xen/lib.h>
+#include <xen/errno.h>
+#include <xen/version.h>
+#include <xen/sched.h>
+#include <xen/shadow.h>
+#include <xen/nmi.h>
+#include <xen/guest_access.h>
+#include <asm/current.h>
+#include <compat/xen.h>
+#include <compat/nmi.h>
+#include <compat/version.h>
+
+#define xen_extraversion compat_extraversion
+#define xen_extraversion_t compat_extraversion_t
+
+#define xen_compile_info compat_compile_info
+#define xen_compile_info_t compat_compile_info_t
+
+CHECK_TYPE(capabilities_info);
+
+#define xen_platform_parameters compat_platform_parameters
+#define xen_platform_parameters_t compat_platform_parameters_t
+#undef HYPERVISOR_VIRT_START
+#define HYPERVISOR_VIRT_START HYPERVISOR_COMPAT_VIRT_START
+
+#define xen_changeset_info compat_changeset_info
+#define xen_changeset_info_t compat_changeset_info_t
+
+#define xen_feature_info compat_feature_info
+#define xen_feature_info_t compat_feature_info_t
+
+CHECK_TYPE(domain_handle);
+
+#define xennmi_callback compat_nmi_callback
+#define xennmi_callback_t compat_nmi_callback_t
+
+#define DO(fn) int compat_##fn
+#define COMPAT
+
+#include "../kernel.c"
+
+int compat_disabled = 0;
+boolean_param("no-pv-compat", compat_disabled);
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 9dc321325e..bf46640526 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -11,11 +11,14 @@
#include <xen/version.h>
#include <xen/sched.h>
#include <xen/shadow.h>
+#include <xen/nmi.h>
#include <xen/guest_access.h>
#include <asm/current.h>
#include <public/nmi.h>
#include <public/version.h>
+#ifndef COMPAT
+
int tainted;
void cmdline_parse(char *cmdline)
@@ -116,11 +119,15 @@ void add_taint(unsigned flag)
tainted |= flag;
}
+# define DO(fn) long do_##fn
+
+#endif
+
/*
* Simple hypercalls.
*/
-long do_xen_version(int cmd, XEN_GUEST_HANDLE(void) arg)
+DO(xen_version)(int cmd, XEN_GUEST_HANDLE(void) arg)
{
switch ( cmd )
{
@@ -230,6 +237,8 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE(void) arg)
return -ENOSYS;
}
+#ifndef COMPAT
+
long register_guest_nmi_callback(unsigned long address)
{
struct vcpu *v = current;
@@ -260,7 +269,9 @@ long unregister_guest_nmi_callback(void)
return 0;
}
-long do_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE(void) arg)
+#endif
+
+DO(nmi_op)(unsigned int cmd, XEN_GUEST_HANDLE(void) arg)
{
struct xennmi_callback cb;
long rc = 0;
@@ -284,12 +295,12 @@ long do_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE(void) arg)
return rc;
}
-long do_vm_assist(unsigned int cmd, unsigned int type)
+DO(vm_assist)(unsigned int cmd, unsigned int type)
{
return vm_assist(current->domain, cmd, type);
}
-long do_ni_hypercall(void)
+DO(ni_hypercall)(void)
{
/* No-op hypercall. */
return -ENOSYS;