diff options
author | David Daney <ddaney@caviumnetworks.com> | 2012-06-06 17:50:17 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2012-07-23 08:55:55 -0400 |
commit | 914f848077fb2ec0ec9c041af9ae1101ed0320f3 (patch) | |
tree | 9295340938d017ae6afe4a1a1265db923b513a84 | |
parent | 497e5ff03f58583ada469db8a1aa34eced9dd63e (diff) |
MIPS: Octeon: Implement Octeon specific __copy_user_inatomic
The generic version seems to prefetch past the end of memory.
Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/3929/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | 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 88e0cddca205..db478dbb9c7b 100644 --- a/arch/mips/cavium-octeon/octeon-memcpy.S +++ b/arch/mips/cavium-octeon/octeon-memcpy.S | |||
@@ -164,6 +164,14 @@ | |||
164 | .set noat | 164 | .set noat |
165 | 165 | ||
166 | /* | 166 | /* |
167 | * t7 is used as a flag to note inatomic mode. | ||
168 | */ | ||
169 | LEAF(__copy_user_inatomic) | ||
170 | b __copy_user_common | ||
171 | li t7, 1 | ||
172 | END(__copy_user_inatomic) | ||
173 | |||
174 | /* | ||
167 | * A combined memcpy/__copy_user | 175 | * A combined memcpy/__copy_user |
168 | * __copy_user sets len to 0 for success; else to an upper bound of | 176 | * __copy_user sets len to 0 for success; else to an upper bound of |
169 | * the number of uncopied bytes. | 177 | * the number of uncopied bytes. |
@@ -174,6 +182,8 @@ LEAF(memcpy) /* a0=dst a1=src a2=len */ | |||
174 | move v0, dst /* return value */ | 182 | move v0, dst /* return value */ |
175 | __memcpy: | 183 | __memcpy: |
176 | FEXPORT(__copy_user) | 184 | FEXPORT(__copy_user) |
185 | li t7, 0 /* not inatomic */ | ||
186 | __copy_user_common: | ||
177 | /* | 187 | /* |
178 | * Note: dst & src may be unaligned, len may be 0 | 188 | * Note: dst & src may be unaligned, len may be 0 |
179 | * Temps | 189 | * Temps |
@@ -412,7 +422,6 @@ l_exc_copy: | |||
412 | * Assumes src < THREAD_BUADDR($28) | 422 | * Assumes src < THREAD_BUADDR($28) |
413 | */ | 423 | */ |
414 | LOAD t0, TI_TASK($28) | 424 | LOAD t0, TI_TASK($28) |
415 | nop | ||
416 | LOAD t0, THREAD_BUADDR(t0) | 425 | LOAD t0, THREAD_BUADDR(t0) |
417 | 1: | 426 | 1: |
418 | EXC( lb t1, 0(src), l_exc) | 427 | EXC( lb t1, 0(src), l_exc) |
@@ -422,10 +431,9 @@ EXC( lb t1, 0(src), l_exc) | |||
422 | ADD dst, dst, 1 | 431 | ADD dst, dst, 1 |
423 | l_exc: | 432 | l_exc: |
424 | LOAD t0, TI_TASK($28) | 433 | LOAD t0, TI_TASK($28) |
425 | nop | ||
426 | LOAD t0, THREAD_BUADDR(t0) # t0 is just past last good address | 434 | LOAD t0, THREAD_BUADDR(t0) # t0 is just past last good address |
427 | nop | ||
428 | SUB len, AT, t0 # len number of uncopied bytes | 435 | SUB len, AT, t0 # len number of uncopied bytes |
436 | bnez t7, 2f /* Skip the zeroing out part if inatomic */ | ||
429 | /* | 437 | /* |
430 | * Here's where we rely on src and dst being incremented in tandem, | 438 | * Here's where we rely on src and dst being incremented in tandem, |
431 | * See (3) above. | 439 | * See (3) above. |
@@ -443,7 +451,7 @@ l_exc: | |||
443 | ADD dst, dst, 1 | 451 | ADD dst, dst, 1 |
444 | bnez src, 1b | 452 | bnez src, 1b |
445 | SUB src, src, 1 | 453 | SUB src, src, 1 |
446 | jr ra | 454 | 2: jr ra |
447 | nop | 455 | nop |
448 | 456 | ||
449 | 457 | ||