Key points review
Physical page attributes = PDE attributes & (AND operation) PTE attributes
U/S position
U/S = 0: This physical page is only allowed to be accessed byprivileged users.
U/S = 1: This physical pageordinary users can also access.
experiment
Modify the PDE/PTE attributes of a high 2G linear address to make it readable by R3, for example: 0x8003F00C.
#include "stdafx.h"
#include <windows.h>
int main(int argc, char* argv[])
{
PDWORD p = (PDWORD)0x8003F00C;
getchar();
printf("读高2G内存地址:%x\n", *p);
return 0;
}
If the above code is executed directly, an error will be reported.
If you modify the U/S bits of PDE and PTE at the address 0x8003F00C and execute again, there will be no error:
It means that as an ordinary user, you can already read and write memory addresses up to 2G.
In other words, it is purely a page limit.
P/S bit
The PS (PageSize) bit is only meaningful for PDE.
PS = 0: No PTE.
PS = 1: PDE directly points to the physical page. The lower 22 bits do not need to be split, and are directly the intra-page offset of the physical page.
The linear address can only be split into 2 segments, and the size is 4MB, commonly known as large pages.
experiment
Analyze the PDE attributes of the linear address 0x8043F00C.
A position
Whether it has been accessed (read or write), set to 1 if accessed. Even accessing only one byte will cause the A bit of PDE and PTE to be set to 1.
D position
Has it been written.
D = 0: has not been written.
D = 1: has been written.
About G, PWT, PCD bits
There is no introduction here for now. You need to have control register and TLB< Only with the knowledge of a i=4> can we continue to understand.