linux-mips
[Top] [All Lists]

[PATCH] MIPS: Octeon: Implement Octeon specific __copy_user_inatomic

To: linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: [PATCH] MIPS: Octeon: Implement Octeon specific __copy_user_inatomic
From: David Daney <ddaney.cavm@gmail.com>
Date: Wed, 6 Jun 2012 14:50:17 -0700
Cc: David Daney <ddaney@caviumnetworks.com>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=wCTwCHyCXV0QncUkmP1/ohK9HAxV7rNc81EjmPAOxYA=; b=CpRtpx+e1n+oapskvNtfNT9GaYxzgkDXIMMB7aSrtmdGFGSaU8TAMAc7FPjCmVG78C 5a85QwH/KWcCkYb4eJdrD0InK2sN7nYUhloCZEnXagMKIJQl5V8ZyaEr013CK0aGQ8s2 U1rc+XAsFtcSIGZa049Kngg0V0exJLDzb84iFtgX5xYBedIqFvPnsUFEKoNGkWdXYwoa s6JVIn1j/zXnQTXw4FaKwEOSL7M3RSjFhXwqeDzjewN6MvH6XKa2Qh2Qwchz9N8F2VSD +ZffvdPiF0zhOWi4M3VnKiuBKshs1OKNGMXqZ3xdtw8aEwftIIA7S30sbdHdrScB5ooR yUVg==
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Sender: linux-mips-bounce@linux-mips.org
From: David Daney <ddaney@caviumnetworks.com>

The generic version seems to prefetch past the end of memory.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 arch/mips/cavium-octeon/octeon-memcpy.S |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/mips/cavium-octeon/octeon-memcpy.S 
b/arch/mips/cavium-octeon/octeon-memcpy.S
index 88e0cdd..d55bd6a 100644
--- a/arch/mips/cavium-octeon/octeon-memcpy.S
+++ b/arch/mips/cavium-octeon/octeon-memcpy.S
@@ -164,6 +164,14 @@
        .set    noat
 
 /*
+ * t7 is used as a flag to note inatomic mode.
+ */
+LEAF(__copy_user_inatomic)
+       b       __copy_user_common
+        li     t7, 1
+       END(__copy_user_inatomic)
+
+/*
  * A combined memcpy/__copy_user
  * __copy_user sets len to 0 for success; else to an upper bound of
  * the number of uncopied bytes.
@@ -174,6 +182,8 @@ LEAF(memcpy)                                        /* 
a0=dst a1=src a2=len */
        move    v0, dst                         /* return value */
 __memcpy:
 FEXPORT(__copy_user)
+       li      t7, 0                           /* not inatomic */
+__copy_user_common:
        /*
         * Note: dst & src may be unaligned, len may be 0
         * Temps
@@ -412,7 +422,6 @@ l_exc_copy:
         * Assumes src < THREAD_BUADDR($28)
         */
        LOAD    t0, TI_TASK($28)
-        nop
        LOAD    t0, THREAD_BUADDR(t0)
 1:
 EXC(   lb      t1, 0(src),     l_exc)
@@ -422,10 +431,9 @@ EXC(       lb      t1, 0(src),     l_exc)
         ADD    dst, dst, 1
 l_exc:
        LOAD    t0, TI_TASK($28)
-        nop
        LOAD    t0, THREAD_BUADDR(t0)   # t0 is just past last good address
-        nop
        SUB     len, AT, t0             # len number of uncopied bytes
+       bnez    t7, 2f          /* Skip the zeroing out part if inatomic */
        /*
         * Here's where we rely on src and dst being incremented in tandem,
         *   See (3) above.
@@ -443,7 +451,7 @@ l_exc:
        ADD     dst, dst, 1
        bnez    src, 1b
         SUB    src, src, 1
-       jr      ra
+2:     jr      ra
         nop
 
 
-- 
1.7.2.3


<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] MIPS: Octeon: Implement Octeon specific __copy_user_inatomic, David Daney <=