Disable caching for MMIO regions

This commit is contained in:
Kevin Lange 2016-09-09 09:25:39 +09:00
parent 33d8178b49
commit caef2a0d27
3 changed files with 6 additions and 4 deletions

View File

@ -7,8 +7,8 @@ typedef struct page {
unsigned int present:1;
unsigned int rw:1;
unsigned int user:1;
unsigned int accessed:1;
unsigned int dirty:1;
unsigned int writethrough:1;
unsigned int cachedisable:1;
unsigned int unused:7;
unsigned int frame:20;
} __attribute__((packed)) page_t;

View File

@ -67,6 +67,8 @@ kmalloc_real(
set_frame((index + i) * 0x1000);
page_t * page = get_page((uintptr_t)address + (i * 0x1000),0,kernel_directory);
page->frame = index + i;
page->writethrough = 1;
page->cachedisable = 1;
}
spin_unlock(frame_alloc_lock);
}

View File

@ -143,8 +143,8 @@ clone_table(
if (src->pages[i].present) table->pages[i].present = 1;
if (src->pages[i].rw) table->pages[i].rw = 1;
if (src->pages[i].user) table->pages[i].user = 1;
if (src->pages[i].accessed) table->pages[i].accessed = 1;
if (src->pages[i].dirty) table->pages[i].dirty = 1;
if (src->pages[i].writethrough) table->pages[i].writethrough = 1;
if (src->pages[i].cachedisable) table->pages[i].cachedisable = 1;
/* Copy the contents of the page from the old table to the new one */
copy_page_physical(src->pages[i].frame * 0x1000, table->pages[i].frame * 0x1000);
}