File: strcpy.S

package info (click to toggle)
picolibc 1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 31,616 kB
  • sloc: ansic: 312,308; asm: 22,739; perl: 2,414; sh: 1,619; python: 1,019; pascal: 329; exp: 287; makefile: 164; xml: 40; cpp: 10
file content (28 lines) | stat: -rw-r--r-- 520 bytes parent folder | download | duplicates (2)
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
/*
Copyright (c) 2009 Nick Clifton <nickc@redhat.com>
 */
	.file	"strcpy.S"

	.section .text
	.global  _strcpy
	.type	 _strcpy,@function
_strcpy:
	;; R1: dest
	;; R2: source
#ifdef __RX_DISALLOW_STRING_INSNS__
	mov	r1, r4		; Leave the destination address unchanged in the result register.

1:	mov.b	[r2+], r5
	mov.b	r5, [r4+]
	cmp	#0, r5
	bne	1b

	rts
#else
	mov	r1, r4
	mov	#-1, r3		; Strictly speaking this is incorrect, but I doubt if anyone will ever know.
	smovu
	mov	r4, r1
	rts
#endif
	.size _strcpy, . - _strcpy