# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1199965356 0
# Node ID e8fca4c42d05d16906dc3f76e712a369292685a8
# Parent 464cfceb739b98e22c0a981bc2c341278e99b89c
Fix x86_emulate() handling of imul with immediate operands.
This fixes a repeatable crash in RHEL 4.2 ext2 filesystem during boot.
Signed-off-by: Gary Grebus <ggrebus@xxxxxxxxxxxxxxx>
Signed-off-by: Ben Guthro <bguthro@xxxxxxxxxxxxxxx>
xen-unstable changeset: 16695:4c1a0d2a318d5cd404f5411e31ba425f223a0e66
xen-unstable date: Wed Jan 09 10:09:04 2008 +0000
---
xen/arch/x86/x86_emulate.c | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diff -r 464cfceb739b -r e8fca4c42d05 xen/arch/x86/x86_emulate.c
--- a/xen/arch/x86/x86_emulate.c Thu Jan 10 11:41:26 2008 +0000
+++ b/xen/arch/x86/x86_emulate.c Thu Jan 10 11:42:36 2008 +0000
@@ -103,8 +103,8 @@ static uint8_t opcode_table[256] = {
ImplicitOps, ImplicitOps, DstReg|SrcMem|ModRM, DstReg|SrcMem16|ModRM|Mov,
0, 0, 0, 0,
/* 0x68 - 0x6F */
- ImplicitOps|Mov, DstMem|SrcImm|ModRM|Mov,
- ImplicitOps|Mov, DstMem|SrcImmByte|ModRM|Mov,
+ ImplicitOps|Mov, DstReg|SrcImm|ModRM|Mov,
+ ImplicitOps|Mov, DstReg|SrcImmByte|ModRM|Mov,
ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
/* 0x70 - 0x77 */
ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
@@ -1207,34 +1207,37 @@ x86_emulate(
case 0x69: /* imul imm16/32 */
case 0x6b: /* imul imm8 */ {
- unsigned long reg = *(long *)decode_register(modrm_reg, &_regs, 0);
+ unsigned long src1; /* ModR/M source operand */
+ if ( ea.type == OP_REG )
+ src1 = *ea.reg;
+ else if ( (rc = ops->read(ea.mem.seg, ea.mem.off,
+ &src1, op_bytes, ctxt)) )
+ goto done;
_regs.eflags &= ~(EFLG_OF|EFLG_CF);
switch ( dst.bytes )
{
case 2:
dst.val = ((uint32_t)(int16_t)src.val *
- (uint32_t)(int16_t)reg);
+ (uint32_t)(int16_t)src1);
if ( (int16_t)dst.val != (uint32_t)dst.val )
_regs.eflags |= EFLG_OF|EFLG_CF;
break;
#ifdef __x86_64__
case 4:
dst.val = ((uint64_t)(int32_t)src.val *
- (uint64_t)(int32_t)reg);
+ (uint64_t)(int32_t)src1);
if ( (int32_t)dst.val != dst.val )
_regs.eflags |= EFLG_OF|EFLG_CF;
break;
#endif
default: {
- unsigned long m[2] = { src.val, reg };
+ unsigned long m[2] = { src.val, src1 };
if ( imul_dbl(m) )
_regs.eflags |= EFLG_OF|EFLG_CF;
dst.val = m[0];
break;
}
}
- dst.type = OP_REG;
- dst.reg = decode_register(modrm_reg, &_regs, 0);
break;
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|