JamesM tutorial, Page table entry format
Posted: Wed Feb 10, 2010 3:41 am
In this tutorial by JamesM, there's a nice picture of the page table entry format for the x86 architecture. However, later he defines a structure as:
But looking at the picture, shouldn't that be:
Both 'seem' to work equally well. Havn't tested the second one too thoroughly though. Is the image correct or not? I'm assuming JamesM code is correct since it has probably been used by quite a lot of people. Or is there something I'm missing here?
Code: Select all
typedef struct page
{
u32int present : 1; // Page present in memory
u32int rw : 1; // Read-only if clear, readwrite if set
u32int user : 1; // Supervisor level only if clear
u32int accessed : 1; // Has the page been accessed since last refresh?
u32int dirty : 1; // Has the page been written to since last refresh?
u32int unused : 7; // Amalgamation of unused and reserved bits
u32int frame : 20; // Frame address (shifted right 12 bits)
} page_t;
Code: Select all
typedef struct page
{
u32int present : 1; // Page present in memory
u32int rw : 1; // Read-only if clear, readwrite if set
u32int user : 1; // Supervisor level only if clear
u32int reserved : 2; // Reserved bits <-------------- Missing from the first.
u32int accessed : 1; // Has the page been accessed since last refresh?
u32int dirty : 1; // Has the page been written to since last refresh?
u32int unused: 5; // Amalgamation of unused and reserved bits
u32int frame : 20; // Frame address (shifted right 12 bits)
} page_t;