implementing paging
Posted: Fri Feb 08, 2008 6:25 am
hello friends,
have been following the james molly os tutorial (to develop my own kernel for acadamics purpose. I am trying to implement paging, but am facing several problems in this regards. after some debugging of the code given in the tutorial, and reading the source code, i finally could do things to some extent. i tried INT $0xE after initializing the page fault n the result was as expected. however, in the tutorial there is a test to check the page fault, which is to write the code...
which is suppose to cause a page fault by reading the location 0xA0000000. But nothing like this happens. There is no message of page fault displayed on the screen.
could you please tell me why should a page fault occur by the above code ?
we have written functions..
out of which only page_fault is being used. whats the need to write the rest ??? also at one place alloc_frame function is used for identity map ..
could you please tell me why is that required.
I am all very confused, and it would be gr8 if you could summarise what exactly is happening. how is paging implemented. I have done a course on operating systems, so am familiar with the theory of paging.
Enabled BBcode to make the post more readable - Combuster
have been following the james molly os tutorial (to develop my own kernel for acadamics purpose. I am trying to implement paging, but am facing several problems in this regards. after some debugging of the code given in the tutorial, and reading the source code, i finally could do things to some extent. i tried INT $0xE after initializing the page fault n the result was as expected. however, in the tutorial there is a test to check the page fault, which is to write the code...
Code: Select all
u32int *ptr = (u32int*)0xA0000000;
u32int do_page_fault = *ptr;
could you please tell me why should a page fault occur by the above code ?
we have written functions..
Code: Select all
void alloc_frame(page_t* page, int is_kernel, int is_writeable);
void free_frame(page_t* page);
void initialise_paging();
void switch_page_directory(page_directory_t* dir);
page_t* get_page(u32int address, int make, page_directory_t* dir);
void page_fault(struct regs reg1);
out of which only page_fault is being used. whats the need to write the rest ??? also at one place alloc_frame function is used for identity map ..
Code: Select all
while (i < placement_address)
{
// Kernel code is readable but not writeable from userspace.
alloc_frame( get_page(i, 1, kernel_directory), 0, 0);
i += 0x1000;
}
I am all very confused, and it would be gr8 if you could summarise what exactly is happening. how is paging implemented. I have done a course on operating systems, so am familiar with the theory of paging.
Enabled BBcode to make the post more readable - Combuster