# HG changeset patch
# User Emmanuel Ackaouy <ack@xxxxxxxxxxxxx>
# Date 1168018472 0
# Node ID ee395551208d87576921efbf08a4d7411bf46dfc
# Parent e4088ae584b81959999318c35bd718c21bed69f2
Enable compatibility mode operation for HYPERVISOR_physdev_op and
HYPERVISOR_event_channel_op.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
xen/arch/x86/compat.c | 14 ++++++++--
xen/arch/x86/physdev.c | 13 ++++++++--
xen/arch/x86/x86_64/Makefile | 5 +++
xen/arch/x86/x86_64/compat.c | 30 +++++++++++++++++++++++
xen/arch/x86/x86_64/compat/entry.S | 8 +-----
xen/arch/x86/x86_64/physdev.c | 48 +++++++++++++++++++++++++++++++++++++
xen/common/compat/xlat.c | 26 +++++++++++++++++++-
xen/include/asm-x86/hypercall.h | 9 ++++++
xen/include/xlat.lst | 11 ++++++++
9 files changed, 152 insertions(+), 12 deletions(-)
diff -r e4088ae584b8 -r ee395551208d xen/arch/x86/compat.c
--- a/xen/arch/x86/compat.c Fri Jan 05 17:34:31 2007 +0000
+++ b/xen/arch/x86/compat.c Fri Jan 05 17:34:32 2007 +0000
@@ -9,16 +9,22 @@
#include <xen/guest_access.h>
#include <xen/hypercall.h>
+#ifndef COMPAT
+typedef long ret_t;
+#endif
+
/* Legacy hypercall (as of 0x00030202). */
-long do_physdev_op_compat(XEN_GUEST_HANDLE(physdev_op_t) uop)
+ret_t do_physdev_op_compat(XEN_GUEST_HANDLE(physdev_op_t) uop)
{
struct physdev_op op;
if ( unlikely(copy_from_guest(&op, uop, 1) != 0) )
return -EFAULT;
- return do_physdev_op(op.cmd, (XEN_GUEST_HANDLE(void)) { &uop.p->u });
+ return do_physdev_op(op.cmd, guest_handle_from_ptr(&uop.p->u, void));
}
+
+#ifndef COMPAT
/* Legacy hypercall (as of 0x00030202). */
long do_event_channel_op_compat(XEN_GUEST_HANDLE(evtchn_op_t) uop)
@@ -28,5 +34,7 @@ long do_event_channel_op_compat(XEN_GUES
if ( unlikely(copy_from_guest(&op, uop, 1) != 0) )
return -EFAULT;
- return do_event_channel_op(op.cmd, (XEN_GUEST_HANDLE(void)) {&uop.p->u });
+ return do_event_channel_op(op.cmd, guest_handle_from_ptr(&uop.p->u, void));
}
+
+#endif
diff -r e4088ae584b8 -r ee395551208d xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c Fri Jan 05 17:34:31 2007 +0000
+++ b/xen/arch/x86/physdev.c Fri Jan 05 17:34:32 2007 +0000
@@ -9,8 +9,13 @@
#include <xen/guest_access.h>
#include <asm/current.h>
#include <asm/smpboot.h>
+#include <asm/hypercall.h>
#include <public/xen.h>
#include <public/physdev.h>
+
+#ifndef COMPAT
+typedef long ret_t;
+#endif
int
ioapic_guest_read(
@@ -19,10 +24,10 @@ ioapic_guest_write(
ioapic_guest_write(
unsigned long physbase, unsigned int reg, u32 pval);
-long do_physdev_op(int cmd, XEN_GUEST_HANDLE(void) arg)
+ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE(void) arg)
{
int irq;
- long ret;
+ ret_t ret;
switch ( cmd )
{
@@ -129,7 +134,11 @@ long do_physdev_op(int cmd, XEN_GUEST_HA
(set_iobitmap.nr_ports > 65536) )
break;
ret = 0;
+#ifndef COMPAT
current->arch.iobmp = set_iobitmap.bitmap;
+#else
+ guest_from_compat_handle(current->arch.iobmp, set_iobitmap.bitmap);
+#endif
current->arch.iobmp_limit = set_iobitmap.nr_ports;
break;
}
diff -r e4088ae584b8 -r ee395551208d xen/arch/x86/x86_64/Makefile
--- a/xen/arch/x86/x86_64/Makefile Fri Jan 05 17:34:31 2007 +0000
+++ b/xen/arch/x86/x86_64/Makefile Fri Jan 05 17:34:32 2007 +0000
@@ -3,9 +3,14 @@ obj-y += mm.o
obj-y += mm.o
obj-y += traps.o
+obj-$(CONFIG_COMPAT) += compat.o
+obj-$(CONFIG_COMPAT) += physdev.o
+
ifeq ($(CONFIG_COMPAT),y)
# extra dependencies
+compat.o: ../compat.c
entry.o: compat/entry.S
mm.o: compat/mm.c
+physdev.o: ../physdev.c
traps.o: compat/traps.c
endif
diff -r e4088ae584b8 -r ee395551208d xen/arch/x86/x86_64/compat.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/x86/x86_64/compat.c Fri Jan 05 17:34:32 2007 +0000
@@ -0,0 +1,30 @@
+/******************************************************************************
+ * compat.c
+ */
+
+#include <xen/config.h>
+#include <xen/hypercall.h>
+#include <compat/xen.h>
+#include <compat/physdev.h>
+
+DEFINE_XEN_GUEST_HANDLE(physdev_op_compat_t);
+#define physdev_op compat_physdev_op
+#define physdev_op_t physdev_op_compat_t
+#define do_physdev_op compat_physdev_op
+#define do_physdev_op_compat(x) compat_physdev_op_compat(_##x)
+
+#define COMPAT
+#define _XEN_GUEST_HANDLE(t) XEN_GUEST_HANDLE(t)
+typedef int ret_t;
+
+#include "../compat.c"
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e4088ae584b8 -r ee395551208d xen/arch/x86/x86_64/compat/entry.S
--- a/xen/arch/x86/x86_64/compat/entry.S Fri Jan 05 17:34:31 2007 +0000
+++ b/xen/arch/x86/x86_64/compat/entry.S Fri Jan 05 17:34:32 2007 +0000
@@ -283,15 +283,11 @@ CFIX14:
#define compat_platform_op domain_crash_synchronous
#define compat_multicall domain_crash_synchronous
#define compat_set_timer_op domain_crash_synchronous
-#define compat_event_channel_op_compat domain_crash_synchronous
-#define compat_physdev_op_compat domain_crash_synchronous
#define compat_grant_table_op domain_crash_synchronous
#define compat_vcpu_op domain_crash_synchronous
#define compat_acm_op domain_crash_synchronous
#define compat_arch_sched_op domain_crash_synchronous
#define compat_xenoprof_op domain_crash_synchronous
-#define compat_event_channel_op domain_crash_synchronous
-#define compat_physdev_op domain_crash_synchronous
#define compat_sysctl domain_crash_synchronous
#define compat_domctl domain_crash_synchronous
@@ -312,7 +308,7 @@ ENTRY(compat_hypercall_table)
.quad compat_multicall
.quad compat_update_va_mapping
.quad compat_set_timer_op /* 15 */
- .quad compat_event_channel_op_compat
+ .quad do_event_channel_op_compat
.quad compat_xen_version
.quad do_console_io
.quad compat_physdev_op_compat
@@ -328,7 +324,7 @@ ENTRY(compat_hypercall_table)
.quad compat_arch_sched_op
.quad compat_callback_op /* 30 */
.quad compat_xenoprof_op
- .quad compat_event_channel_op
+ .quad do_event_channel_op
.quad compat_physdev_op
.quad compat_ni_hypercall
.quad compat_sysctl /* 35 */
diff -r e4088ae584b8 -r ee395551208d xen/arch/x86/x86_64/physdev.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/x86/x86_64/physdev.c Fri Jan 05 17:34:32 2007 +0000
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * physdev.c
+ */
+
+#include <xen/config.h>
+#include <xen/types.h>
+#include <xen/guest_access.h>
+#include <compat/xen.h>
+#include <compat/event_channel.h>
+#include <compat/physdev.h>
+#include <asm/hypercall.h>
+
+#define do_physdev_op compat_physdev_op
+
+#define physdev_apic compat_physdev_apic
+#define physdev_apic_t physdev_apic_compat_t
+
+#define physdev_eoi compat_physdev_eoi
+#define physdev_eoi_t physdev_eoi_compat_t
+
+#define physdev_set_iobitmap compat_physdev_set_iobitmap
+#define physdev_set_iobitmap_t physdev_set_iobitmap_compat_t
+
+#define physdev_set_iopl compat_physdev_set_iopl
+#define physdev_set_iopl_t physdev_set_iopl_compat_t
+
+#define physdev_irq compat_physdev_irq
+#define physdev_irq_t physdev_irq_compat_t
+
+#define physdev_irq_status_query compat_physdev_irq_status_query
+#define physdev_irq_status_query_t physdev_irq_status_query_compat_t
+
+#define COMPAT
+#undef guest_handle_okay
+#define guest_handle_okay compat_handle_okay
+typedef int ret_t;
+
+#include "../physdev.c"
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e4088ae584b8 -r ee395551208d xen/common/compat/xlat.c
--- a/xen/common/compat/xlat.c Fri Jan 05 17:34:31 2007 +0000
+++ b/xen/common/compat/xlat.c Fri Jan 05 17:34:32 2007 +0000
@@ -4,8 +4,8 @@
#include <xen/compat.h>
#include <xen/lib.h>
-#include <public/xen.h>
#include <compat/xen.h>
+#include <compat/event_channel.h>
/* In-place translation functons: */
void xlat_start_info(struct start_info *native,
@@ -20,6 +20,30 @@ void xlat_start_info(struct start_info *
#define xen_dom0_vga_console_info dom0_vga_console_info
CHECK_dom0_vga_console_info;
#undef dom0_vga_console_info
+
+#define xen_evtchn_alloc_unbound evtchn_alloc_unbound
+#define xen_evtchn_bind_interdomain evtchn_bind_interdomain
+#define xen_evtchn_bind_ipi evtchn_bind_ipi
+#define xen_evtchn_bind_pirq evtchn_bind_pirq
+#define xen_evtchn_bind_vcpu evtchn_bind_vcpu
+#define xen_evtchn_bind_virq evtchn_bind_virq
+#define xen_evtchn_close evtchn_close
+#define xen_evtchn_op evtchn_op
+#define xen_evtchn_send evtchn_send
+#define xen_evtchn_status evtchn_status
+#define xen_evtchn_unmask evtchn_unmask
+CHECK_evtchn_op;
+#undef xen_evtchn_alloc_unbound
+#undef xen_evtchn_bind_interdomain
+#undef xen_evtchn_bind_ipi
+#undef xen_evtchn_bind_pirq
+#undef xen_evtchn_bind_vcpu
+#undef xen_evtchn_bind_virq
+#undef xen_evtchn_close
+#undef xen_evtchn_op
+#undef xen_evtchn_send
+#undef xen_evtchn_status
+#undef xen_evtchn_unmask
#define xen_mmu_update mmu_update
CHECK_mmu_update;
diff -r e4088ae584b8 -r ee395551208d xen/include/asm-x86/hypercall.h
--- a/xen/include/asm-x86/hypercall.h Fri Jan 05 17:34:31 2007 +0000
+++ b/xen/include/asm-x86/hypercall.h Fri Jan 05 17:34:32 2007 +0000
@@ -123,4 +123,13 @@ do_set_callbacks(
#endif
+#ifdef CONFIG_COMPAT
+
+extern int
+compat_physdev_op(
+ int cmd,
+ XEN_GUEST_HANDLE(void) arg);
+
+#endif
+
#endif /* __ASM_X86_HYPERCALL_H__ */
diff -r e4088ae584b8 -r ee395551208d xen/include/xlat.lst
--- a/xen/include/xlat.lst Fri Jan 05 17:34:31 2007 +0000
+++ b/xen/include/xlat.lst Fri Jan 05 17:34:32 2007 +0000
@@ -6,6 +6,17 @@
! mmuext_op xen.h
! start_info xen.h
? vcpu_time_info xen.h
+? evtchn_alloc_unbound event_channel.h
+? evtchn_bind_interdomain event_channel.h
+? evtchn_bind_ipi event_channel.h
+? evtchn_bind_pirq event_channel.h
+? evtchn_bind_vcpu event_channel.h
+? evtchn_bind_virq event_channel.h
+? evtchn_close event_channel.h
+? evtchn_op event_channel.h
+? evtchn_send event_channel.h
+? evtchn_status event_channel.h
+? evtchn_unmask event_channel.h
! add_to_physmap memory.h
! foreign_memory_map memory.h
! memory_exchange memory.h
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|