On 12/3/11 12:42 AM, Filippo Sironi wrote:
Dear all,
I've a strange problem I cannot understand...
I implemented a piece of code within the FreeBSD 7.2 kernel that basically
allocate a per-thread memory page to store a certain amount of information that
must be read and written without crossing user to kernel and kernel to user
boundaries.
To read and write the memory page I decided to allocate it in kernel space and then
mmap'ing it to user space using a "virtual cdev" as an entry point for user
space threads. The implementation of the mmap I came up with is really trivial, I
basically do:
*paddr = vtophys(curthread->private_info);
Now for the problem.
I enter the mmap and private_info is the correct kernel space virtual address,
each thread as its own address and the physical address - returned by vtophys -
is different too. The problem is that when I come back to user space all the
threads write in memory page mapped by the first thread that called the mmap
leaving their memory pages untouched.
This problem bugs me but I cannot find a solution. I don't really understand
the behavior.
each thread needs to store a different address as the base of it's
memory..
the memory map of a process is just that.. the memory map of the PROCESS
All threads see the same map.
Any ideas?
Thanks a lot,
Filippo
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[email protected]"
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[email protected]"