Hi,
lama wrote:So what address should the 768. page table have? 0xc00*0x1000+0x100000? evidently nope, i throwing nonsences here.. damm, can anyone please tell me how to map these pages to 1:1?
If you're only ever going to map things 1:1, then don't bother using paging.
If you plan to take advantage of paging sooner or later (for example, to have separate virtual address spaces for different applications/processes), then you will need to decide which areas of the virtual address space will be used for what. For example, you might have a large area intended for "user space" and another big area intended for "kernel space". Then you might split "kernel space" into smaller areas - for example, one area for kernel code and data and one area for memory mapped devices (e.g. video cards, etc).
For example, given that you've already identity mapped the first 4 MiB, then maybe kernel space is from 0x00000000 to 0x3FFFFFFF and user space is from 0x40000000 to 0xFFFFFFFF; and kernel space should be split into an identity mapped area from 0x00000000 to 0x1FFFFFFF and another area from 0x20000000 to 0x3FFFFFFF for mapping things like video display memory.
Of course for most OSs, kernel space is at the highest part of the virtual address space. For example, user space from 0x00000000 to 0xBFFFFFFF, with kernel space from 0xC0000000 to 0xFFFFFFFF. This makes things look nice and clean for processes, and means you can change the size of user space easily. It also means that nothing is mapped 1:1. However, in this case you might still temporarily do a 1:1 mapping during boot (before you've setup paging properly) to make the transition easier, and discard that 1:1 mapping after paging is setup properly.
Cheers,
Brendan