Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 07 Mar 2002 10:53:18 -0800
From:      Michael Smith <msmith@freebsd.org>
To:        "Valery N. Khromov" <valery.khromov@icluk.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Converting physical into virtual address 
Message-ID:  <200203071853.g27IrIs01371@mass.dis.org>
In-Reply-To: Your message of "Mon, 04 Mar 2002 11:28:35 %2B0300." <009c01c1c356$93e13be0$c80ca8c0@khromovv> 

next in thread | previous in thread | raw e-mail | index | archive | help
> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203071853.g27IrIs01371>