X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=arch%2Fia64%2Flib%2Fmemcpy_mck.S;h=ab0f8763972954117b0ac6a7dc3ac120d6e042c5;hb=f741656d646f7a5b56ba86765205b954237e7956;hp=6f308e62c1377cc04ee24efcd08775a66ed24dae;hpb=f2cbb4f01936a3e4225692e03b084b78c56d386d;p=~andy%2Flinux diff --git a/arch/ia64/lib/memcpy_mck.S b/arch/ia64/lib/memcpy_mck.S index 6f308e62c13..ab0f8763972 100644 --- a/arch/ia64/lib/memcpy_mck.S +++ b/arch/ia64/lib/memcpy_mck.S @@ -6,12 +6,13 @@ * in1: source address * in2: number of bytes to copy * Output: - * 0 if success, or number of byte NOT copied if error occurred. + * for memcpy: return dest + * for copy_user: return 0 if success, + * or number of byte NOT copied if error occurred. * * Copyright (C) 2002 Intel Corp. * Copyright (C) 2002 Ken Chen */ -#include #include #include @@ -73,6 +74,7 @@ GLOBAL_ENTRY(memcpy) and r28=0x7,in0 and r29=0x7,in1 mov f6=f0 + mov retval=in0 br.cond.sptk .common_code ;; END(memcpy) @@ -84,7 +86,7 @@ GLOBAL_ENTRY(__copy_user) mov f6=f1 mov saved_in0=in0 // save dest pointer mov saved_in1=in1 // save src pointer - mov saved_in2=in2 // save len + mov retval=r0 // initialize return value ;; .common_code: cmp.gt p15,p0=8,in2 // check for small size @@ -92,7 +94,7 @@ GLOBAL_ENTRY(__copy_user) cmp.ne p14,p0=0,r29 // check src alignment add src0=0,in1 sub r30=8,r28 // for .align_dest - mov retval=r0 // initialize return value + mov saved_in2=in2 // save len ;; add dst0=0,in0 add dst1=1,in0 // dest odd index @@ -625,8 +627,11 @@ EK(.ex_handler, (p17) st8 [dst1]=r39,8); \ clrrrb ;; alloc saved_pfs_stack=ar.pfs,3,3,3,0 + cmp.lt p8,p0=A,r0 sub B = dst0, saved_in0 // how many byte copied so far ;; +(p8) mov A = 0; // A shouldn't be negative, cap it + ;; sub C = A, B sub D = saved_in2, A ;;