Changeset 83 for trunk/hal/x86_64/core
- Timestamp:
- Jun 28, 2017, 1:39:05 PM (7 years ago)
- Location:
- trunk/hal/x86_64/core
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/core/hal_apic.c
r82 r83 21 21 22 22 #include <hal_types.h> 23 #include <hal_boot.h> 23 24 #include <hal_register.h> 24 25 #include <hal_segmentation.h> … … 91 92 wrmsr(MSR_APICBASE, lapic_pa | APICBASE_EN); 92 93 93 hal_gpt_enter(lapic_va, lapic_pa );94 hal_gpt_enter(lapic_va, lapic_pa, PG_V|PG_KW|PG_NX|PG_N); 94 95 95 96 hal_lapic_write(LAPIC_TPR, 0); -
trunk/hal/x86_64/core/hal_gpt.c
r79 r83 75 75 } 76 76 77 void hal_gpt_enter(vaddr_t va, paddr_t pa )77 void hal_gpt_enter(vaddr_t va, paddr_t pa, pt_entry_t flags) 78 78 { 79 79 XASSERT(va % PAGE_SIZE == 0); 80 80 XASSERT(pa % PAGE_SIZE == 0); 81 81 XASSERT(va == tmpva || PTE_BASE[pl1_i(va)] == 0); 82 PTE_BASE[pl1_i(va)] = (pa & PG_FRAME) | PG_V | PG_KW | PG_NX;82 PTE_BASE[pl1_i(va)] = (pa & PG_FRAME) | flags; 83 83 invlpg(va); 84 84 } … … 86 86 void hal_gpt_enter_range(vaddr_t va, paddr_t pa, size_t n) 87 87 { 88 pt_entry_t flags = PG_V | PG_KW | PG_NX; 88 89 size_t i; 89 90 for (i = 0; i < n; i++) { 90 hal_gpt_enter(va + i * PAGE_SIZE, pa + i * PAGE_SIZE );91 hal_gpt_enter(va + i * PAGE_SIZE, pa + i * PAGE_SIZE, flags); 91 92 } 92 93 } … … 116 117 void hal_gpt_maptree_area(vaddr_t va_start, vaddr_t va_end) 117 118 { 119 pt_entry_t flags = PG_V| PG_KW | PG_NX; 118 120 size_t L4start, L4end, nL4e; 119 121 size_t L3start, L3end, nL3e; … … 145 147 for (i = 0; i < nL2e; i++) { 146 148 pa = L1page + i * PAGE_SIZE; 147 hal_gpt_enter(tmpva, pa );149 hal_gpt_enter(tmpva, pa, flags); 148 150 149 151 memset((void *)tmpva, 0, PAGE_SIZE); … … 153 155 for (i = 0; i < nL3e; i++) { 154 156 pa = L2page + i * PAGE_SIZE; 155 hal_gpt_enter(tmpva, pa );157 hal_gpt_enter(tmpva, pa, flags); 156 158 157 159 memset((void *)tmpva, 0, PAGE_SIZE); … … 161 163 for (i = 0; i < nL4e; i++) { 162 164 pa = L3page + i * PAGE_SIZE; 163 hal_gpt_enter(tmpva, pa );165 hal_gpt_enter(tmpva, pa, flags); 164 166 165 167 memset((void *)tmpva, 0, PAGE_SIZE); … … 172 174 pa -= npa; /* shift on the left */ 173 175 pa &= PG_FRAME; /* rounddown to a page boundary */ 174 hal_gpt_enter(tmpva, pa );176 hal_gpt_enter(tmpva, pa, flags); 175 177 176 178 pde = (pt_entry_t *)tmpva; … … 185 187 pa -= npa; /* shift on the left */ 186 188 pa &= PG_FRAME; /* rounddown to a page boundary */ 187 hal_gpt_enter(tmpva, pa );189 hal_gpt_enter(tmpva, pa, flags); 188 190 189 191 pde = (pt_entry_t *)tmpva; -
trunk/hal/x86_64/core/hal_internal.h
r82 r83 43 43 vaddr_t hal_gpt_bootstrap_valloc(size_t npages); 44 44 void hal_gpt_bootstrap_reset(); 45 void hal_gpt_enter(vaddr_t va, paddr_t pa );45 void hal_gpt_enter(vaddr_t va, paddr_t pa, pt_entry_t flags); 46 46 void hal_gpt_enter_range(vaddr_t va, paddr_t pa, size_t n); 47 47 void hal_gpt_leave(vaddr_t va);
Note: See TracChangeset
for help on using the changeset viewer.