Hello, I'm doing a little project that investigates the benefits of
using the new (seemingly only accessible from privileged code) x86 SSE3
monitor/mwait instructions for locks on hyperthreaded machines.
To get this to work, I need to allocate some contiguous memory in kernel
space that is memory mapped to some address range in a userspace app.
For now, I'm just trying to get this to work by mmaping /dev/mem. I use
virt_to_phys on a kmalloced address and return it to my user app via a
syscall. I then try to mmap /dev/mem in my user app at an offset of the
returned address. The memory mapping seems to succeed, but when I check
the contents of the address (which I wrote to in kernel space), I don't
get a match. Is there some /dev/mem file location-to-physical memory
address mapping that I am not aware of? man mem says that they are the same.
I also tried returning a kernel address and mapping /dev/kmem. In this
case mmap doesn't even succeed.
Any ideas?
I'm running debian testing with linux 2.6.12.1
Also, I'm aware that mmap requires a page aligned offset. I take care
of this in all of my tests by mmaping memory at the first offset that is
page aligned preceding my desired address/offset.
Thanks in advance,
Marek
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/