File: memcpy.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 (34 lines) | stat: -rw-r--r-- 763 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
29
30
31
32
33
34
/*
Copyright (c) 2009 Nick Clifton <nickc@redhat.com>
 */
	.file	"memcpy.S"

	.section .text
	.global  _memcpy
	.type	 _memcpy,@function
_memcpy:
#ifdef __RX_DISALLOW_STRING_INSNS__
	/* Do not use the string instructions - they might prefetch
	   bytes from outside of valid memory.  This is particularly
	   dangerous in I/O space.  */

	;; FIXME: It would be more space efficient to just branch to _memmove...
	
	cmp	 #0, r3	      	; If the count is zero, do nothing
	beq	 1f
	
	mov	 r1, r14	; Save a copy of DEST

2:	mov.b	 [r2+], r5
	mov.b	 r5, [r14+]
	sub	 #1, r3
	bne	 2b
	
1:	rts
#else
	mov	r1, r4		; Save a copy of DEST
	smovf	    		; Copy R2 (source) to R1 (dest).  Stop after R3 bytes.
	mov	r4, r1		; Return DEST
	rts
#endif
	.size _memcpy, . - _memcpy