bcopy/memmove optimization broken ?
Alexandre Martins
alexandre.martins at stormshield.eu
Fri Feb 10 15:59:11 UTC 2017
Hi all
I see in the kernel code of bcopy/memmove an optimization if the copied region
don't overlap:
https://svnweb.freebsd.org/base/head/sys/arm/arm/support.S?view=annotate#l403
I'm a newbie in ARM assembly, so, sorry if i'm wrong, but
- R0 is the dst (1st parameter)
- R1 is the src (2nd parameter)
So :
subcc r3, r0, r1 /* if (dst > src) r3 = dst - src */
subcs r3, r1, r0 /* if (src > dsr) r3 = src - dst */
cmp r3, r2 /* if (r3 < len) we have an overlap */
bcc PIC_SYM(_C_LABEL(memcpy), PLT)
Seems to be inverted. Should it be that ? :
subcs r3, r0, r1 /* if (dst > src) r3 = dst - src */
subcc r3, r1, r0 /* if (src > dsr) r3 = src - dst */
cmp r3, r2 /* if (r3 < len) we have an overlap */
bcs PIC_SYM(_C_LABEL(memcpy), PLT)
Best regards
--
Alexandre Martins
STORMSHIELD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2874 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arm/attachments/20170210/fad6fd17/attachment.bin>
More information about the freebsd-arm
mailing list