WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] x86 hvm: Add clarifying comments about cl

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86 hvm: Add clarifying comments about clipping repeated string
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 20 Aug 2008 02:20:17 -0700
Delivery-date: Wed, 20 Aug 2008 02:20:22 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1219168324 -3600
# Node ID 504e5334f1a2f8ff1ba53deec7475371c52ad29a
# Parent  e6a4f6a682ba534ce052cc9856cf53b03c24a95e
x86 hvm: Add clarifying comments about clipping repeated string
instructions to 4096 iterations.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/hvm/emulate.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletion(-)

diff -r e6a4f6a682ba -r 504e5334f1a2 xen/arch/x86/hvm/emulate.c
--- a/xen/arch/x86/hvm/emulate.c        Tue Aug 19 18:47:01 2008 +0100
+++ b/xen/arch/x86/hvm/emulate.c        Tue Aug 19 18:52:04 2008 +0100
@@ -210,7 +210,10 @@ static int hvmemul_linear_to_phys(
     unsigned long pfn, npfn, done, todo, i;
     int reverse;
 
-    /* Clip repetitions to a sensible maximum. */
+    /*
+     * Clip repetitions to a sensible maximum. This avoids extensive looping in
+     * this function while still amortising the cost of I/O trap-and-emulate.
+     */
     *reps = min_t(unsigned long, *reps, 4096);
 
     /* With no paging it's easy: linear == physical. */
@@ -297,7 +300,13 @@ static int hvmemul_virtual_to_linear(
         return X86EMUL_OKAY;
     }
 
+    /*
+     * Clip repetitions to avoid overflow when multiplying by @bytes_per_rep.
+     * The chosen maximum is very conservative but it's what we use in
+     * hvmemul_linear_to_phys() so there is no point in using a larger value.
+     */
     *reps = min_t(unsigned long, *reps, 4096);
+
     reg = hvmemul_get_seg_reg(seg, hvmemul_ctxt);
 
     if ( (hvmemul_ctxt->ctxt.regs->eflags & X86_EFLAGS_DF) && (*reps > 1) )

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86 hvm: Add clarifying comments about clipping repeated string, Xen patchbot-unstable <=