direct-io.hg

changeset 15058:3581a77791e3

64-bit hvm on 32-bit dom0 - ioemu adjustments

Don't mask off data bits when running 64-bit hvm guests on 32-bit dom0.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author kfraser@localhost.localdomain
date Tue May 15 09:59:51 2007 +0100 (2007-05-15)
parents 75b4c7cb007d
children e1d9d2884245
files tools/ioemu/target-i386-dm/helper2.c
line diff
     1.1 --- a/tools/ioemu/target-i386-dm/helper2.c	Tue May 15 09:54:27 2007 +0100
     1.2 +++ b/tools/ioemu/target-i386-dm/helper2.c	Tue May 15 09:59:51 2007 +0100
     1.3 @@ -322,7 +322,7 @@ void cpu_ioreq_pio(CPUState *env, ioreq_
     1.4              do_outp(env, req->addr, req->size, req->data);
     1.5          } else {
     1.6              for (i = 0; i < req->count; i++) {
     1.7 -                unsigned long tmp;
     1.8 +                unsigned long tmp = 0;
     1.9  
    1.10                  read_physical((target_phys_addr_t) req->data
    1.11                    + (sign * i * req->size),
    1.12 @@ -354,7 +354,7 @@ void cpu_ioreq_move(CPUState *env, ioreq
    1.13              }
    1.14          }
    1.15      } else {
    1.16 -        unsigned long tmp;
    1.17 +        target_ulong tmp;
    1.18  
    1.19          if (req->dir == IOREQ_READ) {
    1.20              for (i = 0; i < req->count; i++) {
    1.21 @@ -380,14 +380,14 @@ void cpu_ioreq_move(CPUState *env, ioreq
    1.22  
    1.23  void cpu_ioreq_and(CPUState *env, ioreq_t *req)
    1.24  {
    1.25 -    unsigned long tmp1, tmp2;
    1.26 +    target_ulong tmp1, tmp2;
    1.27  
    1.28      if (req->data_is_ptr != 0)
    1.29          hw_error("expected scalar value");
    1.30  
    1.31      read_physical(req->addr, req->size, &tmp1);
    1.32      if (req->dir == IOREQ_WRITE) {
    1.33 -        tmp2 = tmp1 & (unsigned long) req->data;
    1.34 +        tmp2 = tmp1 & (target_ulong) req->data;
    1.35          write_physical(req->addr, req->size, &tmp2);
    1.36      }
    1.37      req->data = tmp1;
    1.38 @@ -395,14 +395,14 @@ void cpu_ioreq_and(CPUState *env, ioreq_
    1.39  
    1.40  void cpu_ioreq_add(CPUState *env, ioreq_t *req)
    1.41  {
    1.42 -    unsigned long tmp1, tmp2;
    1.43 +    target_ulong tmp1, tmp2;
    1.44  
    1.45      if (req->data_is_ptr != 0)
    1.46          hw_error("expected scalar value");
    1.47  
    1.48      read_physical(req->addr, req->size, &tmp1);
    1.49      if (req->dir == IOREQ_WRITE) {
    1.50 -        tmp2 = tmp1 + (unsigned long) req->data;
    1.51 +        tmp2 = tmp1 + (target_ulong) req->data;
    1.52          write_physical(req->addr, req->size, &tmp2);
    1.53      }
    1.54      req->data = tmp1;
    1.55 @@ -410,14 +410,14 @@ void cpu_ioreq_add(CPUState *env, ioreq_
    1.56  
    1.57  void cpu_ioreq_sub(CPUState *env, ioreq_t *req)
    1.58  {
    1.59 -    unsigned long tmp1, tmp2;
    1.60 +    target_ulong tmp1, tmp2;
    1.61  
    1.62      if (req->data_is_ptr != 0)
    1.63          hw_error("expected scalar value");
    1.64  
    1.65      read_physical(req->addr, req->size, &tmp1);
    1.66      if (req->dir == IOREQ_WRITE) {
    1.67 -        tmp2 = tmp1 - (unsigned long) req->data;
    1.68 +        tmp2 = tmp1 - (target_ulong) req->data;
    1.69          write_physical(req->addr, req->size, &tmp2);
    1.70      }
    1.71      req->data = tmp1;
    1.72 @@ -425,14 +425,14 @@ void cpu_ioreq_sub(CPUState *env, ioreq_
    1.73  
    1.74  void cpu_ioreq_or(CPUState *env, ioreq_t *req)
    1.75  {
    1.76 -    unsigned long tmp1, tmp2;
    1.77 +    target_ulong tmp1, tmp2;
    1.78  
    1.79      if (req->data_is_ptr != 0)
    1.80          hw_error("expected scalar value");
    1.81  
    1.82      read_physical(req->addr, req->size, &tmp1);
    1.83      if (req->dir == IOREQ_WRITE) {
    1.84 -        tmp2 = tmp1 | (unsigned long) req->data;
    1.85 +        tmp2 = tmp1 | (target_ulong) req->data;
    1.86          write_physical(req->addr, req->size, &tmp2);
    1.87      }
    1.88      req->data = tmp1;
    1.89 @@ -440,14 +440,14 @@ void cpu_ioreq_or(CPUState *env, ioreq_t
    1.90  
    1.91  void cpu_ioreq_xor(CPUState *env, ioreq_t *req)
    1.92  {
    1.93 -    unsigned long tmp1, tmp2;
    1.94 +    target_ulong tmp1, tmp2;
    1.95  
    1.96      if (req->data_is_ptr != 0)
    1.97          hw_error("expected scalar value");
    1.98  
    1.99      read_physical(req->addr, req->size, &tmp1);
   1.100      if (req->dir == IOREQ_WRITE) {
   1.101 -        tmp2 = tmp1 ^ (unsigned long) req->data;
   1.102 +        tmp2 = tmp1 ^ (target_ulong) req->data;
   1.103          write_physical(req->addr, req->size, &tmp2);
   1.104      }
   1.105      req->data = tmp1;
   1.106 @@ -495,12 +495,9 @@ void cpu_ioreq_xchg(CPUState *env, ioreq
   1.107  
   1.108  void __handle_ioreq(CPUState *env, ioreq_t *req)
   1.109  {
   1.110 -    if (!req->data_is_ptr && (req->dir == IOREQ_WRITE)) {
   1.111 -        /* Clamp data operand to size of a long. */
   1.112 -        if (req->size < sizeof(long))
   1.113 -            req->data &= (1UL << (8 * req->size)) - 1;
   1.114 -        req->data = (unsigned long)req->data;
   1.115 -    }
   1.116 +    if (!req->data_is_ptr && (req->dir == IOREQ_WRITE) &&
   1.117 +        (req->size < sizeof(target_ulong)))
   1.118 +        req->data &= ((target_ulong)1 << (8 * req->size)) - 1;
   1.119  
   1.120      switch (req->type) {
   1.121      case IOREQ_TYPE_PIO: