Skip to contentSkip to conversation

x86: add movnti emulation

PATCH New Jan Beulich 1 participant 1 message Oct 17, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: add movnti emulation

Linux added the use of movnti for copying from user to kernel space in certain cases, and as per reports we got this may happen with the destination being in MMIO.

xen/arch/x86/x86_emulate/x86_emulate.c +8 -1
Index: 2008-09-19/xen/arch/x86/x86_emulate/x86_emulate.c
===================================================================
@@ -236,7 +236,8 @@ static uint8_t twobyte_table[256] = {
     DstReg|SrcMem|ModRM, DstReg|SrcMem|ModRM,
     ByteOp|DstReg|SrcMem|ModRM|Mov, DstReg|SrcMem16|ModRM|Mov,
     /* 0xC0 - 0xC7 */
-    ByteOp|DstMem|SrcReg|ModRM, DstMem|SrcReg|ModRM, 0, 0,
+    ByteOp|DstMem|SrcReg|ModRM, DstMem|SrcReg|ModRM,
+    0, DstMem|SrcReg|ModRM|Mov,
     0, 0, 0, ImplicitOps|ModRM,
     /* 0xC8 - 0xCF */
     ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
@@ -3910,6 +3911,12 @@ x86_emulate(
         }
         goto add;
 
+    case 0xc3: /* movnti */
+        /* Ignore the non-temporal hint for now. */
+        generate_exception_if(dst.bytes <= 2, EXC_UD, -1);
+        dst.val = src.val;
+        break;
+
     case 0xc7: /* Grp9 (cmpxchg8b/cmpxchg16b) */ {
         unsigned long old[2], exp[2], new[2];
         unsigned int i;