Hi,
beyond infinity wrote:
Thanks for pointing this out. have completely overseen it. Reading is an art, I admit *smirk*
Hehee - I read it the first time, but had some form of bad connection between my eyes and my brain. I read it again so I understood what was going on. Then I read it again, slowly, looking for errors (and didn't find any, so I didn't post). Then you posted a few hours later and I thought I'd messed up, so I read it a few more times to make sure I knew what I was talking about before replying ;D.
beyond infinity wrote:
Anyway - with paging turned off, what would happen, if PTE_BASE is in a realm which is not accessible? (no memory present at that location?
PTE_BASE is being used as a mask (ANDed with the value of a page table entry to remove the attributes), so if it was wrong the physical address of the page table would also be wrong, and it'd all turn to mush in a hurry.
beyond infinity wrote:
I would rather perform this kind of operation with self reference (is immensely handy, I tell ya) and with paging enabled.
1. the virtualization is active - so you can insert any page at "any" location in the page dir /page tables.
2. if something weird is underway, the page fault handler would jump in - even it is trapped inside a double page fault - easier to debug, easier to manage.
A bug will result in similar "symptoms" regardless of which method is used (trashed address space/s).
As I see it the main advantage of self-referencing is that the TLB caches don't have to be entirely flushed (better performance), and it's easier to add support for "global" pages.
The disadvantages are that you have to worry about invalidating the TLB for the area/s you modify (INVLPG), and it's very difficult to debug if you mess this up. It's also harder to wrap your brains around (and therefore easier to write bugs).
Turning paging off and on again allows the kernel to modify
any address space (rather than just the one the CPU is using). It also means that the kernel code and stack (and anything else used when paging is disabled) must be identity mapped (linear/virtual address = physical address).
Cheers,
Brendan