Skip to contentSkip to conversation

32-on-64 grant table ops

RFC PATCH In review Jan Beulich 1 participant 1 message Oct 4, 2006

lore
Share & tools
lore
#0 lore raw

RFC PATCH 16/17 32-on-64 grant table ops

xen/arch/x86/x86_64/compat/entry.S +0 -1
Index: 2006-10-04/xen/arch/x86/x86_64/compat/entry.S
===================================================================
@@ -286,7 +286,6 @@ compat_arch_sched_op:
 .section .rodata, "a", @progbits
 
 #define compat_platform_op domain_crash_synchronous
-#define compat_grant_table_op domain_crash_synchronous
 #define compat_acm_op domain_crash_synchronous
 #define compat_xenoprof_op domain_crash_synchronous
 #define compat_sysctl domain_crash_synchronous
xen/common/Makefile +1 -0
Index: 2006-10-04/xen/common/Makefile
===================================================================
@@ -37,5 +37,6 @@ version.o: $(BASEDIR)/include/xen/compil
 
 ifeq ($(CONFIG_COMPAT),y)
 # extra dependencies
+grant_table.o: compat/grant_table.c
 schedule.o: compat/schedule.c
 endif
xen/common/compat/grant_table.c new file +104 -0

104 lines not on this page · raw message

NR_GRANT_FRAMES);
+#define XLAT_gnttab_setup_table_HNDL_frame_list(_d_, _s_) \
+ set_xen_guest_handle((_d_)->frame_list, (unsigned long *)(nat.setup + 1))
+ XLAT_gnttab_setup_table(nat.setup, &cmp.setup);
+#undef XLAT_gnttab_setup_table_HNDL_frame_list
+ rc = gnttab_setup_table(guest_handle_cast(nat.uop, gnttab_setup_table_t), 1);

+            }
+            if ( rc == 0 )
+            {

+ BUG_ON(nat.setup->nr_frames > NR_GRANT_FRAMES);
+#define XLAT_gnttab_setup_table_HNDL_frame_list(_d_, _s_) \
+ do \
+ { \
+ if ( (_s_)->status == GNTST_okay ) \
+ { \
+ for ( i = 0; i < (_s_)->nr_frames; ++i ) \
+ { \

+                            unsigned int frame = (_s_)->frame_list.p[i]; \
+                            BUG_ON(frame != (_s_)->frame_list.p[i]); \
+                            (void)__copy_to_compat_offset((_d_)->frame_list, i, &frame, 1); \

+ } \
+ } \
+ } while (0)
+ XLAT_gnttab_setup_table(&cmp.setup, nat.setup);
+#undef XLAT_gnttab_setup_table_HNDL_frame_list
+ if ( unlikely(__copy_to_guest(cmp_uop, &cmp.setup, 1)) )
+ rc = -EFAULT;
+ else
+ i = 1;
+ }
+ break;
+
+ case GNTTABOP_transfer:
+ for ( n = 0; i < COMPAT_ARG_XLAT_SIZE / sizeof(*nat.xfer) && i < count && rc == 0; ++i, ++n )
+ {
+ if ( unlikely(__copy_from_guest_offset(&cmp.xfer, cmp_uop, i, 1)) )
+ rc = -EFAULT;
+ else
+ {
+ XLAT_gnttab_transfer(nat.xfer + n, &cmp.xfer);
+ }
+ }
+ if ( rc == 0 )
+ rc = gnttab_transfer(guest_handle_cast(nat.uop, gnttab_transfer_t), n);
+ if ( rc == 0 )
+ {
+ XEN_GUEST_HANDLE(gnttab_transfer_compat_t) xfer;
+

+                xfer = guest_handle_cast(cmp_uop, gnttab_transfer_compat_t);
+                guest_handle_add_offset(xfer, i);
+                while ( n-- )
+                {

+ guest_handle_add_offset(xfer, -1);
+ if ( __copy_field_to_guest(xfer, nat.xfer, status) )
+ rc = -EFAULT;
+ }
+ }
+ break;
+
+ case GNTTABOP_copy:
+ for ( n = 0; i < COMPAT_ARG_XLAT_SIZE / sizeof(*nat.copy) && i < count && rc == 0; ++i, ++n )
+ {
+ if ( unlikely(__copy_from_guest_offset(&cmp.copy, cmp_uop, i, 1)) )
+ rc = -EFAULT;
+ else
+ {
+ enum XLAT_gnttab_copy_source_u source_u;
+ enum XLAT_gnttab_copy_dest_u dest_u;
+
+ if ( cmp.copy.flags & GNTCOPY_source_gref )
+ source_u = XLAT_gnttab_copy_source_u_ref;
+ else
+ source_u = XLAT_gnttab_copy_source_u_gmfn;
+ if ( cmp.copy.flags & GNTCOPY_dest_gref )
+ dest_u = XLAT_gnttab_copy_dest_u_ref;
+ else
+ dest_u = XLAT_gnttab_copy_dest_u_gmfn;
+ XLAT_gnttab_copy(nat.copy + n, &cmp.copy);
+ }
+ }
+ if ( rc == 0 )
+ rc = gnttab_copy(guest_handle_cast(nat.uop, gnttab_copy_t), n);
+ if ( rc == 0 )
+ {
+ XEN_GUEST_HANDLE(gnttab_copy_compat_t) copy;
+

+                copy = guest_handle_cast(cmp_uop, gnttab_copy_compat_t);
+                guest_handle_add_offset(copy, i);
+                while ( n-- )
+                {

+ guest_handle_add_offset(copy, -1);
+ if ( __copy_field_to_guest(copy, nat.copy, status) )
+ rc = -EFAULT;
+ }
+ }
+ break;
+
+ default:
+ domain_crash_synchronous();
+ break;
+ }
+ }
+
+ return rc;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

xen/common/grant_table.c +4 -0
Index: 2006-10-04/xen/common/grant_table.c
===================================================================
@@ -1014,6 +1014,10 @@ do_grant_table_op(
     return rc;
 }
 
+#ifdef CONFIG_COMPAT
+#include "compat/grant_table.c"
+#endif
+
 int 
 grant_table_create(
     struct domain *d)
xen/include/xlat.lst +7 -0
Index: 2006-10-04/xen/include/xlat.lst
===================================================================
@@ -20,6 +20,13 @@
 ?	evtchn_send			event_channel.h
 ?	evtchn_status			event_channel.h
 ?	evtchn_unmask			event_channel.h
+!	gnttab_copy			grant_table.h
+?	gnttab_dump_table		grant_table.h
+?	gnttab_map_grant_ref		grant_table.h
+!	gnttab_setup_table		grant_table.h
+!	gnttab_transfer			grant_table.h
+?	gnttab_unmap_grant_ref		grant_table.h
+?	grant_entry			grant_table.h
 !	add_to_physmap			memory.h
 !	memory_exchange			memory.h
 !	memory_map			memory.h