aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-06-24 20:50:15 +0000
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-06-24 20:50:15 +0000
commit8d629caa2712eca710eb031ccf7580f14db575ba (patch)
tree6289c949578b545f18ed2d18c0da13d33dabcf15
parentdc0838d4990d1975a5eda824a61db310e98dfd58 (diff)
downloadxen-8d629caa2712eca710eb031ccf7580f14db575ba.tar.gz
xen-8d629caa2712eca710eb031ccf7580f14db575ba.tar.bz2
xen-8d629caa2712eca710eb031ccf7580f14db575ba.zip
bitkeeper revision 1.1754 (42bc7207le_rYvV9kj8p-Dztt3T_eA)
Fix signedness issues, found by Jerone Young.
-rw-r--r--tools/libxc/xc_load_aout9.c19
-rw-r--r--xen/arch/x86/vmx_io.c2
2 files changed, 12 insertions, 9 deletions
diff --git a/tools/libxc/xc_load_aout9.c b/tools/libxc/xc_load_aout9.c
index 76ee55fcc6..bb747b9d8c 100644
--- a/tools/libxc/xc_load_aout9.c
+++ b/tools/libxc/xc_load_aout9.c
@@ -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 @@ copyout(
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 @@ get_header(
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 --git a/xen/arch/x86/vmx_io.c b/xen/arch/x86/vmx_io.c
index 905df193b4..3914791a77 100644
--- a/xen/arch/x86/vmx_io.c
+++ b/xen/arch/x86/vmx_io.c
@@ -181,7 +181,7 @@ static void load_cpu_user_regs(struct cpu_user_regs *regs)
__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: