ia64/xen-unstable

changeset 10191:2dc7c2712700

Cast to a signed type before negating if we really want the result to be negative.
From: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri May 26 13:49:29 2006 +0100 (2006-05-26)
parents b049fb947f2a
children 3ed325fa395b
files xen/arch/x86/traps.c xen/arch/x86/x86_emulate.c
line diff
     1.1 --- a/xen/arch/x86/traps.c	Fri May 26 13:23:18 2006 +0100
     1.2 +++ b/xen/arch/x86/traps.c	Fri May 26 13:49:29 2006 +0100
     1.3 @@ -876,7 +876,7 @@ static int emulate_privileged_op(struct 
     1.4                      PAGE_FAULT(regs->edi, USER_WRITE_FAULT);
     1.5                  break;
     1.6              }
     1.7 -            regs->edi += (regs->eflags & EF_DF) ? -op_bytes : op_bytes;
     1.8 +            regs->edi += (regs->eflags & EF_DF) ? -(int)op_bytes : op_bytes;
     1.9              break;
    1.10  
    1.11          case 0x6e: /* OUTSB */
    1.12 @@ -902,7 +902,7 @@ static int emulate_privileged_op(struct 
    1.13                  outl_user((u32)data, (u16)regs->edx, v, regs);
    1.14                  break;
    1.15              }
    1.16 -            regs->esi += (regs->eflags & EF_DF) ? -op_bytes : op_bytes;
    1.17 +            regs->esi += (regs->eflags & EF_DF) ? -(int)op_bytes : op_bytes;
    1.18              break;
    1.19          }
    1.20  
     2.1 --- a/xen/arch/x86/x86_emulate.c	Fri May 26 13:23:18 2006 +0100
     2.2 +++ b/xen/arch/x86/x86_emulate.c	Fri May 26 13:49:29 2006 +0100
     2.3 @@ -858,7 +858,7 @@ x86_emulate_memop(
     2.4                                           &dst.val, 8, ctxt)) != 0 )
     2.5                      goto done;
     2.6              }
     2.7 -            register_address_increment(_regs.esp, -dst.bytes);
     2.8 +            register_address_increment(_regs.esp, -(int)dst.bytes);
     2.9              if ( (rc = ops->write_std(register_address(_regs.ss, _regs.esp),
    2.10                                        dst.val, dst.bytes, ctxt)) != 0 )
    2.11                  goto done;
    2.12 @@ -942,9 +942,9 @@ x86_emulate_memop(
    2.13                  goto done;
    2.14          }
    2.15          register_address_increment(
    2.16 -            _regs.esi, (_regs.eflags & EFLG_DF) ? -dst.bytes : dst.bytes);
    2.17 +            _regs.esi, (_regs.eflags & EFLG_DF) ? -(int)dst.bytes : dst.bytes);
    2.18          register_address_increment(
    2.19 -            _regs.edi, (_regs.eflags & EFLG_DF) ? -dst.bytes : dst.bytes);
    2.20 +            _regs.edi, (_regs.eflags & EFLG_DF) ? -(int)dst.bytes : dst.bytes);
    2.21          break;
    2.22      case 0xa6 ... 0xa7: /* cmps */
    2.23          DPRINTF("Urk! I don't handle CMPS.\n");
    2.24 @@ -955,7 +955,7 @@ x86_emulate_memop(
    2.25          dst.ptr   = (unsigned long *)cr2;
    2.26          dst.val   = _regs.eax;
    2.27          register_address_increment(
    2.28 -            _regs.edi, (_regs.eflags & EFLG_DF) ? -dst.bytes : dst.bytes);
    2.29 +            _regs.edi, (_regs.eflags & EFLG_DF) ? -(int)dst.bytes : dst.bytes);
    2.30          break;
    2.31      case 0xac ... 0xad: /* lods */
    2.32          dst.type  = OP_REG;
    2.33 @@ -964,7 +964,7 @@ x86_emulate_memop(
    2.34          if ( (rc = ops->read_emulated(cr2, &dst.val, dst.bytes, ctxt)) != 0 )
    2.35              goto done;
    2.36          register_address_increment(
    2.37 -            _regs.esi, (_regs.eflags & EFLG_DF) ? -dst.bytes : dst.bytes);
    2.38 +            _regs.esi, (_regs.eflags & EFLG_DF) ? -(int)dst.bytes : dst.bytes);
    2.39          break;
    2.40      case 0xae ... 0xaf: /* scas */
    2.41          DPRINTF("Urk! I don't handle SCAS.\n");