Re: How to allocate kernel address space ?

[ Available lists | Index of freebsd-hackers | Month of May 1995 | Week of 3 May 1995 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
David Greenman <davidg@Root.COM>
Date
3 May 1995 07:52:48
Subject
Re: How to allocate kernel address space ?
Message-ID
199505031451.HAA00589@corbin.Root.COM

In reply to

[ Hide this part ]
>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


Elapsed time: 0.154 seconds