call kernel module functions ?

call kernel module functions ?

Post by non » Sat, 08 Mar 2003 01:46:52



is this possible ?
thanks
tom
 
 
 

call kernel module functions ?

Post by non » Sat, 08 Mar 2003 02:39:08


i mean: can i call functions which are in a module from user space ?

 
 
 

call kernel module functions ?

Post by Neil Horma » Sat, 08 Mar 2003 02:57:57



> i mean: can i call functions which are in a module from user space ?

No, for the same reasons that you cant call any kernel space function
from user space.  The only way you can do this is via some sort of
defined proxy: i.e. a system call which you add to specifically call a
function you want, or via a device driver which you open from user
space, and then tickle via a write,read, or ioctl command, etc.
Neil
 
 
 

call kernel module functions ?

Post by non » Sat, 08 Mar 2003 03:47:34




>> i mean: can i call functions which are in a module from user space ?

> No, for the same reasons that you cant call any kernel space function
> from user space.  The only way you can do this is via some sort of
> defined proxy: i.e. a system call which you add to specifically call a
> function you want, or via a device driver which you open from user
> space, and then tickle via a write,read, or ioctl command, etc.
> Neil

and how do video card drivers work (OpenGL and other graphics) ?

tom

 
 
 

call kernel module functions ?

Post by Neil Horma » Sat, 08 Mar 2003 04:57:52





>>> i mean: can i call functions which are in a module from user space ?

>> No, for the same reasons that you cant call any kernel space function
>> from user space.  The only way you can do this is via some sort of
>> defined proxy: i.e. a system call which you add to specifically call a
>> function you want, or via a device driver which you open from user
>> space, and then tickle via a write,read, or ioctl command, etc.
>> Neil

> and how do video card drivers work (OpenGL and other graphics) ?

> tom

It depends on how they are implemented:

X servers which drive video cards actually run in user space as user
processes.  They memory map the  video cards they drive so that they can
manipulate the hardware from user space, and then accept X protocol
requests over IP sockets so that applications can create, and manipulate
what you see on the screen.  All this is done without executing _any_
code in the kernel (save for the transmission of the IP frames to
facilitate application/X server communication)

other types of video libraries, I'm not as familiar with, but to be sure
they do not magically execute code in the kernel from user space.  For
instance, the SDL library uses a framebuffer mechanism to access the
video card, which is a character device driver.  the SDL library opens
the /dev/fd device, and communicates to the kernel code through that
open file descriptor (via the read, write and ioctl calls).

I'm certain there are other mechanism for user/kernel space
communication that i'm unaware of, but the bottom line remains: To
execute kernel space code, requires some level of proxy to grant you
"permission" to do so.  That permission can be requested in a number of
ways (opening a file, making a system call, etc), but it must be done
before a user space process can access kernel space code in any way.

Hope that helps
Neil