From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 14 21:22:15 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 A297216A41C; Tue, 14 Jun 2005 21:22:15 +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 7179443D49; Tue, 14 Jun 2005 21:22:15 +0000 (GMT) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (nprxrc@localhost.funkthat.com [127.0.0.1]) by hydrogen.funkthat.com (8.13.3/8.13.3) with ESMTP id j5ELMEes079099; Tue, 14 Jun 2005 14:22:14 -0700 (PDT) (envelope-from jmg@hydrogen.funkthat.com) Received: (from jmg@localhost) by hydrogen.funkthat.com (8.13.3/8.13.3/Submit) id j5ELMEVU079098; Tue, 14 Jun 2005 14:22:14 -0700 (PDT) (envelope-from jmg) Date: Tue, 14 Jun 2005 14:22:14 -0700 From: John-Mark Gurney To: Aziz Kezzou Message-ID: <20050614212214.GK742@funkthat.com> Mail-Followup-To: Aziz Kezzou , freebsd-hackers , freebsd-net References: <37273927050614012154fdb80b@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <37273927050614012154fdb80b@mail.gmail.com> User-Agent: Mutt/1.4.2.1i X-Operating-System: FreeBSD 5.4-RELEASE-p1 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-net Subject: Re: FreeBSD Memory Management questions ? 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, 14 Jun 2005 21:22:15 -0000 Aziz Kezzou wrote this message on Tue, Jun 14, 2005 at 04:21 -0400: > I have two questions concerning FreeBSD Memory management : > > 1 - Right now to access the memory address space of a user process > from kernel mode, I only have to set, on x86 systems, the register CR3 > to the right value. How can I do that on other architectures ? is > there an architecture-independant way of doing that ? > > 2- I have noticed that while in kernel mode the value of CR3 is equal > to that of the user process beeing interrupted. Doesn't the kernel > supposed to have its "own" page-directory, i.e it's own CR3 value ? > or is kernel virtual address resolution does not go through CR3 at > all ? You should be using copyin(9)/copyout(9) instead of playing around with CR3 directly... or fuword(9)/suword(9)... This provides a platform independant way of accessing user's memory (for the current running process)... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."