|
|
|
|
|
|
|
|
|
|
xen-changelog
[Xen-changelog] [xen-unstable] [XEN] Emulator fixes.
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID a98bec6aacac18c3d396c7e5d1481d3d84de3ffd
# Parent 81c9213b3d39573c0b50090958268cb6f068d59e
[XEN] Emulator fixes.
1. Fix RIP-relative EA calculation. Immediate operands are never 64-bit.
2. Displacements are sign-extended so used signed types.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
xen/arch/x86/x86_emulate.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff -r 81c9213b3d39 -r a98bec6aacac xen/arch/x86/x86_emulate.c
--- a/xen/arch/x86/x86_emulate.c Tue Nov 28 18:41:42 2006 +0000
+++ b/xen/arch/x86/x86_emulate.c Wed Nov 29 10:48:06 2006 +0000
@@ -615,9 +615,9 @@ x86_emulate_memop(
}
switch ( modrm_mod )
{
- case 0: if ( modrm_rm == 6 ) ea = insn_fetch(uint16_t); break;
- case 1: ea += insn_fetch(uint8_t); break;
- case 2: ea += insn_fetch(uint16_t); break;
+ case 0: if ( modrm_rm == 6 ) ea = insn_fetch(int16_t); break;
+ case 1: ea += insn_fetch(int8_t); break;
+ case 2: ea += insn_fetch(int16_t); break;
}
}
else
@@ -632,7 +632,7 @@ x86_emulate_memop(
ea = *(long *)decode_register(sib_index, &_regs, 0);
ea <<= (sib >> 6) & 3;
if ( (modrm_mod == 0) && ((sib_base & 7) == 5) )
- ea += insn_fetch(uint32_t);
+ ea += insn_fetch(int32_t);
else
ea += *(long *)decode_register(sib_base, &_regs, 0);
}
@@ -646,13 +646,13 @@ x86_emulate_memop(
case 0:
if ( (modrm_rm & 7) != 5 )
break;
- ea = insn_fetch(uint32_t);
+ ea = insn_fetch(int32_t);
if ( mode != X86EMUL_MODE_PROT64 )
break;
/* Relative to RIP of next instruction. Argh! */
ea += _regs.eip;
if ( (d & SrcMask) == SrcImm )
- ea += (d & ByteOp) ? 1 : op_bytes;
+ ea += (d & ByteOp) ? 1 : ((op_bytes == 8) ? 4 : op_bytes);
else if ( (d & SrcMask) == SrcImmByte )
ea += 1;
else if ( ((b == 0xf6) || (b == 0xf7)) &&
@@ -661,8 +661,8 @@ x86_emulate_memop(
ea += (d & ByteOp) ? 1
: ((op_bytes == 8) ? 4 : op_bytes);
break;
- case 1: ea += insn_fetch(uint8_t); break;
- case 2: ea += insn_fetch(uint32_t); break;
+ case 1: ea += insn_fetch(int8_t); break;
+ case 2: ea += insn_fetch(int32_t); break;
}
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-changelog] [xen-unstable] [XEN] Emulator fixes.,
Xen patchbot-unstable <=
|
|
|
|
|