summaryrefslogtreecommitdiffstats
path: root/arch/s390/lib/strncpy.S
blob: 83578909c8643bb350f44d2e277d3e3f791ac9a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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

'>-175/+449 * Merge with Linux 2.3.22.Ralf Baechle2000-01-214-80/+84 * Merge with Linux 2.3.21.Ralf Baechle1999-12-0417-2325/+3626 * Merge with 2.3.19.Ralf Baechle1999-10-0925-1980/+2538 * Merge with 2.3.10.Ralf Baechle1999-09-285-223/+23 * Merge with Linux 2.3.9.Ralf Baechle1999-07-053-3/+8 * Merge with Linux 2.3.7.Ralf Baechle1999-06-222-20/+32 * Merge with Linux 2.3.6. Sorry, this isn't tested on silicon, I don'tRalf Baechle1999-06-178-75/+171 * Merge with Linux 2.2.8.Ralf Baechle1999-06-1315-827/+1689 * Merge with Linux 2.2.1.Ralf Baechle1999-02-1519-783/+2022 * Merge with Linux 2.1.131 plus some more MIPS goodies.Ralf Baechle1999-01-03