Sharing the same VM address space between Kernel and UserSpace

John-Mark Gurney gurney_j at resnet.uoregon.edu
Tue Nov 15 00:12:56 GMT 2005


John Giacomoni wrote this message on Mon, Nov 14, 2005 at 13:39 -0700:
> I am in need of a way to share memory between kernel space and possibly
> multiple different user-space processes for an extended period of time.
> This memory would need to be a single unpageable region.
> 
> I am using the vm routines as cribbed from mmap, however I'd like the
> address spaces to be viewed as the same regardless of which process I'm
> in to avoid swizzling pointers as I'm storing data structures in the
> shared memory region.
> 
> I imagine I'd need to find a way to expose part of the kernel address
> space to user space to accomplish this.
> 
> Is there a way to do this?

Getting a common address between userland processes is easy, as you
can always just use fixed mappings using the MAP_FIXED flag to mmap..

Getting the same address will take some kernel vm magic, and also not
be very portable across platforms, since each platform may/can have a
different code address (though we try to keep them the same)...

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."


More information about the freebsd-hackers mailing list