From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: [PATCH] x86_64: properly update RSI/RDI after emulated ins/outs (again) Date: Thu, 01 Jun 2006 14:35:12 +0200 Message-ID: <447EFB20.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part9DB8AA10.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part9DB8AA10.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Unfortunately, the previous patch to address this wasn't taken unmodified, and the modification (c/s 10171, including most of the additions over the original patch) made the changes useless - the conditional operator yields unsigned if either of the operands is unsigned and the other is signed. Signed-off-by: Jan Beulich --=__Part9DB8AA10.0__= Content-Type: text/plain; name="xen-x86_64-string-ops-backward.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xen-x86_64-string-ops-backward.patch" --- /home/jbeulich/src/xen/2006-05-31/xen/arch/x86/traps.c 2006-06-01 13:23:27.000000000 +0200 +++ 2006-05-31/xen/arch/x86/traps.c 2006-06-01 14:05:40.000000000 +0200 @@ -876,7 +876,7 @@ static int emulate_privileged_op(struct PAGE_FAULT(regs->edi, USER_WRITE_FAULT); break; } - regs->edi += (regs->eflags & EF_DF) ? -(int)op_bytes : op_bytes; + regs->edi += (regs->eflags & EF_DF) ? -(long)op_bytes : op_bytes; break; case 0x6e: /* OUTSB */ @@ -902,7 +902,7 @@ static int emulate_privileged_op(struct outl_user((u32)data, (u16)regs->edx, v, regs); break; } - regs->esi += (regs->eflags & EF_DF) ? -(int)op_bytes : op_bytes; + regs->esi += (regs->eflags & EF_DF) ? -(long)op_bytes : op_bytes; break; } --- /home/jbeulich/src/xen/2006-05-31/xen/arch/x86/x86_emulate.c 2006-06-01 13:23:26.000000000 +0200 +++ 2006-05-31/xen/arch/x86/x86_emulate.c 2006-06-01 14:29:53.000000000 +0200 @@ -942,9 +942,9 @@ x86_emulate_memop( goto done; } register_address_increment( - _regs.esi, (_regs.eflags & EFLG_DF) ? -(int)dst.bytes : dst.bytes); + _regs.esi, (_regs.eflags & EFLG_DF) ? -(long)dst.bytes : dst.bytes); register_address_increment( - _regs.edi, (_regs.eflags & EFLG_DF) ? -(int)dst.bytes : dst.bytes); + _regs.edi, (_regs.eflags & EFLG_DF) ? -(long)dst.bytes : dst.bytes); break; case 0xa6 ... 0xa7: /* cmps */ DPRINTF("Urk! I don't handle CMPS.\n"); @@ -955,7 +955,7 @@ x86_emulate_memop( dst.ptr = (unsigned long *)cr2; dst.val = _regs.eax; register_address_increment( - _regs.edi, (_regs.eflags & EFLG_DF) ? -(int)dst.bytes : dst.bytes); + _regs.edi, (_regs.eflags & EFLG_DF) ? -(long)dst.bytes : dst.bytes); break; case 0xac ... 0xad: /* lods */ dst.type = OP_REG; @@ -964,7 +964,7 @@ x86_emulate_memop( if ( (rc = ops->read_emulated(cr2, &dst.val, dst.bytes, ctxt)) != 0 ) goto done; register_address_increment( - _regs.esi, (_regs.eflags & EFLG_DF) ? -(int)dst.bytes : dst.bytes); + _regs.esi, (_regs.eflags & EFLG_DF) ? -(long)dst.bytes : dst.bytes); break; case 0xae ... 0xaf: /* scas */ DPRINTF("Urk! I don't handle SCAS.\n"); --=__Part9DB8AA10.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part9DB8AA10.0__=--