1/* 2 * arch/s390/kernel/strncpy.S 3 * S390 strncpy routine 4 * 5 * S390 version 6 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation 7 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), 8 */ 9 10/* 11 * R2 = address of destination 12 * R3 = address of source string 13 * R4 = max number of bytes to copy 14 */ 15 .globl strncpy 16strncpy: 17 LGR 1,2 # don't touch address in R2 18 LTR 4,4 19 JZ strncpy_exit # 0 bytes -> nothing to do 20 SGR 0,0 21strncpy_loop: 22 ICM 0,1,0(3) # ICM sets the cc, IC does not 23 LA 3,1(3) 24 STC 0,0(1) 25 LA 1,1(1) 26 JZ strncpy_exit # ICM inserted a 0x00 27 BRCTG 4,strncpy_loop # R4 -= 1, jump to strncpy_loop if > 0 28strncpy_exit: 29 BR 14 30 31