Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Dec 1995 00:11:05 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        pc012@svcc.seqeb.gov.au (pat collins)
Cc:        hackers@FreeBSD.org
Subject:   Re: Help with lkm's please
Message-ID:  <199512230711.AAA21580@phaeton.artisoft.com>
In-Reply-To: <Pine.3.89.9512201331.A24863-0100000@svcc.seqeb.gov.au> from "pat collins" at Dec 20, 95 01:27:43 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> I am writing an lkm device driver for a digital IO board. I have worked 
> out how to move bytes from the user space to the kernel space but not 
> vice-versa. Can anyone give me any clues on how I move data from the 
> kernel space to the user space. Do I use the uiomove() function, if so how.

Are you using uio structures in all cases?  If you are not required to,
it would probably be simpler (and faster) to call copyin/copyout directly
if you know the source/destination to be in user space and the
destination/source to be in system space (if they are both in system space,
use bcopy instead).

Look at the uiomove source in /sys/kern/kern_subr.c.

The basics for uiomove are:

if( uio->uio_segflag == UIO_USERSPACE) {

	if( uio->uio_rw == UIO_READ)
		copy from kernel buffer to user space using "copyout"
	if( uio->uio_rw == UIO_WRITE)
		copy from user space to kernel buffer using "copyin"
}
	

					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199512230711.AAA21580>