Closed clamyang closed 1 year ago
@clamyang when you run the program, you'll see a section above the Page Table which says:
The format of the page table is simple: The high-order (left-most) bit is the VALID bit. ⭐ If the bit is 1, the rest of the entry is the PFN. If the bit is 0, the page is not valid.
This ultimately means that a page table entry contains two pieces of information - whether it is valid and then also the Physical Frame Number (PFN). Pay attention to the line above with the ⭐, it states that if the Most Significant Bit (MSB) is 1, then the rest of the number, excluding that bit, represents the PFN.
The example in the README 0x80000006
is represented in hexadecimal, and if we wrote this out in binary it would be 1000 0000 0000 0000 0000 0000 0000 0110
, which clearly shows that the MSB is 1 and therefore this page entry is valid.
To get the PFN, we ignore the MSB and look only at the rest of the number to get the PFN, which is 000 0000 0000 0000 0000 0000 0000 0110
. Since it is binary, we can safely ignore leading zeroes and write it more compactly as 0110
, or 0x6
in hexadecimal.
Hope that helps! 😸
From paging-linear-translate.py i got a Page Table as follows:
After calculate the VPN is 3, the PFN is 0x80000006. But in README.md the PFN is 0x6. Does it wrong?