ia64/xen-unstable

changeset 17010:5e08872c24f7

x86_emulate: Handle rep_ins, rep_outs, rep_movs hook failure and fall
back to slow path.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Feb 07 18:56:47 2008 +0000 (2008-02-07)
parents 445edf4089a3
children 8e4cd0658c41
files xen/arch/x86/x86_emulate.c
line diff
     1.1 --- a/xen/arch/x86/x86_emulate.c	Thu Feb 07 18:00:44 2008 +0000
     1.2 +++ b/xen/arch/x86/x86_emulate.c	Thu Feb 07 18:56:47 2008 +0000
     1.3 @@ -2225,11 +2225,12 @@ x86_emulate(
     1.4          dst.bytes = !(b & 1) ? 1 : (op_bytes == 8) ? 4 : op_bytes;
     1.5          dst.mem.seg = x86_seg_es;
     1.6          dst.mem.off = truncate_ea(_regs.edi);
     1.7 -        if ( (nr_reps > 1) && (ops->rep_ins != NULL) )
     1.8 +        if ( (nr_reps > 1) && (ops->rep_ins != NULL) &&
     1.9 +             ((rc = ops->rep_ins((uint16_t)_regs.edx, dst.mem.seg,
    1.10 +                                 dst.mem.off, dst.bytes,
    1.11 +                                 &nr_reps, ctxt)) != X86EMUL_UNHANDLEABLE) )
    1.12          {
    1.13 -            if ( (rc = ops->rep_ins((uint16_t)_regs.edx, dst.mem.seg,
    1.14 -                                    dst.mem.off, dst.bytes,
    1.15 -                                    &nr_reps, ctxt)) != 0 )
    1.16 +            if ( rc != 0 )
    1.17                  goto done;
    1.18          }
    1.19          else
    1.20 @@ -2252,11 +2253,12 @@ x86_emulate(
    1.21          unsigned long nr_reps = get_rep_prefix();
    1.22          generate_exception_if(!mode_iopl(), EXC_GP);
    1.23          dst.bytes = !(b & 1) ? 1 : (op_bytes == 8) ? 4 : op_bytes;
    1.24 -        if ( (nr_reps > 1) && (ops->rep_outs != NULL) )
    1.25 +        if ( (nr_reps > 1) && (ops->rep_outs != NULL) &&
    1.26 +             ((rc = ops->rep_outs(ea.mem.seg, truncate_ea(_regs.esi),
    1.27 +                                  (uint16_t)_regs.edx, dst.bytes,
    1.28 +                                  &nr_reps, ctxt)) != X86EMUL_UNHANDLEABLE) )
    1.29          {
    1.30 -            if ( (rc = ops->rep_outs(ea.mem.seg, truncate_ea(_regs.esi),
    1.31 -                                     (uint16_t)_regs.edx, dst.bytes,
    1.32 -                                     &nr_reps, ctxt)) != 0 )
    1.33 +            if ( rc != 0 )
    1.34                  goto done;
    1.35          }
    1.36          else
    1.37 @@ -2403,11 +2405,12 @@ x86_emulate(
    1.38          dst.bytes = (d & ByteOp) ? 1 : op_bytes;
    1.39          dst.mem.seg = x86_seg_es;
    1.40          dst.mem.off = truncate_ea(_regs.edi);
    1.41 -        if ( (nr_reps > 1) && (ops->rep_movs != NULL) )
    1.42 +        if ( (nr_reps > 1) && (ops->rep_movs != NULL) &&
    1.43 +             ((rc = ops->rep_movs(ea.mem.seg, truncate_ea(_regs.esi),
    1.44 +                                  dst.mem.seg, dst.mem.off, dst.bytes,
    1.45 +                                  &nr_reps, ctxt)) != X86EMUL_UNHANDLEABLE) )
    1.46          {
    1.47 -            if ( (rc = ops->rep_movs(ea.mem.seg, truncate_ea(_regs.esi),
    1.48 -                                     dst.mem.seg, dst.mem.off, dst.bytes,
    1.49 -                                     &nr_reps, ctxt)) != 0 )
    1.50 +            if ( rc != 0 )
    1.51                  goto done;
    1.52          }
    1.53          else