[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] quickzero()



Hello.

In FreeMiNT's libkern: the second parameter of quickzero() is the size in 256-byte blocks. That size parameter is a long, but only the lower 16 bits are honored. This would lead soon into big trouble.

Here is a patch to fix that.
Alan, please commit.

- quickzero.patch
Allow more than 65536 blocks. Contributed by Vincent Riviere.

--
Vincent Rivière
diff -x CVS -aurN freemint.orig/sys/libkern/asm/quickzero.S freemint/sys/libkern/asm/quickzero.S
--- freemint.orig/sys/libkern/asm/quickzero.S	2000-09-08 10:15:52.000000000 +0200
+++ freemint/sys/libkern/asm/quickzero.S	2011-03-26 23:34:09.625000000 +0100
@@ -21,7 +21,6 @@
 	moveq.l	#0,d6
 	moveq.l	#0,d7
 	move.l	d1,a1
-	subq.l	#1,d0			| adjust for dbra loop
 loop:
 	movem.l	d1-d7/a1,(a0)		| zero the memory, 32 bytes at a time
 	movem.l	d1-d7/a1,32(a0)
@@ -32,6 +31,7 @@
 	movem.l	d1-d7/a1,192(a0)
 	movem.l	d1-d7/a1,224(a0)
 	lea	256(a0),a0
-	dbra	d0,loop
+	subq.l	#1,d0
+	bne.s	loop
 	movem.l	(sp)+,d1-d7/a1		| restore regs
 	rts				| and leave