ok, so I've been purusing windows 2000 internals books, and noticed an interesting little bit of the memory map.
the area from 0x80000000 to 0xa0000000 is an identity map of the first 512 megs of ram.
After thinking about why they would do that, I came to a realization and am actually very surprised that noone here has mentioned it before.
By doing this, we can successfully avoid a lot of temporary mappings and/or page dir switches when mapping/unmapping page tables.
Here's the concept, you have two seperate page pools, one for "low" memory and one for "high" memory. high memory is simply whatever is outside of your 1:1 memory window. You only allocate page dirs/page tables from low memory pool. What this gains us is firstly, you can read/write the page directory of a "new process" without any temporary mappings at all, no invalidating tlb, nothing, you just pick a page dir, add a constant to it to get it's virtual address. pretty much the same with page tables.
Using this technique, we sacrafice a certain large portion of the virtual address space for convinience and possibly speed (windows 2000 uses 4MB pages for this region to avoid invalidating the TLB for everything else whenever it access this region).
I've implemented this in my OS (i chose 256 megs for "low" memory size), and I've changed my Process::mapPage() code to use this technique, the code is a quater of the size.
What do you guys think about this? Is it something you were aware of and dismissed due to faults, or is it just not an idea floating around in the amature OS dev community?
proxy
identity mapping ram to save time/effort
Re:identity mapping ram to save time/effort
Hi!
Isn't this quite exactly what was discussed here as solution #1? Obviously, you can hardly map the whole physical memory there, so you will have to create a distinction between low memory and 'high' memory.
I guess the main counter-argument was that you sacrifice a lot of kernel space, and that there might be a better solution, depending on the kernel design. In long mode however, this is IMO the preferred solution, since you have plenty of virtual address space anyway.
cheers Joe
Isn't this quite exactly what was discussed here as solution #1? Obviously, you can hardly map the whole physical memory there, so you will have to create a distinction between low memory and 'high' memory.
I guess the main counter-argument was that you sacrifice a lot of kernel space, and that there might be a better solution, depending on the kernel design. In long mode however, this is IMO the preferred solution, since you have plenty of virtual address space anyway.
cheers Joe
Re:identity mapping ram to save time/effort
indeed it is well guess that answers that question
proxy
proxy