Subject: Re: Finding Kernel VA that maps given physical address?
To: Jason Thorpe <>
From: Paul Goyette <>
List: tech-kern
Date: 07/20/1997 18:46:54
On Sun, 20 Jul 1997, Jason Thorpe wrote:

On Sun, 20 Jul 1997 15:29:09 -0700 (PDT) I  wrote:
> 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?

And Jsaon Thorpe replied:
> 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...

I thought of keeping a separate list, but thought that that was kind of
"icky".  Maybe it's not such a bad idea after all.  :)

Actually, what I thought might be possible was to have the individual
driver (in my case, grf_mv, the NuBus-board video driver) make a call-back
to some (new) routine.  The individual driver needs to map the board's
address space into the kernel, so it has the virtual address handy.  If it
simply called some routine to stash that address in some globally
accessible array (indexed by NuBus slot #).  Then later on I could consult
that array to do the reverse translation.

BTW, what is the difference between "managed" vs "unmanaged" pages?  Does
"managed" imply that the page is possibly paged/swapped out at some time?
If so, then I rather doubt that that would work in my situation - just how
_could_ you swap out a hardware component?  :)

| Paul Goyette       | PGP Public Key fingerprint:  | E-mail addresses:     |
| Network Consultant |     0E 40 D2 FC 2A 13 74 A0  |    |
| and kernel hacker  |     E4 69 D5 BE 65 E4 56 C6  | |