Subject: Re: allocating physical memory
To: Johan Danielsson <joda@pdc.kth.se>
From: Matthias Drochner <drochner@zel459.zel.kfa-juelich.de>
List: tech-kern
Date: 07/20/1999 11:11:52
joda@pdc.kth.se said:
> I want to read some data that the BIOS (this is on a peecee) has put
> into physical memory.
Here is what my experimental pnpbios code does:
static caddr_t
mapit(addr, len, prot)
u_long addr, len;
int prot;
{
u_long startpa, pa, endpa;
vaddr_t startva, va;
pa = startpa = i386_trunc_page(addr);
endpa = i386_round_page(addr + len);
va = startva = uvm_km_valloc(kernel_map, endpa - startpa);
if (!startva)
return (0);
for (; pa < endpa; pa += NBPG, va += NBPG)
pmap_kenter_pa(va, pa, prot);
return ((caddr_t)(startva + (addr - startpa)));
}
best regards
Matthias