On Fri, Nov 26, 1999 at 12:51:50PM +0530, [EMAIL PROTECTED] wrote:
> 
> Agreed. But that's not the point i was trying to ask. All such functions
> (those who does kernel<->user copying), needs the base address
> of a varible intended for IO in user space. In linux, driver entry points
> such as read,write.....etc. gets this as an argument(Unlike in Unix) and
> i failed to understand from where they come. I mean, how
> the kernel gets this base address and pass it to driver functions. 

You seem to have a misconception here. Lets take the example of sys_read
(linux/fs/read_write.c). The argument buf is a userland absolute address
(not relative to some base) of the form 0x8xxxxxxx, passed unmodified
from the read system call in libc. You can try printing it out to
confirm this.

However, in traditional UNIX - for example FreeBSD, the syscall
arguments get copied on to the kernel stack and a pointer to the
"user area" is passed to the C routine that implements the system call.

In both the cases, one needs to do copyin/copyout to transfer the data.
All of this is contained in one file: /usr/include/asm/uaccess.h on 
Linux.

        -Arun

--------------------------------------------------------------------
The Linux India Mailing List Archives are now available.  Please search
the archive at http://lists.linux-india.org/ before posting your question
to avoid repetition and save bandwidth.

Reply via email to