Shared VM address range across processes
John Giacomoni
john.giacomoni at colorado.edu
Thu Mar 13 16:41:09 UTC 2008
Nihkil,
I'm working on something similar for a research project and the answer
is that it is possible but ugly.
First, are you sure you need to do this? Ensuring safety by checking
pointers before dereferencing can be painful :)
FreeBSD seems to have checks scattered throughout the kernel trying to
ensure that the kernel address range remains unavailable to the
userspace
address range. These checks can obviously be bypassed but they are
fairly
invasive. Once all those checks are bipassed, you need to ensure that
the
PTEs and PDEs are have the userspace bit set for the appropriate page
ranges which then requires flushing the specific pages out of the TLB
using the invlpg function, note that flushing the TLB is insufficient as
kernel pages are marked global and thus won't flush with any other
method.
files that I touched
/usr/src/sys/amd64/amd64/pmap.c - pmap_enter
/usr/src/sys/amd64/amd64/trap.c - trap_pfault
and the allocation site needs to ensure that the user-mode bit is set on
the correct PTEs and PDEs.
I directly allocate memory using vm objects to help me bypass the
various
address range checks that can be found in the higher levels of the
kernel.
I'm planning on generalizing and cleaning my approach up in the next few
months but I'll be glad to answer any specific questions you might have.
For the FreeBSD kernel developers,
Is there a reason to enforce the high/low mem address range as strongly
as is done in FreeBSD? It seems that if the higher-levels of the kernel
allow a mapping, the lower-levels should respect that.
John G
On Mar 12, 2008, at 12:46 PM, Rao, Nikhil wrote:
> Hi,
>
>
>
> I want to map device memory into the same virtual address range in
> multiple processes, this means I would have to add a vm_map_entry per
> address range in every process, since the list of processes can be
> potentially huge .. Is it allowed to point to the same list of
> vm_map_entrys from multiple vm_spaces ? BSD3 had a field in the
> vm_map_entry that could be a share map - would it be an idea that I
> could reuse ?
>
>
>
> Nikhil
>
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org
> "
--
John.Giacomoni at colorado.edu
University of Colorado at Boulder
Department of Computer Science
Engineering Center, ECCR 1B50
430 UCB
Boulder, CO 80303-0430
USA
-------------- next part --------------
More information about the freebsd-hackers
mailing list