# HG changeset patch # User Keir Fraser # Date 1250694095 -3600 # Node ID 090e394202d0bb0089abc5e5276ed7fda283567d # Parent daf1ff2c7dbd59b2ab31e6427be58ffdc14e10fd x86_emulate: Fixes for 'mov rm16,sreg' 1. Memory reads should be 16 bits only 2. Attempt to load %cs should result in #UD Signed-off-by: Keir Fraser xen-unstable changeset: 20035:3fe64f43944f xen-unstable date: Fri Aug 07 10:53:22 2009 +0100 Index: xen-3.4.1-testing/xen/arch/x86/x86_emulate/x86_emulate.c =================================================================== --- xen-3.4.1-testing.orig/xen/arch/x86/x86_emulate/x86_emulate.c +++ xen-3.4.1-testing/xen/arch/x86/x86_emulate/x86_emulate.c @@ -113,7 +113,7 @@ static uint8_t opcode_table[256] = { ByteOp|DstMem|SrcReg|ModRM|Mov, DstMem|SrcReg|ModRM|Mov, ByteOp|DstReg|SrcMem|ModRM|Mov, DstReg|SrcMem|ModRM|Mov, DstMem|SrcReg|ModRM|Mov, DstReg|SrcNone|ModRM, - DstReg|SrcMem|ModRM|Mov, DstMem|SrcNone|ModRM|Mov, + DstReg|SrcMem16|ModRM|Mov, DstMem|SrcNone|ModRM|Mov, /* 0x90 - 0x97 */ ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, @@ -2008,6 +2008,7 @@ x86_emulate( case 0x8e: /* mov r/m,Sreg */ { enum x86_segment seg = decode_segment(modrm_reg); generate_exception_if(seg == decode_segment_failed, EXC_UD, -1); + generate_exception_if(seg == x86_seg_cs, EXC_UD, -1); if ( (rc = load_seg(seg, (uint16_t)src.val, ctxt, ops)) != 0 ) goto done; if ( seg == x86_seg_ss )