diff options
author | Chen, Kenneth W <kenneth.w.chen@intel.com> | 2006-05-03 14:53:43 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2006-05-05 14:34:55 -0400 |
commit | 3e6e155646706f1ef9f791a4402d145f112a3f8d (patch) | |
tree | 43e3327d4c053a0a595925aa3679bb5e1e0f87aa /arch/ia64/lib/memcpy_mck.S | |
parent | d98550e334715b2d9e45f8f0f4e1608720108640 (diff) |
[IA64] strcpy returns NULL pointer and not destination pointer
Bob Picco noted that 6edfba1b33c701108717f4e036320fc39abe1912
dropped the -ffreestanding compiler flag from the top level
Makefile, which allows the compiler to substitute memcpy() in
places where strcpy() is used with a known size source string.
But the ia64 memcpy() returns 0 for success, and "bytes copied"
for failure.
Fix to return the address of the destination string (like
stdlibc version, and other architectures). There are no
places where ia64 specific code makes use of the non-standard
return value.
Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64/lib/memcpy_mck.S')
-rw-r--r-- | arch/ia64/lib/memcpy_mck.S | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/arch/ia64/lib/memcpy_mck.S b/arch/ia64/lib/memcpy_mck.S index 46c9331e7ab5..9e534d52b1d5 100644 --- a/arch/ia64/lib/memcpy_mck.S +++ b/arch/ia64/lib/memcpy_mck.S | |||
@@ -6,7 +6,9 @@ | |||
6 | * in1: source address | 6 | * in1: source address |
7 | * in2: number of bytes to copy | 7 | * in2: number of bytes to copy |
8 | * Output: | 8 | * Output: |
9 | * 0 if success, or number of byte NOT copied if error occurred. | 9 | * for memcpy: return dest |
10 | * for copy_user: return 0 if success, | ||
11 | * or number of byte NOT copied if error occurred. | ||
10 | * | 12 | * |
11 | * Copyright (C) 2002 Intel Corp. | 13 | * Copyright (C) 2002 Intel Corp. |
12 | * Copyright (C) 2002 Ken Chen <kenneth.w.chen@intel.com> | 14 | * Copyright (C) 2002 Ken Chen <kenneth.w.chen@intel.com> |
@@ -73,6 +75,7 @@ GLOBAL_ENTRY(memcpy) | |||
73 | and r28=0x7,in0 | 75 | and r28=0x7,in0 |
74 | and r29=0x7,in1 | 76 | and r29=0x7,in1 |
75 | mov f6=f0 | 77 | mov f6=f0 |
78 | mov retval=in0 | ||
76 | br.cond.sptk .common_code | 79 | br.cond.sptk .common_code |
77 | ;; | 80 | ;; |
78 | END(memcpy) | 81 | END(memcpy) |
@@ -84,7 +87,7 @@ GLOBAL_ENTRY(__copy_user) | |||
84 | mov f6=f1 | 87 | mov f6=f1 |
85 | mov saved_in0=in0 // save dest pointer | 88 | mov saved_in0=in0 // save dest pointer |
86 | mov saved_in1=in1 // save src pointer | 89 | mov saved_in1=in1 // save src pointer |
87 | mov saved_in2=in2 // save len | 90 | mov retval=r0 // initialize return value |
88 | ;; | 91 | ;; |
89 | .common_code: | 92 | .common_code: |
90 | cmp.gt p15,p0=8,in2 // check for small size | 93 | cmp.gt p15,p0=8,in2 // check for small size |
@@ -92,7 +95,7 @@ GLOBAL_ENTRY(__copy_user) | |||
92 | cmp.ne p14,p0=0,r29 // check src alignment | 95 | cmp.ne p14,p0=0,r29 // check src alignment |
93 | add src0=0,in1 | 96 | add src0=0,in1 |
94 | sub r30=8,r28 // for .align_dest | 97 | sub r30=8,r28 // for .align_dest |
95 | mov retval=r0 // initialize return value | 98 | mov saved_in2=in2 // save len |
96 | ;; | 99 | ;; |
97 | add dst0=0,in0 | 100 | add dst0=0,in0 |
98 | add dst1=1,in0 // dest odd index | 101 | add dst1=1,in0 // dest odd index |