Date: Sun, 21 Jun 2009 12:58:57 +0000 (UTC) From: Stanislav Sedov <stas@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r194583 - head/lib/libc/arm/string Message-ID: <200906211258.n5LCwvfc007365@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: stas Date: Sun Jun 21 12:58:56 2009 New Revision: 194583 URL: http://svn.freebsd.org/changeset/base/194583 Log: - Fix strncmp on arm. Return 0 as result without performing the main cycle only if the len passed is equal to 0. If end address overflows use last possible address as the end address. Based on: discussion on arm@ MFC after: 1 month Modified: head/lib/libc/arm/string/strncmp.S Modified: head/lib/libc/arm/string/strncmp.S ============================================================================== --- head/lib/libc/arm/string/strncmp.S Sun Jun 21 11:21:16 2009 (r194582) +++ head/lib/libc/arm/string/strncmp.S Sun Jun 21 12:58:56 2009 (r194583) @@ -33,13 +33,17 @@ __FBSDID("$FreeBSD$"); ENTRY(strncmp) -/* if ((len - 1) < 0) return 0 */ - subs r2, r2, #1 - movmi r0, #0 - movmi pc, lr +/* if (len == 0) return 0 */ + cmp r2, #0 + moveq r0, #0 + moveq pc, lr /* ip == last src address to compare */ - add ip, r0, r2 + adds ip, r0, r2 + sub ip, ip, #1 +/* Use last possible address on overflow. */ + movcs ip, #0 + subcs ip, ip, #1 1: ldrb r2, [r0], #1 ldrb r3, [r1], #1
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906211258.n5LCwvfc007365>