Fixed and optimized VMM

This commit is contained in:
Arnau Camprubí 2022-07-24 15:32:57 +02:00
pare 3ff5e1fd08
commit f2b4802db2
S'han modificat 3 arxius amb 5 adicions i 7 eliminacions

Veure arxiu

@ -9,12 +9,11 @@ void pd_entry_del_attr(pd_entry_t *entry, uint32_t attr){
}
void pd_entry_set_frame(pd_entry_t *entry, phys_addr frame){
*entry &= ~PDE_FRAME;
*entry |= frame << 12;
*entry = (*entry & ~PDE_FRAME) | frame;
}
phys_addr pd_entry_get_frame(pd_entry_t entry){
return entry >> 12;
return entry & PDE_FRAME;
}
bool pd_entry_is_present(pd_entry_t entry){

Veure arxiu

@ -9,12 +9,11 @@ void pt_entry_del_attr(pt_entry_t *entry, uint32_t attr){
}
void pt_entry_set_frame(pt_entry_t *entry, phys_addr frame){
*entry &= ~PTE_FRAME;
*entry |= frame << 12;
*entry = (*entry & ~PTE_FRAME) | frame;
}
phys_addr pt_entry_get_frame(pt_entry_t entry){
return entry >> 12;
return entry & PTE_FRAME;
}
bool pt_entry_is_present(pt_entry_t entry){

Veure arxiu

@ -92,7 +92,7 @@ void vmm_initialize(){
// Clear default table
memset(table, 0, sizeof(vmm_page_table_t));
// First 1MB are identity mapped
// First 4MB are identity mapped
for(int i = 0, frame = 0x0, virt = 0x00000000; i<1024; i++, frame += 4096, virt += 4096){
// Create a new page
pt_entry_t page = 0;