From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 25 14:27:52 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EAEFA16A420 for ; Mon, 25 Jul 2005 14:27:52 +0000 (GMT) (envelope-from keramida@freebsd.org) Received: from aiolos.otenet.gr (aiolos.otenet.gr [195.170.0.93]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2B22043D55 for ; Mon, 25 Jul 2005 14:27:51 +0000 (GMT) (envelope-from keramida@freebsd.org) Received: from beatrix.daedalusnetworks.priv (aris.bedc.ondsl.gr [62.103.39.226]) by aiolos.otenet.gr (8.13.4/8.13.4/Debian-1) with SMTP id j6PERjhc021926; Mon, 25 Jul 2005 17:27:46 +0300 Received: from beatrix.daedalusnetworks.priv (localhost [127.0.0.1]) by beatrix.daedalusnetworks.priv (8.13.3+Sun/8.13.3) with ESMTP id j6PERjPO026932; Mon, 25 Jul 2005 17:27:45 +0300 (EEST) Received: (from keramida@localhost) by beatrix.daedalusnetworks.priv (8.13.3+Sun/8.13.3/Submit) id j6PERjCJ026931; Mon, 25 Jul 2005 17:27:45 +0300 (EEST) Date: Mon, 25 Jul 2005 17:27:45 +0300 From: Giorgos Keramidas To: Felix-KM Message-ID: <20050725142745.GA26647@beatrix.daedalusnetworks.priv> References: <000101c5911b$62441260$4801a8c0@ws-ew-3.W2KDEMIG> <42E4F3AD.000001.28235@colgate.yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42E4F3AD.000001.28235@colgate.yandex.ru> Cc: NKoch@demig.de, freebsd-hackers@freebsd.org Subject: Re: how to use the function copyout() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jul 2005 14:27:53 -0000 On 2005-07-25 18:14, Felix-KM wrote: > >I have no idea if it is possible for ioctls to have mapped more than > >a few 100 bytes for data exchange. You should use read and uiomove() > >instead. > > So if I get it right, it's impossible in FreeBSD to gain access to > 64KB of user's program memory with ioctl? > > My situation is this - I have a device driver for Linux. My task is > port it as it is (1:1) into FreeBSD. > > In the Linux driver Ioctl is realized with the macroses _put_user > _get_user all over it. As I understand in FreeBSD their analogues are > functions described in store(9), copy(9) and fetch(9). > > So the problem is that in my user program an array short unsigned int > Data[32768] is defined. I need to gain access to the array(to each > element of it) from device driver with Ioctl handler. > > Is it possible to do? If yes, then how it can be done? A better alternative that doesn't involve copying huge amounts of data from userlevel to kernel space and vice versa is probably to pass just the address of the area with an ioctl() and then map the appropriate pages from the address space of the user process to an area where the kernel can access the data directly?