Reputation: 35255
You might know these as Accessed and Dirty bits. Now x86 PTE contains these bits. Lets say the TLB also contains these bits. In case of a TLB hit, these bits will be set by the hardware if the page frame they are referring to is accessed or modified. My question is when are these bits copied back to the PTE by the hardware and how exactly is this accomplished (especially in case of software managed TLB)?
PS - I wish to know this because I am trying to design and test a page replacement algorithm.
Upvotes: 2
Views: 1586
Reputation: 62048
x86 CPUs don't have software-managed TLBs. If you want to simulate such a thing, you need to implement it on top of the normal TLB just as you'd go about mapping and unmapping physical pages into the virtual address space: intercept page accesses in the page fault handler, modify PDEs/PTEs, invalidate TLB entries as necessary and take special care in the case of multi-processor systems.
Setting of the accessed and dirty bits to 1 by the CPU is done transparently to software, so, once a page has been accessed, you should see the change immediately.
See the "Intel® 64 and IA-32 Architectures Software Developer’s Manual" for more details. Get the pdf that combines volumes 1 through 3, so you have all the necessary info in one place.
Upvotes: 1