From owner-freebsd-hackers@FreeBSD.ORG Fri May 21 19:06:11 2004 Return-Path: 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 8E48B16A4CE; Fri, 21 May 2004 19:06:11 -0700 (PDT) Received: from blount.mail.mindspring.net (blount.mail.mindspring.net [207.69.200.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6C73243D2F; Fri, 21 May 2004 19:06:11 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from [192.168.167.44] (helo=wamui06.slb.atl.earthlink.net) by blount.mail.mindspring.net with esmtp (Exim 3.33 #1) id 1BRLtq-000863-00; Fri, 21 May 2004 22:06:10 -0400 Message-ID: <7860222.1085191570767.JavaMail.root@wamui06.slb.atl.earthlink.net> Date: Fri, 21 May 2004 19:06:10 -0700 (GMT-07:00) From: Terry Lambert To: Alfred Perlstein , hackers@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Earthlink Zoo Mail 1.0 Subject: Re: api for sharing memory from kernel to userspace? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Terry Lambert List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2004 02:06:11 -0000 Alfred Perlstein writes: > I need to share about 100megs of memory between kernel and userspace. > > The memory can not be paged and should appear contig in the process's > address space. Any suggestions? > > I need a way to either: > map user memory into the kernel's address space. > map kernel memory into the user's address space. > > I was looking at pmap_qenter() but it didn't see attractive because > it's for "short term mappings", this mapping will exist for quite a > while. Given your "non-paged" requirement, the allocation needs to take place in the kernel. Visible in a single process, or in all of them? If all of them, set the PG_U bit; it will have the same address in user space as it does in the kernel, and be visible to all processes. If only one of them, the best general solution is to use a pseudo-device, and support mmap() on it. -- Terry