ia64/xen-unstable

changeset 15092:3ecf51689671

hvm qemu: Fix for masking 64-bit operands broke 32-bit operands with
32-bit qemu. Issue spotted and initial fix provided by Dexuan Cui.
Signed-off-by: Keir Fraser <keir@xensource.com>
author Keir Fraser <keir@xensource.com>
date Sun May 13 10:04:34 2007 +0100 (2007-05-13)
parents 65ce4866d20b
children 9c2a616722da
files tools/ioemu/target-i386-dm/helper2.c
line diff
     1.1 --- a/tools/ioemu/target-i386-dm/helper2.c	Sat May 12 19:22:24 2007 +0100
     1.2 +++ b/tools/ioemu/target-i386-dm/helper2.c	Sun May 13 10:04:34 2007 +0100
     1.3 @@ -495,8 +495,12 @@ void cpu_ioreq_xchg(CPUState *env, ioreq
     1.4  
     1.5  void __handle_ioreq(CPUState *env, ioreq_t *req)
     1.6  {
     1.7 -    if (!req->data_is_ptr && (req->dir == IOREQ_WRITE) && (req->size != sizeof(req->data)))
     1.8 -	req->data &= (1UL << (8 * req->size)) - 1;
     1.9 +    if (!req->data_is_ptr && (req->dir == IOREQ_WRITE)) {
    1.10 +        /* Clamp data operand to size of a long. */
    1.11 +        if (req->size < sizeof(long))
    1.12 +            req->data &= (1UL << (8 * req->size)) - 1;
    1.13 +        req->data = (unsigned long)req->data;
    1.14 +    }
    1.15  
    1.16      switch (req->type) {
    1.17      case IOREQ_TYPE_PIO: