Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 18 Jun 2017 15:14:51 +0300 (MSK)
From: Alexander Monakov <amonakov@...ras.ru>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] fix arm run-time abi string functions

Sorry for a bit of extreme nit-picking, but

On Tue, 21 Feb 2017, Szabolcs Nagy wrote:
> +__aeabi_memmove8:
> +__aeabi_memmove4:
> +__aeabi_memmove:
> +	cmp   r0, r1
> +	bls   2f
> +	cmp   r2, #0
> +	bxeq  lr
> +	add   r0, r0, r2
> +	add   r2, r1, r2
> +1:	ldrb  r3, [r2, #-1]!
> +	cmp   r1, r2
> +	strb  r3, [r0, #-1]!
> +	bne   1b
> +	bx    lr
> +__aeabi_memcpy8:
> +__aeabi_memcpy4:
> +__aeabi_memcpy:
> +2:	cmp   r2, #0
> +	bxeq  lr
> +	sub   r0, r0, #1
> +	add   r2, r1, r2
> +1:	ldrb  r3, [r1], #1
> +	cmp   r1, r2
> +	strb  r3, [r0, #1]!
> +	bne   1b
> +	bx    lr

here it's possible to hoist and deduplicate 'cmp r2, #0; bxeq lr' by placing it
prior to the direction check.

> +__aeabi_memclr8:
> +__aeabi_memclr4:
> +__aeabi_memclr:
> +	mov   r2, #0
> +__aeabi_memset8:
> +__aeabi_memset4:
> +__aeabi_memset:
> +	cmp   r1, #0
> +	bxeq  lr
> +	and   r2, r2, #255

here I don't see why the 'and' is useful, I don't think the following strb
needs high bits cleared?

> +	add   r1, r0, r1
> +1:	strb  r2, [r0], #1
> +	cmp   r1, r0
> +	bne   1b
> +	bx    lr

Alexander

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.