Subject: Re: uvm_loan and passing large data structures to a syscall
To: Pete Yandell <pete.yandell@gmail.com>
From: Jason Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 07/01/2004 20:59:40
--Apple-Mail-51-911914258
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII; format=flowed


On Jul 1, 2004, at 8:26 PM, Pete Yandell wrote:

>     /* How do I get the map argument to uvm_loan?
>      * Are there locking issues?
>      * Anything else that I'm missing? */
>     uvm_loan (???, hash_table, table_size, v, UVM_LOAN_TOPAGE);

Take a look at uipc_socket.c:sosend_loan() to see what you need to do 
to loan user pages to the kernel.  You'll need to allocate some kernel 
virtual address space, and them map the loaned pages to them.

In your case, you can get the map argument from 
l->l_proc->p_vmspace->vm_map.

Another option you have is for the kernel to provide a large chunk of 
memory that the user process can mmap().

         -- Jason R. Thorpe <thorpej@wasabisystems.com>


--Apple-Mail-51-911914258
content-type: application/pgp-signature; x-mac-type=70674453;
	name=PGP.sig
content-description: This is a digitally signed message part
content-disposition: inline; filename=PGP.sig
content-transfer-encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)

iD8DBQFA5N2sOpVKkaBm8XkRAuUMAJ9LtO4hVGhptsN7SKYpWPu6c/1jNQCgnMtr
hMp/HW0sjzHe2mjqIoW0L6c=
=2Zrf
-----END PGP SIGNATURE-----

--Apple-Mail-51-911914258--