2 * arch/alpha/lib/strncpy.S
3 * Contributed by Richard Henderson (rth@tamu.edu)
5 * Copy no more than COUNT bytes of the null-terminated string from
6 * SRC to DST. If SRC does not cover all of COUNT, the balance is
9 * Or, rather, if the kernel cared about that weird ANSI quirk. This
10 * version has cropped that bit o' nastiness as well as assuming that
11 * __stxncpy is in range of a branch.
26 mov $16, $0 # set return value now
29 bsr $23, __stxncpy # do the work of the copy
32 bne $18, $multiword # do we have full words left?
33 subq $24, 1, $3 # nope
36 or $3, $24, $3 # clear the bits between the last
37 or $4, $27, $4 # written byte and the last byte in COUNT
46 subq $24, 1, $2 # clear the final bits in the prev word
61 stq_u $31, 0($16) # zero one word
66 0: stq_u $31, 0($16) # zero two words
72 1: ldq_u $1, 0($16) # clear the leading bits in the final word