ia64/xen-unstable

changeset 16467:dc3a566f9e44

x86_emulate: Emulate LDS/LES/LFS/LGS/LSS.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Nov 26 13:54:45 2007 +0000 (2007-11-26)
parents bb961bda7eff
children 9f61a0add5b6
files xen/arch/x86/x86_emulate.c
line diff
     1.1 --- a/xen/arch/x86/x86_emulate.c	Sun Nov 25 21:24:48 2007 +0000
     1.2 +++ b/xen/arch/x86/x86_emulate.c	Mon Nov 26 13:54:45 2007 +0000
     1.3 @@ -149,7 +149,8 @@ static uint8_t opcode_table[256] = {
     1.4      /* 0xC0 - 0xC7 */
     1.5      ByteOp|DstMem|SrcImm|ModRM, DstMem|SrcImmByte|ModRM,
     1.6      ImplicitOps, ImplicitOps,
     1.7 -    0, 0, ByteOp|DstMem|SrcImm|ModRM|Mov, DstMem|SrcImm|ModRM|Mov,
     1.8 +    DstReg|SrcMem|ModRM|Mov, DstReg|SrcMem|ModRM|Mov,
     1.9 +    ByteOp|DstMem|SrcImm|ModRM|Mov, DstMem|SrcImm|ModRM|Mov,
    1.10      /* 0xC8 - 0xCF */
    1.11      0, 0, 0, 0, ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
    1.12      /* 0xD0 - 0xD7 */
    1.13 @@ -230,8 +231,9 @@ static uint8_t twobyte_table[256] = {
    1.14      0, 0, 0, DstReg|SrcMem|ModRM,
    1.15      /* 0xB0 - 0xB7 */
    1.16      ByteOp|DstMem|SrcReg|ModRM, DstMem|SrcReg|ModRM,
    1.17 -    0, DstBitBase|SrcReg|ModRM,
    1.18 -    0, 0, ByteOp|DstReg|SrcMem|ModRM|Mov, DstReg|SrcMem16|ModRM|Mov,
    1.19 +    DstReg|SrcMem|ModRM|Mov, DstBitBase|SrcReg|ModRM,
    1.20 +    DstReg|SrcMem|ModRM|Mov, DstReg|SrcMem|ModRM|Mov,
    1.21 +    ByteOp|DstReg|SrcMem|ModRM|Mov, DstReg|SrcMem16|ModRM|Mov,
    1.22      /* 0xB8 - 0xBF */
    1.23      0, 0, DstBitBase|SrcImmByte|ModRM, DstBitBase|SrcReg|ModRM,
    1.24      DstReg|SrcMem|ModRM, DstReg|SrcMem|ModRM,
    1.25 @@ -1470,6 +1472,24 @@ x86_emulate(
    1.26          }
    1.27          break;
    1.28  
    1.29 +    case 0xc4: /* les */ {
    1.30 +        unsigned long sel;
    1.31 +        dst.val = x86_seg_es;
    1.32 +    les:
    1.33 +        generate_exception_if(src.type != OP_MEM, EXC_UD);
    1.34 +        if ( (rc = ops->read(src.mem.seg, src.mem.off + src.bytes,
    1.35 +                             &sel, 2, ctxt)) != 0 )
    1.36 +            goto done;
    1.37 +        if ( (rc = load_seg(dst.val, (uint16_t)sel, ctxt, ops)) != 0 )
    1.38 +            goto done;
    1.39 +        dst.val = src.val;
    1.40 +        break;
    1.41 +    }
    1.42 +
    1.43 +    case 0xc5: /* lds */
    1.44 +        dst.val = x86_seg_ds;
    1.45 +        goto les;
    1.46 +
    1.47      case 0xd0 ... 0xd1: /* Grp2 */
    1.48          src.val = 1;
    1.49          goto grp2;
    1.50 @@ -2536,6 +2556,18 @@ x86_emulate(
    1.51          }
    1.52          break;
    1.53  
    1.54 +    case 0xb2: /* lss */
    1.55 +        dst.val = x86_seg_ss;
    1.56 +        goto les;
    1.57 +
    1.58 +    case 0xb4: /* lfs */
    1.59 +        dst.val = x86_seg_fs;
    1.60 +        goto les;
    1.61 +
    1.62 +    case 0xb5: /* lgs */
    1.63 +        dst.val = x86_seg_gs;
    1.64 +        goto les;
    1.65 +
    1.66      case 0xb6: /* movzx rm8,r{16,32,64} */
    1.67          /* Recompute DstReg as we may have decoded AH/BH/CH/DH. */
    1.68          dst.reg   = decode_register(modrm_reg, &_regs, 0);