diff options
author | David Daney <david.daney@cavium.com> | 2012-06-06 18:00:31 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2012-07-23 08:55:55 -0400 |
commit | bb0757ebb929d5d6ba484b4313976847285ba280 (patch) | |
tree | f3a138d260d52fca71d7170e42415235ce6cc46b /arch/mips/lib/memcpy.S | |
parent | 914f848077fb2ec0ec9c041af9ae1101ed0320f3 (diff) |
MIPS: Unify memcpy.S and memcpy-inatomic.S
We can save the 451 lines of code that comprise memcpy-inatomic.S at the
expense of a single instruction in the memcpy prolog. We also use an
additional register (t6), so this may cause increased register pressure in
some places as well. But I think the reduced maintenance burden, of not
having two nearly identical implementations, makes it worth it.
Signed-off-by: David Daney <david.daney@cavium.com>
Cc: linux-mips@linux-mips.org
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/lib/memcpy.S')
-rw-r--r-- | arch/mips/lib/memcpy.S | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/mips/lib/memcpy.S b/arch/mips/lib/memcpy.S index 56a1f85a1ce8..65192c06781e 100644 --- a/arch/mips/lib/memcpy.S +++ b/arch/mips/lib/memcpy.S | |||
@@ -183,6 +183,14 @@ | |||
183 | #endif | 183 | #endif |
184 | 184 | ||
185 | /* | 185 | /* |
186 | * t6 is used as a flag to note inatomic mode. | ||
187 | */ | ||
188 | LEAF(__copy_user_inatomic) | ||
189 | b __copy_user_common | ||
190 | li t6, 1 | ||
191 | END(__copy_user_inatomic) | ||
192 | |||
193 | /* | ||
186 | * A combined memcpy/__copy_user | 194 | * A combined memcpy/__copy_user |
187 | * __copy_user sets len to 0 for success; else to an upper bound of | 195 | * __copy_user sets len to 0 for success; else to an upper bound of |
188 | * the number of uncopied bytes. | 196 | * the number of uncopied bytes. |
@@ -193,6 +201,8 @@ LEAF(memcpy) /* a0=dst a1=src a2=len */ | |||
193 | move v0, dst /* return value */ | 201 | move v0, dst /* return value */ |
194 | .L__memcpy: | 202 | .L__memcpy: |
195 | FEXPORT(__copy_user) | 203 | FEXPORT(__copy_user) |
204 | li t6, 0 /* not inatomic */ | ||
205 | __copy_user_common: | ||
196 | /* | 206 | /* |
197 | * Note: dst & src may be unaligned, len may be 0 | 207 | * Note: dst & src may be unaligned, len may be 0 |
198 | * Temps | 208 | * Temps |
@@ -458,6 +468,7 @@ EXC( lb t1, 0(src), .Ll_exc) | |||
458 | LOAD t0, THREAD_BUADDR(t0) # t0 is just past last good address | 468 | LOAD t0, THREAD_BUADDR(t0) # t0 is just past last good address |
459 | nop | 469 | nop |
460 | SUB len, AT, t0 # len number of uncopied bytes | 470 | SUB len, AT, t0 # len number of uncopied bytes |
471 | bnez t6, .Ldone /* Skip the zeroing part if inatomic */ | ||
461 | /* | 472 | /* |
462 | * Here's where we rely on src and dst being incremented in tandem, | 473 | * Here's where we rely on src and dst being incremented in tandem, |
463 | * See (3) above. | 474 | * See (3) above. |