Changing virtual adress space layout

Devesh Rai deveshkr at
Tue Feb 1 01:02:39 UTC 2011

Hi Mark,

After going through "Hardware Page Table Translation" section of manual, it looks like section based mapping is more beneficial. Because it requires just one "First Level" fetch by MMU for virtual to physical address translation.
What you told me in your previous response is making sense to me. I can now play around with code a bit. Thanks a lot for you help and time.

Thanks & Regards

-----Original Message-----
From: Mark Tinguely [mailto:marktinguely at] 
Sent: Friday, January 28, 2011 8:06 PM
To: Devesh Rai
Cc: freebsd-arm at
Subject: Re: Changing virtual adress space layout

On 1/28/2011 7:35 AM, Devesh Rai wrote:
> Hi Mark,
> Thank you very much for your detail response. Trick of not changing KERNVIRTADDR worked.
> I was able to map 1GB of RAM into kva from KERNBASE(0x8000_0000) to OLD_KERNBASE(0xC000_0000) using pmap_map_chunk api.
> I was able to write some data into mapped space and print it back.
> But some doubt I still have
> 1) What is L1 and L2 page table in FreeBSD? Is there document which explains these vm concepts for arm?
> 2) How do I verify that this mapping indeed happened?
> Thanks&  Regards
> Devesh
Good news.

The ARM(r) Architecture Reference Manual is available for download on the 
website There is a document that covers ARMv4-ARMv6 and a 
document for ARMv7.

The L1 maps 1MB of contiguous memory or has a pointer to a 1KB l2 page 
table entry that maps 256 4KB pages.

Sounds like you are mapping a 1MB contiuous area of memory that is on a 
1 MB boundary, but If you were not then, you first need to allocate 1KB 
for the l2 page table and install it into the kernel page table using 
the pmap_link_l2pt() routine. The pmap_map_chunk() routine can then be 
used to install the l1/l2 mapping.

You may want to think about the appropriate caching of this memory.

You can look at the l1 (and l2 if used) page tables to verify that the 
KVA is mapped to the proper PA. I suppose you could remap the PA to 
another KVA to verify values too, but you have to understand caching 
principles to do this correctly.


More information about the freebsd-arm mailing list