Beispiel #1
0
/*
 * map_4kb_page
 *   DESCRIPTION: map 4kb page based on passed address
 *   INPUTS: address - address of desired 4kb page
 *			 flags - indicates supervisor, read/write,  presence
 *   OUTPUTS: none
 *   RETURN VALUE: none
 *   SIDE EFFECTS: Sets entry of page directory
 */ 
void map_4kb_page (uint32_t address, uint32_t flags){
	int i; // for iterations
	int j = 0; // used for representing correct address

	// calculate index from passed address
	uint16_t page_dir_index = (address & PD_INDEX_MASK) >> 22;
	uint16_t page_table_index = (address & PT_INDEX_MASK) >> 12;

	// initialize all pages to not present when creating new page table
	if ((page_directory[page_dir_index] & PRESENT_MASK) == 0){
		for (i=0;i<INDEX_SIZE;i++){
			page_table[i] = j | NOT_PRESENT_WRITE; // initialize to supervisor, read/write, not present
			j = j + SIZE_OF_PAGE; // increment by one 4kb page
		}
	}

	// map a 4kb page at address passed
	page_table[page_table_index] = address | flags; // initialize passed flags

	// set constructed page table to correct index of page directory
	page_directory[page_dir_index] = (uint32_t)page_table | PRESENT_WRITE;
	flush_TLB(page_directory);
	return;
}
Beispiel #2
0
void vmmngr_flush_tld_entry(virtual_addr addr)
{
	flush_TLB(addr);
}