From owner-freebsd-hackers@FreeBSD.ORG Tue Jan 20 17:51:13 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 B7C8A16A4CE for ; Tue, 20 Jan 2004 17:51:13 -0800 (PST) Received: from smtp3.adl2.internode.on.net (smtp3.adl2.internode.on.net [203.16.214.203]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9466A43D39 for ; Tue, 20 Jan 2004 17:51:11 -0800 (PST) (envelope-from doconnor@gsoft.com.au) Received: from midget.dons.net.au (ppp104-192.lns1.adl1.internode.on.net [150.101.104.192])i0L1p6Pv026216; Wed, 21 Jan 2004 12:21:07 +1030 (CST) Received: from chowder.gsoft.com.au (root@localhost.dons.net.au [127.0.0.1]) by midget.dons.net.au (8.12.9/8.12.9) with ESMTP id i0L1p4nY080890; Wed, 21 Jan 2004 12:21:04 +1030 (CST) (envelope-from doconnor@gsoft.com.au) From: "Daniel O'Connor" To: Anand Subramanian Date: Wed, 21 Jan 2004 12:21:02 +1030 User-Agent: KMail/1.5.4 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200401211221.02869.doconnor@gsoft.com.au> X-Spam-Score: -5.3 () IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES,SIGNATURE_SHORT_DENSE,SPAM_PHRASE_01_02,USER_AGENT,USER_AGENT_KMAIL X-Scanned-By: MIMEDefang 2.26 (www . roaringpenguin . com / mimedefang) cc: freebsd-hackers@freebsd.org Subject: Re: mmap() on pseudo device X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Jan 2004 01:51:13 -0000 On Tuesday 20 January 2004 09:08, Anand Subramanian wrote: > 1. I'm creating a pseudo device and having a user space process mmap() the > device memory into its address space. So the mmap for the device has to be > implemented. Are there any useful driver/source files I could look at for > this? > > 2. How can I access the mmaped memory from another kernel loadable module? The bktr driver is probably reasonable to look at, although it needs contiguous address space and I suspect you don't. > 3. For the user space program, after it does a mmap() on the > pseudo-device, is there any way it can force malloc() to operate on the > mmaped memory? Or am I forced to write my own lightweight memory manager? > Most of the memory managers around seem to be way too complicated to > quickly fix or customize for a simple need. Why would you want to malloc from your mmap'd region? Once you have mmap'd it you can validly read/write (subject to memory protections) without having to malloc it first. -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 9A8C 569F 685A D928 5140 AE4B 319B 41F4 5D17 FDD5