summaryrefslogtreecommitdiffstats
path: root/arch/s390/lib/strncpy.S
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-05-12 23:48:34 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-05-12 23:48:34 +0000
commit7fd36ebeeec9244a7431bb010e6e3c5e4848a0d5 (patch)
tree5fb03a9aafdd1cec5f4f6ff7f1873174cb89b66c /arch/s390/lib/strncpy.S
parentba2dacab305c598cd4c34a604f8e276bf5bab5ff (diff)
Merge with Linux 2.3.99-pre8. Linus must hate me, too man patches ;-)
Diffstat (limited to 'arch/s390/lib/strncpy.S')
-rw-r--r--arch/s390/lib/strncpy.S30
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/s390/lib/strncpy.S b/arch/s390/lib/strncpy.S
new file mode 100644
index 000000000..83578909c
--- /dev/null
+++ b/arch/s390/lib/strncpy.S
@@ -0,0 +1,30 @@
+/*
+ * arch/s390/kernel/strncpy.S
+ * S390 strncpy routine
+ *
+ * S390 version
+ * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
+ * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
+ */
+
+/*
+ * R2 = address of destination
+ * R3 = address of source string
+ * R4 = max number of bytes to copy
+ */
+ .globl strncpy
+strncpy:
+ LR 1,2 # don't touch address in R2
+ LTR 4,4
+ JZ strncpy_exit # 0 bytes -> nothing to do
+ SR 0,0
+strncpy_loop:
+ ICM 0,1,0(3) # ICM sets the cc, IC does not
+ LA 3,1(0,3)
+ STC 0,0(0,1)
+ LA 1,1(0,1)
+ JZ strncpy_exit # ICM inserted a 0x00
+ BRCT 4,strncpy_loop # R4 -= 1, jump to strncpy_loop if > 0
+strncpy_exit:
+ BR 14
+