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