9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] kernel - kmap/KADDR ?
@ 2004-11-27 21:50 Tim Newsham
  2004-11-28  0:54 ` Russ Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Tim Newsham @ 2004-11-27 21:50 UTC (permalink / raw)
  To: 9fans

Hi,
   I'm confused about the usage of kmap and KADDR in the code.  I
had assumed that kmap() was used to map a page into kernel memory,
and kunmap() was used to unmap that page.  I just noticed that the
KADDR() macro is used in the port code in a similar way.  The
port code calls KADDR on a physical addr, and then starts reading
and writing the returned address.

Is this the correct usage of KADDR?  If so, isnt kmap() completely
redudant then?  Also, if this is the expected behavior of KADDR,
then how are platforms that have large memories supported?  (ie.
if you have more phys memory than free space above KZERO).  kmap()
could handle this (since there is a kunmap, and only a limited
number of active mappings), but KADDR does not have any unmap
facility and must rely on a large static mapping of memory.

Tim N.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9fans] kernel - kmap/KADDR ?
  2004-11-27 21:50 [9fans] kernel - kmap/KADDR ? Tim Newsham
@ 2004-11-28  0:54 ` Russ Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Russ Cox @ 2004-11-28  0:54 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

>    I'm confused about the usage of kmap and KADDR in the code.  I
> had assumed that kmap() was used to map a page into kernel memory,
> and kunmap() was used to unmap that page.  I just noticed that the
> KADDR() macro is used in the port code in a similar way.  The
> port code calls KADDR on a physical addr, and then starts reading
> and writing the returned address.

KADDR is only used to access the physical memory occupied
by the kernel and its data.  Kmap/kunmap are used to access the
whole of physical memory.  So they're not redundant, and that's
why there's no unmap for KADDR.

Kmap/kunmap are exactly what you think they are.

Russ


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-11-28  0:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-27 21:50 [9fans] kernel - kmap/KADDR ? Tim Newsham
2004-11-28  0:54 ` Russ Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).