Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 May 1995 07:51:08 -0700
From:      David Greenman <davidg@Root.COM>
To:        "Serge A. Babkin" <babkin@hq.icb.chel.su>
Cc:        hackers@FreeBSD.org
Subject:   Re: How to allocate kernel address space ? 
Message-ID:  <199505031451.HAA00589@corbin.Root.COM>
In-Reply-To: Your message of "Wed, 03 May 95 17:11:22 %2B0500." <199505031211.RAA08593@hq.icb.chel.su> 

next in thread | previous in thread | raw e-mail | index | archive | help
>Is there any function for allocating of kernel address space (not
>memory but address space for device's memory) ? I studied the
>existing drivers and I found that they assume that virtual
>address space in kernel mode is equal to the physical one. 

   Yes, it's "pmap_mapdev()". I originally wrote it for someone to map a 1MB
shared memory device (an ATM controller), but it is also being used in the PCI
code. Someday I plan to use it in all device drivers that use/map device
shared memory.

>But there is something strange: they convert physical addresses
>to virtual ones by simply assigning, but they convert virtual
>addresses to physical ones using kvtop(). Why ? For additional
>check ?

   The fact that the first 1MB of physical memory is mapped at KERNBASE is a
total hack and kludge. So converting from physical to virtual addresses using
this is a hack. Using kvtop() to convert a virtual address to a physical one,
however, isn't a hack at all - the information is gotten from the page tables
as it should be.

-DG



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199505031451.HAA00589>