Subject: Re: grfmmap bug?
To: maximum entropy <entropy@zippy.bernstein.com>
From: Leo Weppelman <leo@wau.mis.ah.nl>
List: port-atari
Date: 12/16/1998 15:33:02
On Wed 16 Dec 1998, maximum entropy wrote:
> 
> I don't understand how grfmmap() can possibly work for devices such as
> the et4000 which have memory-mapped configuration registers.
[ .... ]
> I don't have an et4000, so I can't test this, but it does look really
> suspicious.  Am I just confused or is there something very wrong
> with this code as it stands?
> 
I caught this one about a week ago when experimenting with wscons. I had
mapped the video memory, but couldn't find the characters written to the
screen buffer by wscons ;-)
Anyway, I haven't flushed my local patches due to 1.3.3 work. Below is a
diff between my local tree and the 'official' -current tree.

Leo.


--- /usr/src/sys.org/arch/atari/dev/grf.c	Tue Jan 13 14:29:23 1998
+++ ./grf.c	Thu Dec 10 21:40:07 1998
@@ -302,8 +302,10 @@
 	/*
 	 * frame buffer
 	 */
-	if ((off >= 0) && (off < gi->gd_fbsize))
+	if (off >= gi->gd_regsize && off < gi->gd_regsize+gi->gd_fbsize) {
+		off -= gi->gd_regsize;
 		return (((u_int)gi->gd_fbaddr + off) >> PGSHIFT);
+	}
 	return(-1);
 }