Re: big-endian support for libvirt - introduce GUEST_HANDLE infrastructure ?

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

 




  That would be perfect ! Maybe we don't even need to hook in configure
I'm sure endianness info can come from standard headers, then combined
with a processor check that should be sufficient I guess.
Without introducing all the guest handle infrastructure and by just fixing the known xen_v2s3_getdomaininfolistop and xen_v2d5_cpumap the patch became as nice and small as a patch should be ;-) The Libvirt padding is now handled by using gcc's __BIG_ENDIAN__, no configure/header/... needed that way. I think we can assume that at least when libvirt is compiled for ppc gcc is used right? I used one (1) really generic line from our ppc libxc code, this should be no licencing issue (LGPL vs. GPL). Tell me if someone think otherwise and I'll try to change it a bit. Since it is no longer a macro we could pre-calculate the sizes anyway, but the way it is now says clearly "64bit size - used size" for the padding and I like that kind of readability.

--

Grüsse / regards, Christian Ehrhardt

IBM Linux Technology Center, Open Virtualization
+49 7031/16-3385
Ehrhardt@xxxxxxxxxxxxxxxxxx
Ehrhardt@xxxxxxxxxx

IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Johann Weihen Geschäftsführung: Herbert Kircher Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

diff -r 57c3b9568ea6 src/xen_internal.c
--- a/src/xen_internal.c	Thu Jul 19 13:52:36 2007 +0200
+++ b/src/xen_internal.c	Sun Aug 05 04:04:51 2007 +0200
@@ -314,10 +314,17 @@ struct xen_v2s3_getdomaininfolistop {
 struct xen_v2s3_getdomaininfolistop {
     domid_t   first_domain;
     uint32_t  max_domains;
+#ifdef __BIG_ENDIAN__
+    struct {
+        int __pad[(sizeof (long long) - sizeof (struct xen_v2d5_getdomaininfo *)) / sizeof (int)];
+        struct xen_v2d5_getdomaininfo *v;
+    } buffer;
+#else
     union {
         struct xen_v2d5_getdomaininfo *v;
         uint64_t pad ALIGN_64;
     } buffer;
+#endif
     uint32_t  num_domains;
 };
 typedef struct xen_v2s3_getdomaininfolistop xen_v2s3_getdomaininfolistop;
@@ -422,10 +429,17 @@ typedef struct xen_v2_setvcpumap xen_v2_
 
 /* HV version 2, Dom version 5 requires 64-bit alignment */
 struct xen_v2d5_cpumap {
+#ifdef __BIG_ENDIAN__
+    struct {
+        int __pad[(sizeof (long long) - sizeof (uint8_t *)) / sizeof (int)];
+        uint8_t *v;
+    } bitmap;
+#else
     union {
         uint8_t    *v;
         uint64_t   pad ALIGN_64;
     } bitmap;
+#endif
     uint32_t    nr_cpus;
 };
 struct xen_v2d5_setvcpumap {
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]