54 lines
2.0 KiB
Diff
54 lines
2.0 KiB
Diff
|
# HG changeset patch
|
||
|
# User Keir Fraser <keir.fraser@citrix.com>
|
||
|
# Date 1271353678 -3600
|
||
|
# Node ID d18e6a6c618af4f25a9e1a57c9e3eac55921678c
|
||
|
# Parent ffffddc4b1e030cce6bd4d12c4409c94599c1abf
|
||
|
x86_emulate: Emulate CLFLUSH instruction
|
||
|
|
||
|
We recently found that FreeBSD 8.0 guest failed to install and boot on
|
||
|
Xen. The reason was that FreeBSD detected clflush feature and invoked
|
||
|
this instruction to flush MMIO space. This caused a page fault; but
|
||
|
x86_emulate.c failed to emulate this instruction (not supported). As a
|
||
|
result, a page fault was detected inside FreeBSD. A similar issue was
|
||
|
reported earlier.
|
||
|
|
||
|
http://lists.xensource.com/archives/html/xen-devel/2010-03/msg00362.html
|
||
|
|
||
|
From: Wei Huang <wei.huang2@amd.com>
|
||
|
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
|
||
|
|
||
|
Index: xen-4.0.0-testing/xen/arch/x86/x86_emulate/x86_emulate.c
|
||
|
===================================================================
|
||
|
--- xen-4.0.0-testing.orig/xen/arch/x86/x86_emulate/x86_emulate.c
|
||
|
+++ xen-4.0.0-testing/xen/arch/x86/x86_emulate/x86_emulate.c
|
||
|
@@ -227,7 +227,8 @@ static uint8_t twobyte_table[256] = {
|
||
|
DstMem|SrcReg|ModRM, DstMem|SrcReg|ModRM, 0, 0,
|
||
|
/* 0xA8 - 0xAF */
|
||
|
ImplicitOps, ImplicitOps, 0, DstBitBase|SrcReg|ModRM,
|
||
|
- DstMem|SrcReg|ModRM, DstMem|SrcReg|ModRM, 0, DstReg|SrcMem|ModRM,
|
||
|
+ DstMem|SrcReg|ModRM, DstMem|SrcReg|ModRM,
|
||
|
+ ImplicitOps|ModRM, DstReg|SrcMem|ModRM,
|
||
|
/* 0xB0 - 0xB7 */
|
||
|
ByteOp|DstMem|SrcReg|ModRM, DstMem|SrcReg|ModRM,
|
||
|
DstReg|SrcMem|ModRM|Mov, DstBitBase|SrcReg|ModRM,
|
||
|
@@ -4008,6 +4009,19 @@ x86_emulate(
|
||
|
emulate_2op_SrcV_nobyte("bts", src, dst, _regs.eflags);
|
||
|
break;
|
||
|
|
||
|
+ case 0xae: /* Grp15 */
|
||
|
+ switch ( modrm_reg & 7 )
|
||
|
+ {
|
||
|
+ case 7: /* clflush */
|
||
|
+ fail_if(ops->wbinvd == NULL);
|
||
|
+ if ( (rc = ops->wbinvd(ctxt)) != 0 )
|
||
|
+ goto done;
|
||
|
+ break;
|
||
|
+ default:
|
||
|
+ goto cannot_emulate;
|
||
|
+ }
|
||
|
+ break;
|
||
|
+
|
||
|
case 0xaf: /* imul */
|
||
|
_regs.eflags &= ~(EFLG_OF|EFLG_CF);
|
||
|
switch ( dst.bytes )
|