patch-2.1.5 linux/arch/alpha/lib/strncpy.S

Next file: linux/arch/alpha/lib/strncpy_from_user.S
Previous file: linux/arch/alpha/lib/strncat.S
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.4/linux/arch/alpha/lib/strncpy.S linux/arch/alpha/lib/strncpy.S
@@ -0,0 +1,32 @@
+/*
+ * 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
+ * zeroed.
+ *
+ * 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.
+ */
+
+	.set noat
+	.set noreorder
+
+	.text
+
+	.align 3
+	.globl strncpy
+	.ent strncpy
+strncpy:
+	.frame $30, 0, $26
+	.prologue 0
+
+	mov	$16, $0		# set return value now
+	beq	$18, 0f
+	mov	$26, $23	# set return address
+	br	__stxncpy	# do the work of the copy
+0:	ret
+
+	.end strncpy

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov