ia64/xen-unstable

changeset 16478:c5332fa8b68d

x86_emulate: Emulate RETF and RETF imm16.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Nov 26 16:46:22 2007 +0000 (2007-11-26)
parents 9f61a0add5b6
children 11bfa26dd125
files xen/arch/x86/x86_emulate.c
line diff
     1.1 --- a/xen/arch/x86/x86_emulate.c	Mon Nov 26 15:32:54 2007 +0000
     1.2 +++ b/xen/arch/x86/x86_emulate.c	Mon Nov 26 16:46:22 2007 +0000
     1.3 @@ -152,7 +152,8 @@ static uint8_t opcode_table[256] = {
     1.4      DstReg|SrcMem|ModRM|Mov, DstReg|SrcMem|ModRM|Mov,
     1.5      ByteOp|DstMem|SrcImm|ModRM|Mov, DstMem|SrcImm|ModRM|Mov,
     1.6      /* 0xC8 - 0xCF */
     1.7 -    0, 0, 0, 0, ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
     1.8 +    0, 0, ImplicitOps, ImplicitOps,
     1.9 +    ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
    1.10      /* 0xD0 - 0xD7 */
    1.11      ByteOp|DstMem|SrcImplicit|ModRM, DstMem|SrcImplicit|ModRM, 
    1.12      ByteOp|DstMem|SrcImplicit|ModRM, DstMem|SrcImplicit|ModRM, 
    1.13 @@ -2262,6 +2263,20 @@ x86_emulate(
    1.14          break;
    1.15      }
    1.16  
    1.17 +    case 0xca: /* ret imm16 (far) */
    1.18 +    case 0xcb: /* ret (far) */ {
    1.19 +        int offset = (b == 0xca) ? insn_fetch_type(uint16_t) : 0;
    1.20 +        op_bytes = mode_64bit() ? 8 : op_bytes;
    1.21 +        if ( (rc = ops->read(x86_seg_ss, sp_post_inc(op_bytes),
    1.22 +                             &dst.val, op_bytes, ctxt)) || 
    1.23 +             (rc = ops->read(x86_seg_ss, sp_post_inc(op_bytes + offset),
    1.24 +                             &src.val, op_bytes, ctxt)) ||
    1.25 +             (rc = load_seg(x86_seg_cs, (uint16_t)src.val, ctxt, ops)) )
    1.26 +            goto done;
    1.27 +        _regs.eip = dst.val;
    1.28 +        break;
    1.29 +    }
    1.30 +
    1.31      case 0xcc: /* int3 */
    1.32          src.val = EXC_BP;
    1.33          goto swint;