Date: Mon, 17 Jul 2006 19:22:43 GMT From: Oleksandr Tymoshenko <gonzo@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 101790 for review Message-ID: <200607171922.k6HJMhUr030517@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=101790 Change 101790 by gonzo@gonzo_hq on 2006/07/17 19:22:02 o Fixed stupid bug in bcmp(3) funtion. o copystr(9) implementation added. Affected files ... .. //depot/projects/mips2/src/sys/mips/mips/copystr.S#3 edit .. //depot/projects/mips2/src/sys/mips/mips/support.S#6 edit Differences ... ==== //depot/projects/mips2/src/sys/mips/mips/copystr.S#3 (text+ko) ==== @@ -36,11 +36,35 @@ /* * XXXMIPS: Implement these routines */ - +/* + * copystr(9) + * <v0>int copystr(<a0>const void *src, <a1>void *dst, <a2>size_t len, + * <a3>size_t *done) + */ ENTRY(copystr) - break + move v0, zero + beqz a2, 2f + move t1, zero +1: subu a2, 1 + lbu t0, 0(a0) + addu a0, 1 + sb t0, 0(a1) + addu a1, 1 + beqz t0, 3f /* NULL - end of string*/ + addu t1, 1 + bnez a2, 1b + nop +2: /* ENAMETOOLONG */ + li v0, ENAMETOOLONG +3: /* done != NULL -> how many bytes were copied */ + beqz a3, 4f + nop + sw t1, 0(a3) +4: jr ra + nop END(copystr) + ENTRY(copyinstr) break END(copyinstr) ==== //depot/projects/mips2/src/sys/mips/mips/support.S#6 (text+ko) ==== @@ -58,7 +58,7 @@ nop END(bcopy) -/* XXXMIPS: test/optimize this function. +/* * The normal C bcmp(3), * <v0>int bcmp(<a0>const void *b1, <a1>const void *b2, <a2>size_t len) */ @@ -68,7 +68,8 @@ 1: subu a2, 1 lbu t0, 0(a0) lbu t1, 0(a1) - bne t0, t1, 3f + bne t0, t1, 2f + nop addu a0, 1 addu a1, 1 bnezl a2, 1b
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607171922.k6HJMhUr030517>