Commit 37f5b7d8 by triazo

Add helper function to create a blank table

parent 66b2c0ee
Showing with 20 additions and 2 deletions
......@@ -161,6 +161,24 @@ page_directory_entry* page_new_directory()
return pgdir;
}
// Returns a blank table
page_table_entry* page_new_table()
{
page_table_entry* pgtab = (page_table_entry*) page_allocate();
int i;
for(i = 0; i < 1024; i++)
{
// This sets the following flags to the pages:
// Supervisor: Only kernel-mode can access them
// Write Enabled: It can be both read from and written to
// (this is the 2 bit)
// Not Present: The page table is not present
pgtab[i] = 0;
pgtab[i] |= PAGE_WRITABLE;
}
return pgtab;
}
page_directory_entry* initiate_directory()
{
// set each entry to not present
......
......@@ -37,11 +37,11 @@ void page_free(void* page_start);
// Initilization
page_directory_entry* mem_init_kern_tables(multiboot_memory_map* mmap, multiboot_memory_map* mmap_end);
// Directory handling
// Directory and table handling
page_directory_entry* page_new_directory();
page_table_entry* page_new_table();
page_directory_entry* initiate_directory(); // DEPRECATED
// memory mark stores a counter of bytes for the most recently used
// memory. Everything before it is used and all valid memory after it
// is free
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment