Bill
2006-04-26 17:19:33 UTC
I am writing a linux network device driver and have discovered I cannot
use copy_to_user in an interrupt handler. As a workaround, I have seen
an old posting that suggested mapping a kernel buffer into user space
and passing the data that way rather than using copy_to_user. ("In
your user space application, open /dev/kmem (which is a character
driver, which supports mmap), and memory map the kernel address
retrieved into the user space process.")
But, how exactly does one do this? I can kmalloc a buffer in the
network driver and send the address kmalloc returns in the driver to
the user application. Now what? I know I have to call mmap but with
what arguments? What about user addressing vs driver addressing?
Does anyone know where there is driver and user application code
showing how this is done?
use copy_to_user in an interrupt handler. As a workaround, I have seen
an old posting that suggested mapping a kernel buffer into user space
and passing the data that way rather than using copy_to_user. ("In
your user space application, open /dev/kmem (which is a character
driver, which supports mmap), and memory map the kernel address
retrieved into the user space process.")
But, how exactly does one do this? I can kmalloc a buffer in the
network driver and send the address kmalloc returns in the driver to
the user application. Now what? I know I have to call mmap but with
what arguments? What about user addressing vs driver addressing?
Does anyone know where there is driver and user application code
showing how this is done?