From owner-freebsd-hackers Fri Dec 22 23:15:46 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id XAA23102 for hackers-outgoing; Fri, 22 Dec 1995 23:15:46 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id XAA23097 for ; Fri, 22 Dec 1995 23:15:44 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id AAA21580; Sat, 23 Dec 1995 00:11:06 -0700 From: Terry Lambert Message-Id: <199512230711.AAA21580@phaeton.artisoft.com> Subject: Re: Help with lkm's please To: pc012@svcc.seqeb.gov.au (pat collins) Date: Sat, 23 Dec 1995 00:11:05 -0700 (MST) Cc: hackers@FreeBSD.org In-Reply-To: from "pat collins" at Dec 20, 95 01:27:43 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@FreeBSD.org Precedence: bulk > 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.