Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 505d62d0 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Haavard Skinnemoen
Browse files

avr32/lib: fix unaligned memcpy()



memcpy(p, unaligned, 4..) returns (p + num_of_unaligned_by_copied)
instead of p because p is not preserved in the unaligned case.

Noticed by Herbert Xu's superior parameter recycling coding technique
which let the md4 self-test fail on avr32.

Signed-off-by: default avatarSebastian Andrzej Siewior <sebastian@breakpoint.cc>
Signed-off-by: default avatarHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
parent 4be3bd78
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -24,8 +24,8 @@ memcpy:
	brne	1f

	/* At this point, "from" is word-aligned */
2:	sub	r10, 4
	mov	r9, r12
2:	mov	r9, r12
5:	sub	r10, 4
	brlt	4f

3:	ld.w	r8, r11++
@@ -59,4 +59,13 @@ memcpy:
	st.b	r12++, r8
	ld.ub	r8, r11++
	st.b	r12++, r8
	rjmp	2b
	mov	r8, r12
	add	pc, pc, r9
	sub	r8, 1
	nop
	sub	r8, 1
	nop
	sub	r8, 1
	nop
	mov	r9, r8
	rjmp	5b