## ia64/xen-unstable

### changeset 18342:504e5334f1a2

instructions to 4096 iterations.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser Tue Aug 19 18:52:04 2008 +0100 (2008-08-19) e6a4f6a682ba a864ba2f0aa5 xen/arch/x86/hvm/emulate.c
line diff
```     1.1 --- a/xen/arch/x86/hvm/emulate.c	Tue Aug 19 18:47:01 2008 +0100
1.2 +++ b/xen/arch/x86/hvm/emulate.c	Tue Aug 19 18:52:04 2008 +0100
1.3 @@ -210,7 +210,10 @@ static int hvmemul_linear_to_phys(
1.4      unsigned long pfn, npfn, done, todo, i;
1.5      int reverse;
1.6
1.7 -    /* Clip repetitions to a sensible maximum. */
1.8 +    /*
1.9 +     * Clip repetitions to a sensible maximum. This avoids extensive looping in
1.10 +     * this function while still amortising the cost of I/O trap-and-emulate.
1.11 +     */
1.12      *reps = min_t(unsigned long, *reps, 4096);
1.13
1.14      /* With no paging it's easy: linear == physical. */
1.15 @@ -297,7 +300,13 @@ static int hvmemul_virtual_to_linear(
1.16          return X86EMUL_OKAY;
1.17      }
1.18
1.19 +    /*
1.20 +     * Clip repetitions to avoid overflow when multiplying by @bytes_per_rep.
1.21 +     * The chosen maximum is very conservative but it's what we use in
1.22 +     * hvmemul_linear_to_phys() so there is no point in using a larger value.
1.23 +     */
1.24      *reps = min_t(unsigned long, *reps, 4096);
1.25 +
1.26      reg = hvmemul_get_seg_reg(seg, hvmemul_ctxt);
1.27
1.28      if ( (hvmemul_ctxt->ctxt.regs->eflags & X86_EFLAGS_DF) && (*reps > 1) )
```