My kernel starts by enabling paging and setting up two tables both pointed at the first 4MB of physical RAM. The two tables are
- An identity mapping
- The 4MB starting at 0xC0000000.
After a little thought, I was quite surprised that this actually worked, since I continue writing to video RAM (starting at 0xB8000) without any conversion to take account of the fact that I should be writing to 0xC00B8000 due to the way I set up the paging.
A little googling and browsing of the Intel manuals (volume 3 chapter 11) leads me to believe that this is due to something called the MTRR, and that this acts as a sort of page table that grabs any memory within a certain range and sends it off to (for example) some memory-mapped hardware (such as the video hardware). So poking values into 0xB8000 doesn't cause a page fault since the page tables are never called on to interpret the address -- instead the memory access is caught by the MTRR, which then does the right thing.
Have I understood this correctly?
If so, can I expect this behaviour to exist on real hardware (in particular, the BIOSes found in consumer-level x86 desktops), or do I need to ensure it by setting the appropriate MTRR details myself?