Date: Mon, 14 Nov 2005 13:57:10 -0700 From: Scott Long <scottl@samsco.org> To: John Giacomoni <John.Giacomoni@colorado.edu> Cc: freebsd-hackers@freebsd.org Subject: Re: Sharing the same VM address space between Kernel and UserSpace Message-ID: <4378FA26.8040604@samsco.org> In-Reply-To: <AA4AEE17-32CC-4D47-96C0-0B0B0BC13B68@colorado.edu> References: <AA4AEE17-32CC-4D47-96C0-0B0B0BC13B68@colorado.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
John Giacomoni wrote: > 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? > > thanks > > John G > If you get this working then it'll be very useful for the syspage support that was talked about recently. The kernel can access addresses in the user space so long as they are wired and won't cause a fault. Thus I imagine that you only need to allocate the memory, wire it, mark it with the appropriate page permissions, and reserve a user address range for it in the process map. I'd look at the process exec path in the kernel for places to hook in. The only other trick then is how to let the user process know the address for this magic region. An easy way would be to store it in a sysctl that can be read at runtime. A harder way would be to have the kernel dummy up an elf segment in the image activator code that the dynamic linker could read and put into a global variable for the program to access. Scott
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4378FA26.8040604>