Subject: Re: sharing all VM space but a page
To: Emmanuel Dreyfus <manu@netbsd.org>
From: Chuck Silvers <chuq@chuq.com>
List: tech-kern
Date: 06/03/2002 19:41:49
On Sun, Jun 02, 2002 at 08:47:56AM +0200, Emmanuel Dreyfus wrote:
> Hi
> 
> For emulating one strange IRIX sproc flag, I need to share the whole
> address space, except one page. How can this be done? When
> uvmspace_share is used, p->p_vmspace are pointing to the same place,
> hence it's not possible to have one page unshared...


I think something like this would work:

	fork like normal (getting a separate uvmspace).
	uvm_unmap() the entire new user address space.
	use uvm_map_extract() on the entire old user address space to
		share all its mappings with the new process.
	unmap the (now shared) PRDA and allocate a new non-shared one.


then in the irix versions of any syscalls that modify the vmspace,
update all the other vmspaces in the share group to match.
it would probably be useful to make uvm_map_extract() use the value
pointed to by its dstaddrp argument as a hint, so that it could be
used for the incremental updating as well.

-Chuck