From owner-freebsd-hackers Thu Mar 7 10:54:46 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mass.dis.org (dhcp45-21.dis.org [216.240.45.21]) by hub.freebsd.org (Postfix) with ESMTP id 40F4B37B4A7 for ; Thu, 7 Mar 2002 10:53:54 -0800 (PST) Received: from mass.dis.org (localhost [127.0.0.1]) by mass.dis.org (8.11.6/8.11.6) with ESMTP id g27IrIs01371; Thu, 7 Mar 2002 10:53:19 -0800 (PST) (envelope-from msmith@mass.dis.org) Message-Id: <200203071853.g27IrIs01371@mass.dis.org> X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: "Valery N. Khromov" Cc: freebsd-hackers@freebsd.org Subject: Re: Converting physical into virtual address In-reply-to: Your message of "Mon, 04 Mar 2002 11:28:35 +0300." <009c01c1c356$93e13be0$c80ca8c0@khromovv> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 07 Mar 2002 10:53:18 -0800 From: Michael Smith Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > I'd like to develop a kernel module for FreeBSD, able to read & write > directly to VGA text-mode screen buffer. I know that this buffer is located > at 0xB8000 in physical address space. But in kernel I must address it using > kernel virtual address space. > > Thus, the question is: how can I _correctly_ convert physical address into > kernel virtual address? You don't. > Now I use the following trick: 0xC0000000 + 0xB8000, but I want to use more > correct method. :) The memory at 0xb8000 is owned by the VGA driver. Depending on what your module wants to do, you can either become a client of the driver (using eg. the screensaver interface) or you can look over its' shoulder and steal its' mapping yourself. There's a good chance you don't actually want/need to be in the kernel in the first place, and if that's so, you can access video memory from userspace (see the VGL library for examples). If you're trying to completely replace the VGA driver, then you will want to look at how it handles creating and then allocating resources for video memory. -- To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public. - Theodore Roosevelt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message