From owner-freebsd-hackers Wed May 3 07:52:48 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id HAA00149 for hackers-outgoing; Wed, 3 May 1995 07:52:48 -0700 Received: from mail.barrnet.net (mail.BARRNET.NET [131.119.246.7]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id HAA00138 for ; Wed, 3 May 1995 07:52:33 -0700 Received: from Root.COM (implode.Root.COM [198.145.90.1]) by mail.barrnet.net (8.6.10/MAIL-RELAY-LEN) with ESMTP id HAA13433 for ; Wed, 3 May 1995 07:49:47 -0700 Received: from corbin.Root.COM (corbin.Root.COM [198.145.90.18]) by Root.COM (8.6.8/8.6.5) with ESMTP id HAA00538; Wed, 3 May 1995 07:51:09 -0700 Received: from localhost (localhost [127.0.0.1]) by corbin.Root.COM (8.6.11/8.6.5) with SMTP id HAA00589; Wed, 3 May 1995 07:51:09 -0700 Message-Id: <199505031451.HAA00589@corbin.Root.COM> To: "Serge A. Babkin" cc: hackers@FreeBSD.org Subject: Re: How to allocate kernel address space ? In-reply-to: Your message of "Wed, 03 May 95 17:11:22 +0500." <199505031211.RAA08593@hq.icb.chel.su> From: David Greenman Reply-To: davidg@Root.COM Date: Wed, 03 May 1995 07:51:08 -0700 Sender: hackers-owner@FreeBSD.org Precedence: bulk >Is there any function for allocating of kernel address space (not >memory but address space for device's memory) ? I studied the >existing drivers and I found that they assume that virtual >address space in kernel mode is equal to the physical one. Yes, it's "pmap_mapdev()". I originally wrote it for someone to map a 1MB shared memory device (an ATM controller), but it is also being used in the PCI code. Someday I plan to use it in all device drivers that use/map device shared memory. >But there is something strange: they convert physical addresses >to virtual ones by simply assigning, but they convert virtual >addresses to physical ones using kvtop(). Why ? For additional >check ? The fact that the first 1MB of physical memory is mapped at KERNBASE is a total hack and kludge. So converting from physical to virtual addresses using this is a hack. Using kvtop() to convert a virtual address to a physical one, however, isn't a hack at all - the information is gotten from the page tables as it should be. -DG