ia64/xen-unstable

changeset 5579:819726e7dd2b

bitkeeper revision 1.1754 (42bc7207le_rYvV9kj8p-Dztt3T_eA)

Fix signedness issues, found by Jerone Young.
author kaf24@firebug.cl.cam.ac.uk
date Fri Jun 24 20:50:15 2005 +0000 (2005-06-24)
parents b38b3893fa76
children 2a28f4aab6ae
files tools/libxc/xc_load_aout9.c xen/arch/x86/vmx_io.c
line diff
     1.1 --- a/tools/libxc/xc_load_aout9.c	Fri Jun 24 10:54:54 2005 +0000
     1.2 +++ b/tools/libxc/xc_load_aout9.c	Fri Jun 24 20:50:15 2005 +0000
     1.3 @@ -19,7 +19,7 @@
     1.4  static int parseaout9image(char *, unsigned long, struct domain_setup_info *);
     1.5  static int loadaout9image(char *, unsigned long, int, u32, unsigned long *, struct domain_setup_info *);
     1.6  static void copyout(int, u32, unsigned long *, unsigned long, void *, int);
     1.7 -struct Exec *get_header(unsigned char *, unsigned long, struct Exec *);
     1.8 +struct Exec *get_header(char *, unsigned long, struct Exec *);
     1.9  
    1.10  
    1.11  int 
    1.12 @@ -133,17 +133,20 @@ copyout(
    1.13          sz -= chunksz;
    1.14      }
    1.15  }
    1.16 -    
    1.17 +
    1.18 +#define swap16(_v) ((((u16)(_v)>>8)&0xff)|(((u16)(_v)&0xff)<<8))
    1.19 +#define swap32(_v) (((u32)swap16((u16)(_v))<<16)|(u32)swap16((u32)((_v)>>16)))
    1.20 +
    1.21  /*
    1.22   * Decode the header from the start of image and return it.
    1.23   */
    1.24  struct Exec *
    1.25  get_header(
    1.26 -    unsigned char *image,
    1.27 +    char *image,
    1.28      unsigned long image_size,
    1.29      struct Exec *ehdr)
    1.30  {
    1.31 -    unsigned long *v;
    1.32 +    u32 *v, x;
    1.33      int i;
    1.34  
    1.35      if (A9_MAGIC == 0)
    1.36 @@ -153,10 +156,10 @@ get_header(
    1.37          return 0;
    1.38  
    1.39      /* ... all big endian words */
    1.40 -    v = (unsigned long *)ehdr;
    1.41 -    for (i = 0; i < sizeof *ehdr; i += 4) {
    1.42 -        v[i/4] = (image[i+0]<<24) | (image[i+1]<<16) | 
    1.43 -                 (image[i+2]<<8) | image[i+3];
    1.44 +    v = (u32 *)ehdr;
    1.45 +    for (i = 0; i < sizeof(*ehdr); i += 4) {
    1.46 +        x = *(u32 *)&image[i];
    1.47 +        v[i/4] = swap32(x);
    1.48      }
    1.49  
    1.50      if(ehdr->magic != A9_MAGIC)
     2.1 --- a/xen/arch/x86/vmx_io.c	Fri Jun 24 10:54:54 2005 +0000
     2.2 +++ b/xen/arch/x86/vmx_io.c	Fri Jun 24 20:50:15 2005 +0000
     2.3 @@ -181,7 +181,7 @@ static void load_cpu_user_regs(struct cp
     2.4      __vmwrite(GUEST_RIP, regs->rip);
     2.5  }
     2.6  
     2.7 -static inline void __set_reg_value(long *reg, int size, long value)
     2.8 +static inline void __set_reg_value(unsigned long *reg, int size, long value)
     2.9  {
    2.10      switch (size) {
    2.11          case BYTE_64: