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-changelog

[Xen-changelog] Fix signedness issues, found by Jerone Young.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Fix signedness issues, found by Jerone Young.
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Fri, 24 Jun 2005 20:50:15 +0000
Cc: james@xxxxxxxxxxxxx
Delivery-date: Sat, 25 Jun 2005 10:01:43 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1754, 2005/06/24 21:50:15+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Fix signedness issues, found by Jerone Young.



 tools/libxc/xc_load_aout9.c |   19 +++++++++++--------
 xen/arch/x86/vmx_io.c       |    2 +-
 2 files changed, 12 insertions(+), 9 deletions(-)


diff -Nru a/tools/libxc/xc_load_aout9.c b/tools/libxc/xc_load_aout9.c
--- a/tools/libxc/xc_load_aout9.c       2005-06-25 06:02:53 -04:00
+++ b/tools/libxc/xc_load_aout9.c       2005-06-25 06:02:53 -04:00
@@ -19,7 +19,7 @@
 static int parseaout9image(char *, unsigned long, struct domain_setup_info *);
 static int loadaout9image(char *, unsigned long, int, u32, unsigned long *, 
struct domain_setup_info *);
 static void copyout(int, u32, unsigned long *, unsigned long, void *, int);
-struct Exec *get_header(unsigned char *, unsigned long, struct Exec *);
+struct Exec *get_header(char *, unsigned long, struct Exec *);
 
 
 int 
@@ -133,17 +133,20 @@
         sz -= chunksz;
     }
 }
-    
+
+#define swap16(_v) ((((u16)(_v)>>8)&0xff)|(((u16)(_v)&0xff)<<8))
+#define swap32(_v) (((u32)swap16((u16)(_v))<<16)|(u32)swap16((u32)((_v)>>16)))
+
 /*
  * Decode the header from the start of image and return it.
  */
 struct Exec *
 get_header(
-    unsigned char *image,
+    char *image,
     unsigned long image_size,
     struct Exec *ehdr)
 {
-    unsigned long *v;
+    u32 *v, x;
     int i;
 
     if (A9_MAGIC == 0)
@@ -153,10 +156,10 @@
         return 0;
 
     /* ... all big endian words */
-    v = (unsigned long *)ehdr;
-    for (i = 0; i < sizeof *ehdr; i += 4) {
-        v[i/4] = (image[i+0]<<24) | (image[i+1]<<16) | 
-                 (image[i+2]<<8) | image[i+3];
+    v = (u32 *)ehdr;
+    for (i = 0; i < sizeof(*ehdr); i += 4) {
+        x = *(u32 *)&image[i];
+        v[i/4] = swap32(x);
     }
 
     if(ehdr->magic != A9_MAGIC)
diff -Nru a/xen/arch/x86/vmx_io.c b/xen/arch/x86/vmx_io.c
--- a/xen/arch/x86/vmx_io.c     2005-06-25 06:02:53 -04:00
+++ b/xen/arch/x86/vmx_io.c     2005-06-25 06:02:53 -04:00
@@ -181,7 +181,7 @@
     __vmwrite(GUEST_RIP, regs->rip);
 }
 
-static inline void __set_reg_value(long *reg, int size, long value)
+static inline void __set_reg_value(unsigned long *reg, int size, long value)
 {
     switch (size) {
         case BYTE_64:

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Fix signedness issues, found by Jerone Young., BitKeeper Bot <=