to_stdnet@stag.UUCP (03/10/89)
From: thelake!steve@stag.UUCP (Steve Yelvington) I'm posting the following on the behalf of David Brooks, who is having some trouble with the postnews mechanism at his site. -- Steve Yelvington David Brooks Internet: BROOKS@CSSS-A.PRIME.COM uucp: {mit-eddie,uunet}!csss-a.prime.com!brooks -----8<----------------------------------------------------------- The broken memcpy() in the version of Dlibs distributed with Sozobon C will hurt xargs processing (and a few other routines). Replace it with the following, which fixes several bugs... * memcpy by David Brooks 1/23/89 * * char *memcpy(dest, source, len) * char *dest at 4(sp) * char *source at 8(sp) * unsigned int len at 12(sp) * * This is generally optimized around the commonest case (even alignment, * more than 4 bytes) but the time savings and space cost are minimal. * Also, we avoid using "btst #n,dn" because of a bug in the Sozobon * assembler. .text .globl _memcpy _memcpy: lea 12(a7),a2 ; Point to argument list move.w (a2),d2 ; d2 = len move.l -(a2),a0 ; a0 = source move.l -(a2),a1 ; a1 = dest move.l a1,d0 ; d0 = dest, ready to return move.l a0,d1 ; Check for odd/even alignment add.w a1,d1 ; This is really eor.w on the lsb. Really. asr.w #1,d1 ; Get lsb into C. If it's 1, alignment is off. bcs memcpy8 ; Go do it slowly move.l a0,d1 ; Check for initial odd byte asr.w #1,d1 ; Get lsb bcc memcpy1 subq.w #1,d2 ; Move initial byte bcs memcpy6 ; (unless d2 was 0). We could use dbra here, move.b (a0)+,(a1)+ ; but that would have been bigger. memcpy1: moveq.l #3,d1 ; Split into a longword count and remainder and.w d2,d1 lsr.w #2,d2 bra memcpy3 ; Enter loop. Note d2 could equal 0. memcpy2: move.l (a0)+,(a1)+ memcpy3: dbra d2,memcpy2 bra memcpy5 ; Enter final loop. Again d1 could equal 0. memcpy4: move.b (a0)+,(a1)+ ; Up to 3 trailing bytes memcpy5: dbra d1,memcpy4 memcpy6: rts ; All done. memcpy7: move.b (a0)+,(a1)+ ; Handle the odd/even aligned case memcpy8: dbra d2,memcpy7 rts ; and exit normally -----8<----------------------------------------------------------- forwarded by: /* * UUCP: {uunet!rosevax,amdahl!bungia,chinet,killer}!orbit!thelake!steve * ARPA: crash!orbit!thelake!steve@nosc.mil * #member <STdNET> The ST Developers Network */
mj@myrias.UUCP (Michal Jaegermann) (03/11/89)
Beside of a memcpy bug in dLibs here are two others (minor) - access() return values are reversed - system() is practically guaranteed to fail /* not very hard to replace */ Does anybody has a list of known bugs for Sozobon/dLibs? Maybe we should poll our knowledge in order to help to make this software better. But we need a clearinghouse for that purpose. Or maybe it already exists? Michal Jaegermann Myrias Research Corporation ...{ncc, alberta}!myrias!mj