réplica de
https://github.com/Arnau478/quark.git
synced 2024-11-23 12:58:07 +01:00
Fixed and optimized VMM
This commit is contained in:
pare
3ff5e1fd08
commit
f2b4802db2
S'han modificat 3 arxius amb 5 adicions i 7 eliminacions
|
@ -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){
|
void pd_entry_set_frame(pd_entry_t *entry, phys_addr frame){
|
||||||
*entry &= ~PDE_FRAME;
|
*entry = (*entry & ~PDE_FRAME) | frame;
|
||||||
*entry |= frame << 12;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
phys_addr pd_entry_get_frame(pd_entry_t entry){
|
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){
|
bool pd_entry_is_present(pd_entry_t entry){
|
||||||
|
|
|
@ -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){
|
void pt_entry_set_frame(pt_entry_t *entry, phys_addr frame){
|
||||||
*entry &= ~PTE_FRAME;
|
*entry = (*entry & ~PTE_FRAME) | frame;
|
||||||
*entry |= frame << 12;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
phys_addr pt_entry_get_frame(pt_entry_t entry){
|
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){
|
bool pt_entry_is_present(pt_entry_t entry){
|
||||||
|
|
|
@ -92,7 +92,7 @@ void vmm_initialize(){
|
||||||
// Clear default table
|
// Clear default table
|
||||||
memset(table, 0, sizeof(vmm_page_table_t));
|
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){
|
for(int i = 0, frame = 0x0, virt = 0x00000000; i<1024; i++, frame += 4096, virt += 4096){
|
||||||
// Create a new page
|
// Create a new page
|
||||||
pt_entry_t page = 0;
|
pt_entry_t page = 0;
|
||||||
|
|
Loading…
Referencia en una nova incidència