Changeset 45 for trunk/hal/x86_64/hal_gpt.c
- Timestamp:
- Jun 23, 2017, 11:55:08 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/hal_gpt.c
r44 r45 65 65 } 66 66 67 /* 68 * Reset the bootstrap VA we've used in cluster0 so far. After this 69 * function, cluster0's heap is empty. 70 */ 71 void hal_gpt_bootstrap_reset() 72 { 73 size_t npages = (va_avail - CLUSTER_HEAP_MIN_VA(0)) / PAGE_SIZE; 74 hal_gpt_leave_range(CLUSTER_HEAP_MIN_VA(0), npages); 75 } 76 77 67 78 void hal_gpt_enter(vaddr_t va, paddr_t pa) 68 79 { 69 XASSERT((va % PAGE_SIZE == 0)); 70 XASSERT((pa % PAGE_SIZE == 0)); 80 XASSERT(va % PAGE_SIZE == 0); 81 XASSERT(pa % PAGE_SIZE == 0); 82 XASSERT(va == tmpva || PTE_BASE[pl1_i(va)] == 0); 71 83 PTE_BASE[pl1_i(va)] = (pa & PG_FRAME) | PG_V | PG_KW | PG_NX; 72 84 } … … 77 89 for (i = 0; i < n; i++) { 78 90 hal_gpt_enter(va + i * PAGE_SIZE, pa + i * PAGE_SIZE); 91 invlpg(va + i * PAGE_SIZE); 92 } 93 } 94 95 void hal_gpt_leave(vaddr_t va) 96 { 97 XASSERT(va % PAGE_SIZE == 0); 98 XASSERT(PTE_BASE[pl1_i(va)] != 0); 99 PTE_BASE[pl1_i(va)] = 0; 100 } 101 102 void hal_gpt_leave_range(vaddr_t va, size_t n) 103 { 104 size_t i; 105 for (i = 0; i < n; i++) { 106 hal_gpt_leave(va + i * PAGE_SIZE); 79 107 invlpg(va + i * PAGE_SIZE); 80 108 }
Note: See TracChangeset
for help on using the changeset viewer.