WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH,RFC 11/17] 32-on-64 physdev ops

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH,RFC 11/17] 32-on-64 physdev ops
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Wed, 04 Oct 2006 17:42:24 +0200
Delivery-date: Wed, 04 Oct 2006 08:41:34 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Index: 2006-10-04/xen/arch/x86/compat.c
===================================================================
--- 2006-10-04.orig/xen/arch/x86/compat.c       2006-05-02 16:41:35.000000000 
+0200
+++ 2006-10-04/xen/arch/x86/compat.c    2006-10-04 15:20:03.000000000 +0200
@@ -9,17 +9,23 @@
 #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
Index: 2006-10-04/xen/arch/x86/physdev.c
===================================================================
--- 2006-10-04.orig/xen/arch/x86/physdev.c      2006-09-21 11:09:00.000000000 
+0200
+++ 2006-10-04/xen/arch/x86/physdev.c   2006-10-04 15:20:03.000000000 +0200
@@ -9,9 +9,14 @@
 #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(
     unsigned long physbase, unsigned int reg, u32 *pval);
@@ -19,10 +24,10 @@ int
 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;
     }
Index: 2006-10-04/xen/arch/x86/x86_64/Makefile
===================================================================
--- 2006-10-04.orig/xen/arch/x86/x86_64/Makefile        2006-10-04 
15:18:51.000000000 +0200
+++ 2006-10-04/xen/arch/x86/x86_64/Makefile     2006-10-04 15:20:03.000000000 
+0200
@@ -3,9 +3,14 @@ obj-y += io.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
Index: 2006-10-04/xen/arch/x86/x86_64/compat.c
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ 2006-10-04/xen/arch/x86/x86_64/compat.c     2006-10-04 15:20:03.000000000 
+0200
@@ -0,0 +1,29 @@
+/******************************************************************************
+ * compat.c
+ */
+
+#include <xen/config.h>
+#include <xen/hypercall.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:
+ */
Index: 2006-10-04/xen/arch/x86/x86_64/compat/entry.S
===================================================================
--- 2006-10-04.orig/xen/arch/x86/x86_64/compat/entry.S  2006-10-04 
15:18:57.000000000 +0200
+++ 2006-10-04/xen/arch/x86/x86_64/compat/entry.S       2006-10-04 
15:20:03.000000000 +0200
@@ -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 */
Index: 2006-10-04/xen/arch/x86/x86_64/physdev.c
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ 2006-10-04/xen/arch/x86/x86_64/physdev.c    2006-10-04 15:20:03.000000000 
+0200
@@ -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:
+ */
Index: 2006-10-04/xen/common/compat/xlat.c
===================================================================
--- 2006-10-04.orig/xen/common/compat/xlat.c    2006-10-04 15:18:57.000000000 
+0200
+++ 2006-10-04/xen/common/compat/xlat.c 2006-10-04 15:20:03.000000000 +0200
@@ -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,
@@ -21,6 +21,30 @@ void xlat_start_info(struct start_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
 #undef xen_mmu_update
Index: 2006-10-04/xen/include/asm-x86/hypercall.h
===================================================================
--- 2006-10-04.orig/xen/include/asm-x86/hypercall.h     2006-10-04 
15:18:57.000000000 +0200
+++ 2006-10-04/xen/include/asm-x86/hypercall.h  2006-10-04 15:20:03.000000000 
+0200
@@ -118,4 +118,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__ */
Index: 2006-10-04/xen/include/xlat.lst
===================================================================
--- 2006-10-04.orig/xen/include/xlat.lst        2006-10-04 15:18:57.000000000 
+0200
+++ 2006-10-04/xen/include/xlat.lst     2006-10-04 15:20:03.000000000 +0200
@@ -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
 !      memory_exchange                 memory.h
 !      memory_map                      memory.h


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH,RFC 11/17] 32-on-64 physdev ops, Jan Beulich <=