Re: How to map a page with userland program?



On Friday 15 September 2006 11:21, LI Xin wrote:
John Baldwin wrote:
On Friday 15 September 2006 10:26, LI Xin wrote:
Dear folks,

Is there a continent and MI way to map a kernel page into userland
address space under the same virtual address? It seems that this can be
implemented through some routines in MD part of pmap, but is it possible
to use higher level VM routines to do the job?

Not to the same userland virtual address. Why do you need the same
virtual address anyway? If it's for pointers use offsets relative to
the start of the page instead.

That would make it easier to implement some sort of VSYSCALL, which is
in fact executed in userland. Or, is there any better way? :-)

If you want to stick code in the page, make the code PIC, the same as is done
for shared libraries. Alternatively, if you wanted to be very, very evil and
can have the page read-only once it is initialized, flip the user/supervisor
bit in the kernel PTE for that page such that it is treated as a user page
rather than a kernel page (even though it's in KVA), and then userland
processes can access that page via it's kernel VA. Making the code PIC would
probably be better though.

--
John Baldwin
_______________________________________________
freebsd-arch@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: Attempted summary of "RT patch acceptance" thread
    ... tries to keep the userland API as close as possible to the non-RT one, ... by increasing the kernel complexity with relative slowdown. ... RTAI quickly becomes useless (ok it can run nanosleep with fusion fine, ... RTAI/rtlinux as the only hard-RT with guaranteed deadline. ...
    (Linux-Kernel)
  • Re: [RFC] Splitting kernel headers and deprecating __KERNEL__
    ... >> two parties on an ABI doesn't imply that one party gets to define it ... imposition, kernel developers won't care. ... because there's a contract with userland that they don't want to ... change in the copy/extract/whatever of kernel headers that userland is ...
    (Linux-Kernel)
  • How to map a page with userland program?
    ... Is there a continent and MI way to map a kernel page into userland address space under the same virtual address? ... It seems that this can be implemented through some routines in MD part of pmap, but is it possible to use higher level VM routines to do the job? ...
    (freebsd-arch)
  • Re: "Enhanced" MD code avaible for review
    ... be required to make this work correctly using a userland approach. ... > kernel, and having to try harder to crash the kernel. ... protected *sooner* if the system crashes. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: [PATCH] remove net driver ugliness that sparse complains about
    ... and when it points to kernel space. ... userland ones. ... and userland pointers, and set_fsis not enough to handle that. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)