Subject: port-mac68k/5702: pmap_bootstrap.c doesn't account for frame buffer offset
To: None <gnats-bugs@gnats.netbsd.org>
From: None <paul@whooppee.com>
List: netbsd-bugs
Date: 07/04/1998 08:44:06
>Number: 5702
>Category: port-mac68k
>Synopsis: pmap_bootstrap.c doesn't account for frame buffer offset
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: gnats-admin (GNATS administrator)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Jul 4 08:50:01 1998
>Last-Modified:
>Originator: Paul Goyette
>Organization:
>Release: approx 6/24/98
>Environment:
System: NetBSD mac1.whooppee.com 1.3E NetBSD 1.3E (MAC1) #10: Sat Jul 27 06:38:53 PDT 1998 paul@pc1.whooppee.com:/usr/home/paul/src/sys/arch/mac68k/compile/MAC1 mac68k
>Description:
pmap_bootstrap calculates vidlen as number of pages needed to
map entire frame buffer. However, some video cards (ike mine)
have the frame buffer start at other than a page boundary. In
this situation, the offset may cause the end of the frame
buffer to advance by one page and thus not get mapped.
>How-To-Repeat:
Video card with frame buffer offset of 0x400, rowbytes of 0x400,
and height of 0x1e0 (ie, 480.). vidlen is calulated to be
480KB exactly, and thus 60 pages are allocated. But due to the
offset, the end of the frame buffer is in the 61st page!
>Fix:
Add the required frame buffer offset to the total size of the
frame buffer before determining how many pages it needs.
--- /usr/src/sys/arch/mac68k/mac68k/pmap_bootstrap.c Tue Jun 30 04:12:49 1998
+++ ./pmap_bootstrap.c Fri Jul 3 20:01:44 1998
@@ -124,7 +124,8 @@
st_entry_t protoste, *ste;
pt_entry_t protopte, *pte, *epte;
- vidlen = m68k_round_page(((videosize >> 16) & 0xffff) * videorowbytes);
+ vidlen = m68k_round_page(((videosize >> 16) & 0xffff) * videorowbytes +
+ videoaddr - m68k_trunc_page(videoaddr));
/*
* Calculate important physical addresses:
>Audit-Trail:
>Unformatted: