diff options
author | David S. Miller <davem@davemloft.net> | 2011-10-19 18:31:55 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-10-20 18:17:23 -0400 |
commit | a52312b88c8103e965979a79a07f6b34af82ca4b (patch) | |
tree | 65b96c797317eb83ea5779b360cc24227c6d8f89 /arch/sparc/lib/memcpy.S | |
parent | 21f74d361dfd6a7d0e47574e315f780d8172084a (diff) |
sparc32: Correct the return value of memcpy.
Properly return the original destination buffer pointer.
Signed-off-by: David S. Miller <davem@davemloft.net>
Tested-by: Kjetil Oftedal <oftedal@gmail.com>
Diffstat (limited to 'arch/sparc/lib/memcpy.S')
-rw-r--r-- | arch/sparc/lib/memcpy.S | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/arch/sparc/lib/memcpy.S b/arch/sparc/lib/memcpy.S index 90a598846bab..4d8c497517bd 100644 --- a/arch/sparc/lib/memcpy.S +++ b/arch/sparc/lib/memcpy.S | |||
@@ -13,14 +13,6 @@ | |||
13 | .align 4; \ | 13 | .align 4; \ |
14 | x: | 14 | x: |
15 | 15 | ||
16 | |||
17 | /* In kernel these functions don't return a value. | ||
18 | * One should use macros in asm/string.h for that purpose. | ||
19 | * We return 0, so that bugs are more apparent. | ||
20 | */ | ||
21 | #define SETUP_RETL | ||
22 | #define RETL_INSN clr %o0 | ||
23 | |||
24 | /* Both these macros have to start with exactly the same insn */ | 16 | /* Both these macros have to start with exactly the same insn */ |
25 | #define MOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, t7) \ | 17 | #define MOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, t7) \ |
26 | ldd [%src + (offset) + 0x00], %t0; \ | 18 | ldd [%src + (offset) + 0x00], %t0; \ |
@@ -154,7 +146,7 @@ FUNC(__memmove) | |||
154 | #endif | 146 | #endif |
155 | FUNC(memmove) | 147 | FUNC(memmove) |
156 | cmp %o0, %o1 | 148 | cmp %o0, %o1 |
157 | SETUP_RETL | 149 | mov %o0, %g7 |
158 | bleu 9f | 150 | bleu 9f |
159 | sub %o0, %o1, %o4 | 151 | sub %o0, %o1, %o4 |
160 | 152 | ||
@@ -178,7 +170,7 @@ FUNC(memmove) | |||
178 | sub %o0, 1, %o0 | 170 | sub %o0, 1, %o0 |
179 | 171 | ||
180 | retl | 172 | retl |
181 | RETL_INSN | 173 | mov %g7, %o0 |
182 | 174 | ||
183 | /* NOTE: This code is executed just for the cases, | 175 | /* NOTE: This code is executed just for the cases, |
184 | where %src (=%o1) & 3 is != 0. | 176 | where %src (=%o1) & 3 is != 0. |
@@ -212,7 +204,7 @@ FUNC(memmove) | |||
212 | FUNC(memcpy) /* %o0=dst %o1=src %o2=len */ | 204 | FUNC(memcpy) /* %o0=dst %o1=src %o2=len */ |
213 | 205 | ||
214 | sub %o0, %o1, %o4 | 206 | sub %o0, %o1, %o4 |
215 | SETUP_RETL | 207 | mov %o0, %g7 |
216 | 9: | 208 | 9: |
217 | andcc %o4, 3, %o5 | 209 | andcc %o4, 3, %o5 |
218 | 0: | 210 | 0: |
@@ -308,7 +300,7 @@ FUNC(memcpy) /* %o0=dst %o1=src %o2=len */ | |||
308 | stb %g2, [%o0] | 300 | stb %g2, [%o0] |
309 | 1: | 301 | 1: |
310 | retl | 302 | retl |
311 | RETL_INSN | 303 | mov %g7, %o0 |
312 | 304 | ||
313 | 82: /* ldd_std */ | 305 | 82: /* ldd_std */ |
314 | MOVE_BIGALIGNCHUNK(o1, o0, 0x00, o2, o3, o4, o5, g2, g3, g4, g5) | 306 | MOVE_BIGALIGNCHUNK(o1, o0, 0x00, o2, o3, o4, o5, g2, g3, g4, g5) |
@@ -373,7 +365,7 @@ FUNC(memcpy) /* %o0=dst %o1=src %o2=len */ | |||
373 | stb %g2, [%o0] | 365 | stb %g2, [%o0] |
374 | 1: | 366 | 1: |
375 | retl | 367 | retl |
376 | RETL_INSN | 368 | mov %g7, %o0 |
377 | 369 | ||
378 | 86: /* non_aligned */ | 370 | 86: /* non_aligned */ |
379 | cmp %o2, 6 | 371 | cmp %o2, 6 |
@@ -498,7 +490,7 @@ FUNC(memcpy) /* %o0=dst %o1=src %o2=len */ | |||
498 | stb %g2, [%i0 + 4] | 490 | stb %g2, [%i0 + 4] |
499 | 1: | 491 | 1: |
500 | ret | 492 | ret |
501 | restore %g0, %g0, %o0 | 493 | restore %g7, %g0, %o0 |
502 | 494 | ||
503 | 88: /* short_end */ | 495 | 88: /* short_end */ |
504 | 496 | ||
@@ -529,7 +521,7 @@ FUNC(memcpy) /* %o0=dst %o1=src %o2=len */ | |||
529 | stb %g2, [%o0] | 521 | stb %g2, [%o0] |
530 | 1: | 522 | 1: |
531 | retl | 523 | retl |
532 | RETL_INSN | 524 | mov %g7, %o0 |
533 | 525 | ||
534 | 90: /* short_aligned_end */ | 526 | 90: /* short_aligned_end */ |
535 | bne 88b | 527 | bne 88b |