direct-io.hg

changeset 13400:6d832b092857

[XEN] A few emulator fixes.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Wed Jan 17 15:41:39 2007 +0000 (2007-01-17)
parents 8690e3448971
children dd0989523d17
files xen/arch/x86/x86_emulate.c
line diff
     1.1 --- a/xen/arch/x86/x86_emulate.c	Wed Jan 17 15:09:50 2007 +0000
     1.2 +++ b/xen/arch/x86/x86_emulate.c	Wed Jan 17 15:41:39 2007 +0000
     1.3 @@ -1156,7 +1156,9 @@ x86_emulate(
     1.4          break;
     1.5      }
     1.6  
     1.7 -    case 0x80 ... 0x83: /* Grp1 */
     1.8 +    case 0x82: /* Grp1 (x86/32 only) */
     1.9 +        generate_exception_if(mode_64bit(), EXC_UD);
    1.10 +    case 0x80: case 0x81: case 0x83: /* Grp1 */
    1.11          switch ( modrm_reg & 7 )
    1.12          {
    1.13          case 0: goto add;
    1.14 @@ -1477,7 +1479,7 @@ x86_emulate(
    1.15              emulate_1op("dec", dst, _regs.eflags);
    1.16              break;
    1.17          case 2: /* call (near) */
    1.18 -        case 3: /* jmp (near) */
    1.19 +        case 4: /* jmp (near) */
    1.20              if ( ((op_bytes = dst.bytes) != 8) && mode_64bit() )
    1.21              {
    1.22                  dst.bytes = op_bytes = 8;
    1.23 @@ -2049,12 +2051,13 @@ x86_emulate(
    1.24          break;
    1.25  
    1.26      case 0xba: /* Grp8 */
    1.27 -        switch ( modrm_reg & 3 )
    1.28 +        switch ( modrm_reg & 7 )
    1.29          {
    1.30 -        case 0: goto bt;
    1.31 -        case 1: goto bts;
    1.32 -        case 2: goto btr;
    1.33 -        case 3: goto btc;
    1.34 +        case 4: goto bt;
    1.35 +        case 5: goto bts;
    1.36 +        case 6: goto btr;
    1.37 +        case 7: goto btc;
    1.38 +        default: generate_exception_if(1, EXC_UD);
    1.39          }
    1.40          break;
    1.41  
    1.42 @@ -2103,6 +2106,7 @@ x86_emulate(
    1.43  #if defined(__i386__)
    1.44      {
    1.45          unsigned long old_lo, old_hi;
    1.46 +        generate_exception_if((modrm_reg & 7) != 1, EXC_UD);
    1.47          if ( (rc = ops->read(ea.mem.seg, ea.mem.off+0, &old_lo, 4, ctxt)) ||
    1.48               (rc = ops->read(ea.mem.seg, ea.mem.off+4, &old_hi, 4, ctxt)) )
    1.49              goto done;
    1.50 @@ -2129,6 +2133,7 @@ x86_emulate(
    1.51  #elif defined(__x86_64__)
    1.52      {
    1.53          unsigned long old, new;
    1.54 +        generate_exception_if((modrm_reg & 7) != 1, EXC_UD);
    1.55          if ( (rc = ops->read(ea.mem.seg, ea.mem.off, &old, 8, ctxt)) != 0 )
    1.56              goto done;
    1.57          if ( ((uint32_t)(old>>0) != (uint32_t)_regs.eax) ||