From owner-freebsd-hackers@FreeBSD.ORG Mon Jan 22 16:11:00 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E8DD516A403 for ; Mon, 22 Jan 2007 16:11:00 +0000 (UTC) (envelope-from jdamato@andrew.cmu.edu) Received: from smtp.andrew.cmu.edu (smtp.andrew.cmu.edu [128.2.10.83]) by mx1.freebsd.org (Postfix) with ESMTP id B0D8713C459 for ; Mon, 22 Jan 2007 16:11:00 +0000 (UTC) (envelope-from jdamato@andrew.cmu.edu) Received: from [192.168.2.4] (c-67-171-65-107.hsd1.pa.comcast.net [67.171.65.107]) (user=jdamato mech=PLAIN (0 bits)) by smtp.andrew.cmu.edu (8.13.6/8.13.6) with ESMTP id l0MGAsFC003027 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT); Mon, 22 Jan 2007 11:10:59 -0500 Message-ID: <45B4E20E.70308@andrew.cmu.edu> Date: Mon, 22 Jan 2007 11:10:54 -0500 From: Joe Damato User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: Pranav Sawargaonkar References: <45B4308B.7050608@andrew.cmu.edu> <5007e1a40701212257q37d0c641u5e368464a3068612@mail.gmail.com> <5007e1a40701212257m6f6f51b8w6f15040e88a9080e@mail.gmail.com> In-Reply-To: <5007e1a40701212257m6f6f51b8w6f15040e88a9080e@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.57 on 128.2.10.83 Cc: freebsd-hackers@freebsd.org Subject: Re: Fwd: Creating a "new" virtual address space for a process 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, 22 Jan 2007 16:11:01 -0000 Pranav Sawargaonkar wrote: >> >We have a process, (in this case it happens to be curproc or proc0), >> and >> >we would like to create a new virtual address space and allocate, say N >> >pages starting at address X. > To allocate new vmspace and vm_map you can use vmspace_fork() > defined in > vm/vm_map.c. vmspace_fork() is something we looked at already... It "creates a new vmspace structure and vm_map based on those of an existing process..." My understanding is that the problem with using vmspace_fork is that we don't know which virtual addresses are backed with physical pages and as such, we don't know what virtual address to begin copying data to (we were planning on using copyout). This process will never execute - we just need to copy a lot of kernel data to user memory, so we don't really care if we overwrite user stack or heap or anything like that. We simply want to choose (or be given) a starting virtual address where we can copy N pages. Thanks for your suggestion, any other hints or suggestions are definitely welcome. Thanks, Joe