Access to memory that may be kernel or user land

I am writing a kernel module that gets I/O requests from kernel modules (buffers are in UIO_SYSSPACE) as well as userland (buffers are in UIO_USERSPACE).

I cannot tell where I was called from so it is not possible for me to correctly configure uiomove when I want to read/write the buffers.

I obviously need to be able to take a page fault.

In Linux I would use set_fs to accomplish this.

Is there a generic means to tell the kernel to allow a given address range?

Thank you,
 
What about mmap for sharing memory from kernelspace and userspace?
You just have to implement a device and its mmap-handler.
 
That may work but I am concerned that I don't know when a buffer address is in userland or kernel space. The kernel should know so I'll give it a shot.

Thank you.
 
I think there is somewhere in the kernel where it defines the lowest kernel-space
border for virtual addresses.
Code:
- i386/include/vmparam.h:#define VM_MIN_KERNEL_ADDRESS
- i386/include/vmparam.h:#define VM_MAXUSER_ADDRESS       VADDR(PTDPTDI, 0)

Maybe they can help you determining the source of the access.

Regards,
Doena
 
Back
Top