Code: Select all
typedef struct page {
u32 present : 1; // Page present in memory
u32 rw : 1; // Read-only if clear, readwrite if set
u32 user : 1; // Supervisor level only if clear
u32 accessed : 1; // Has the page been accessed since last refresh?
u32 dirty : 1; // Has the page been written to since last refresh?
u32 unused : 7; // Amalgamation of unused and reserved bits
u32 frame : 20; // Frame address (shifted right 12 bits)
} page_t;
for(i = PG_ALIGN(start), j = 0xff; i < PG_ALIGN(end+0x1000); i += 0x1000, ++j) {
idx = first_frame();
user_pde->tables[PDE_OFFSET(i)]->pages[PTE_OFFSET(i)].frame = j;
user_pde->tables[PDE_OFFSET(i)]->pages[PTE_OFFSET(i)].present = 1;
user_pde->tables[PDE_OFFSET(i)]->pages[PTE_OFFSET(i)].user = 1;
set_frame(idx*0x1000);
}
Most of this code was taken from JamesM, and it works in his kernel, so i dont know what im missing here.
Here is the contents of the page table from bochs:
Code: Select all
<bochs:2> x /10 0xd0004000
[bochs]:
0xd0004000 <bogus+ 0>: 0x05000000 0x05000ff0 0x05001000 0x05001010
0xd0004010 <bogus+ 16>: 0x05001020 0x05001030 0x05001040 0x05001050
0xd0004020 <bogus+ 32>: 0x05001060 0x05001070