transferring files.
This commit is contained in:
parent
6a466fe48d
commit
79576ac9c5
2 changed files with 11 additions and 3 deletions
|
@ -171,6 +171,9 @@ int main() {
|
|||
int i;
|
||||
|
||||
for (i=0; i<NACCESS; i++) {
|
||||
Console::puts("\n");
|
||||
Console::puti(i);
|
||||
Console::puts("\n");
|
||||
foo[i] = i;
|
||||
}
|
||||
Console::puts("DONE WRITING TO MEMORY. Now testing...\n");
|
||||
|
|
|
@ -25,9 +25,9 @@ void PageTable::init_paging(ContFramePool * _kernel_mem_pool,
|
|||
|
||||
PageTable::PageTable()
|
||||
{
|
||||
unsigned long * temp_page_directory = (unsigned long *) (4096 * kernel_mem_pool->get_frames(1)); // Getting frame address to assign to page directory.
|
||||
unsigned long * temp_page_directory = (unsigned long *) ((kernel_mem_pool->get_frames(1)) << 12); // Getting frame address to assign to page directory.
|
||||
|
||||
unsigned long * page_table = (unsigned long *) (4096 * kernel_mem_pool->get_frames(1)); // Get another frame for the page table.
|
||||
unsigned long * page_table = (unsigned long *) ((kernel_mem_pool->get_frames(1)) << 12); // Get another frame for the page table.
|
||||
|
||||
unsigned long tempaddr = 0; // Temporary address iterator.
|
||||
|
||||
|
@ -54,6 +54,7 @@ PageTable::PageTable()
|
|||
temp_page_directory[j] = 0 | 2;
|
||||
}
|
||||
|
||||
//page_directory = (unsigned long *) ((unsigned long)temp_page_directory + (unsigned long)page_table + (unsigned long)page_table[0]);
|
||||
page_directory = temp_page_directory;
|
||||
|
||||
current_page_table = this;
|
||||
|
@ -64,13 +65,17 @@ PageTable::PageTable()
|
|||
|
||||
void PageTable::load()
|
||||
{
|
||||
//write_cr3((unsigned long)page_directory + (unsigned long)page_directory[0] + (unsigned long)((unsigned long *)page_directory[0])[0]);
|
||||
write_cr3((unsigned long)page_directory);
|
||||
Console::puti((unsigned long)page_directory);
|
||||
//for(;;);
|
||||
current_page_table = this;
|
||||
Console::puts("\nLoaded page table\n");
|
||||
}
|
||||
|
||||
void PageTable::enable_paging()
|
||||
{
|
||||
//write_cr3((unsigned long)current_page_table->page_directory + (unsigned long)current_page_table->page_directory[0] + (unsigned long)((unsigned long *)current_page_table->page_directory[0])[0]);
|
||||
write_cr3((unsigned long)current_page_table->page_directory);
|
||||
write_cr0(read_cr0() | 0x80000000);
|
||||
paging_enabled = read_cr0();
|
||||
|
@ -93,7 +98,7 @@ Console::puti(read_cr2());
|
|||
|
||||
Console::puts("\naddress: ");
|
||||
Console::puti(read_cr3());
|
||||
|
||||
for(;;);
|
||||
Console::puts("\nhandled page fault\n");
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue