From owner-freebsd-hackers@FreeBSD.ORG Tue Nov 15 00:12:55 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 E2FAB16A423 for ; Tue, 15 Nov 2005 00:12:55 +0000 (GMT) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (gate.funkthat.com [69.17.45.168]) by mx1.FreeBSD.org (Postfix) with ESMTP id 79E9243D46 for ; Tue, 15 Nov 2005 00:12:55 +0000 (GMT) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (localhost.funkthat.com [127.0.0.1]) by hydrogen.funkthat.com (8.13.3/8.13.3) with ESMTP id jAF0CnKl084130; Mon, 14 Nov 2005 16:12:49 -0800 (PST) (envelope-from jmg@hydrogen.funkthat.com) Received: (from jmg@localhost) by hydrogen.funkthat.com (8.13.3/8.13.3/Submit) id jAF0CnG2084129; Mon, 14 Nov 2005 16:12:49 -0800 (PST) (envelope-from jmg) Date: Mon, 14 Nov 2005 16:12:49 -0800 From: John-Mark Gurney To: John Giacomoni Message-ID: <20051115001249.GA79020@funkthat.com> Mail-Followup-To: John Giacomoni , freebsd-hackers@freebsd.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-Operating-System: FreeBSD 5.4-RELEASE-p6 i386 X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html Cc: freebsd-hackers@freebsd.org Subject: Re: Sharing the same VM address space between Kernel and UserSpace X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: John-Mark Gurney List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Nov 2005 00:12:56 -0000 John Giacomoni wrote this message on Mon, Nov 14, 2005 at 13:39 -0700: > I am in need of a way to share memory between kernel space and possibly > multiple different user-space processes for an extended period of time. > This memory would need to be a single unpageable region. > > I am using the vm routines as cribbed from mmap, however I'd like the > address spaces to be viewed as the same regardless of which process I'm > in to avoid swizzling pointers as I'm storing data structures in the > shared memory region. > > I imagine I'd need to find a way to expose part of the kernel address > space to user space to accomplish this. > > Is there a way to do this? Getting a common address between userland processes is easy, as you can always just use fixed mappings using the MAP_FIXED flag to mmap.. Getting the same address will take some kernel vm magic, and also not be very portable across platforms, since each platform may/can have a different code address (though we try to keep them the same)... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."