Subject: Re: UVM - Kernel & User access question
To: Eric Circlaeys <eric.c@mac.com>
From: Stephan Uphoff <ups@stups.com>
List: tech-kern
Date: 10/16/2003 21:49:48
> der Mouse wrote:
> > Eric Circlaeys wrote:
> > I would like to use UVM to allocate large memory in kernel land.  I
> > used uao_create, round_page, uvm_map to allocate virtual space.
> 
> As I understand it, those allocate userland VM.

Depends on the map passed to uvm_map().
A kernel (sub) map will result in kernel virtual space.

Do you need more than uvm_km_valloc_wait(kernel_map, sizeOfYourBuffer) ?

> 
> > But now I would like to write and read inside those pages still being
> > in kernel land.  When I tried with copyout to write buffer inside it
> > I got a page fault...

copyin/copyin_proc from userspace to your buffer
or kcopy from/to "normal" kernel space to/from your buffer. 
(or uiomove() as a parameter based wrapper around the functions above)

You can also temporary wire the memory to access it without special functions.
( The only way to access it from interrupt context)

Without more information is is hard to guess your problem.


Stephan