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
|