Subject: Re: Finding Kernel VA that maps given physical address?
To: Paul Goyette <>
From: Jason Thorpe <>
List: tech-kern
Date: 07/20/1997 18:30:29
On Sun, 20 Jul 1997 15:29:09 -0700 (PDT) 
 Paul Goyette <> wrote:

 > OK, here's my first post to this list so please be gentle...

*evil grin*  (just kidding :-)

 > I'm in the process of integrating the MacOS's ROM-based NuBus Slot Manager
 > code with NetBSD - on the premise that it's easier to reverse-engineer one
 > interface vs. reverse-engineering each possible card.


 > The Mac code sort of relies on the fact that certain physical addresses
 > (ie, the card's "slot space") are mapped to identical addresses within the
 > OS.  In other words, Kernel virtual address 0xFC000000 maps to physical
 > address 0xFC000000.  My integration code needs to replace the routines
 > that have this dependence.

Ok.. makes sense so far...

 > I've figured out how to find the physical address given a kernel VA using
 > pmap_extract().  But I haven't found the equivalent mechanism to do the
 > reverse translation.  I realize that, in a general case, there might be
 > _several_ (or even _many_) kernel VAs that map to the same physical
 > address, but I'm pretty sure that that won;t happen in the specific case I
 > need to handle.  So it would be just peachy if there were a way to find
 > _any_ kernel virtual address that maps to a given physical address.


 > Any ideas?

You could use the PV table (which maps physical->list_of_virtual), but
that only works for managed pages.  For pages which are not managed, you
may need to keep another physical->list_of_virtual table, or something...

Jason R. Thorpe                             
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939