Subject: Re: problem with bus_space_map
To: Christian Groessler <cpg@aladdin.de>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-kern
Date: 02/11/2004 20:44:23
On Tue, Feb 10, 2004 at 10:06:37PM +0100, Christian Groessler wrote:
> Hi,
> 
> I'm trying to write a driver (lkm) which maps the last 8MB of the
> memory address space on i386.
> 
> See below for the lkm code.
> 
> It successfully loads, but when I unload it, the bus_space_unmap call
> causes the machine to reboot.

Do you have ddb compiled in your kernel ?

> 
> Now when I use (MEM_LEN-1) instead of MEM_LEN for bus_space_[un]map,
> I get a panic when I unload the lkm (panic: extent_free: region not
> found).
> 
> It also appears that in the MEM_LEN case, the mapping isn't really
> done, since the mapped address when using MEM_LEN-1 appears in a 8MB
> chunk in 'pmap 0' output, whereas with MEM_LEN the mapped address
> doesn't appear and also looks suspicious (< 0xC0000000).
> 
> I'm new to this so probably I'm doing something wrong. Any help is
> appreciated!

I didn't see anything wrong in you code, but what is this MEM area you're
trying to map ? Are you sure parts of it aren't already mapped ?

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--