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] ioemu: Assembler memcpy() for x86, and lo

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] ioemu: Assembler memcpy() for x86, and lowest-common-denominator
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 19 Jun 2007 14:41:34 -0700
Delivery-date: Tue, 19 Jun 2007 14:39:59 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/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 kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1182265695 -3600
# Node ID 896b536d66c9952fac4bd1c9a6e3f562debec19d
# Parent  cb747a35e057ad2536fc560d21d43a1ade1faae5
ioemu: Assembler memcpy() for x86, and lowest-common-denominator
memcpy() function for all others, avoiding noisy longword copies on
ia64.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 tools/ioemu/target-i386-dm/exec-dm.c |   42 ++++++++++++++++++++++++++---------
 1 files changed, 32 insertions(+), 10 deletions(-)

diff -r cb747a35e057 -r 896b536d66c9 tools/ioemu/target-i386-dm/exec-dm.c
--- a/tools/ioemu/target-i386-dm/exec-dm.c      Tue Jun 19 15:55:13 2007 +0100
+++ b/tools/ioemu/target-i386-dm/exec-dm.c      Tue Jun 19 16:08:15 2007 +0100
@@ -443,19 +443,40 @@ extern unsigned long logdirty_bitmap_siz
  * Forcing a word-sized read/write prevents the guest from seeing a partially
  * written word-sized atom.
  */
-void memcpy_words(void *dst, void *src, size_t n)
-{
-    while (n >= sizeof(long)) {
-        *((long *)dst) = *((long *)src);
-        dst = ((long *)dst) + 1;
-        src = ((long *)src) + 1;
-        n -= sizeof(long);
-    }
-
-    if (n & 4) {
+#if defined(__x86_64__) || defined(__i386__)
+static void memcpy_words(void *dst, void *src, size_t n)
+{
+    asm (
+        "   movl %%edx,%%ecx \n"
+#ifdef __x86_64
+        "   shrl $3,%%ecx    \n"
+        "   andl $7,%%edx    \n"
+        "   rep  movsq       \n"
+        "   test $4,%%edx    \n"
+        "   jz   1f          \n"
+        "   movsl            \n"
+#else /* __i386__ */
+        "   shrl $2,%%ecx    \n"
+        "   andl $3,%%edx    \n"
+        "   rep  movsl       \n"
+#endif
+        "1: test $2,%%edx    \n"
+        "   jz   1f          \n"
+        "   movsw            \n"
+        "1: test $1,%%edx    \n"
+        "   jz   1f          \n"
+        "   movsb            \n"
+        "1:                  \n"
+        : : "S" (src), "D" (dst), "d" (n) : "ecx" );
+}
+#else
+static void memcpy_words(void *dst, void *src, size_t n)
+{
+    while (n >= sizeof(uint32_t)) {
         *((uint32_t *)dst) = *((uint32_t *)src);
         dst = ((uint32_t *)dst) + 1;
         src = ((uint32_t *)src) + 1;
+        n -= sizeof(uint32_t);
     }
 
     if (n & 2) {
@@ -470,6 +491,7 @@ void memcpy_words(void *dst, void *src, 
         src = ((uint8_t *)src) + 1;
     }
 }
+#endif
 
 void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf, 
                             int len, int is_write)

_______________________________________________
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] ioemu: Assembler memcpy() for x86, and lowest-common-denominator, Xen patchbot-unstable <=