Changes in kernel/genarch/src/mm/page_pt.c [15187c3:ef9a2a8] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/mm/page_pt.c
r15187c3 ref9a2a8 77 77 unsigned int flags) 78 78 { 79 //printf("pt_mapping_insert: as=%p, page=0x%08x, frame=0x%08x\n", as, page, frame); 80 79 81 pte_t *ptl0 = (pte_t *) PA2KA((uintptr_t) as->genarch.page_table); 80 82 83 //printf("ptl0 = %p\n", ptl0); 84 81 85 ASSERT(page_table_locked(as)); 82 86 83 87 if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT) { 88 // printf("allocating ptl1\n"); 89 84 90 pte_t *newpt = (pte_t *) frame_alloc(PTL1_SIZE, 85 91 FRAME_LOWMEM | FRAME_KA); 92 93 // printf("newpt = %p, index = %d\n", newpt, PTL0_INDEX(page)); 94 86 95 memsetb(newpt, FRAME_SIZE << PTL1_SIZE, 0); 87 96 SET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page), KA2PA(newpt)); … … 100 109 pte_t *ptl1 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page))); 101 110 111 // printf("ptl1 = %p\n", ptl1); 112 102 113 if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT) { 114 // printf("allocating ptl2\n"); 115 103 116 pte_t *newpt = (pte_t *) frame_alloc(PTL2_SIZE, 104 117 FRAME_LOWMEM | FRAME_KA); 118 119 // printf("newpt = %p, index = %d\n", newpt, PTL1_INDEX(page)); 120 105 121 memsetb(newpt, FRAME_SIZE << PTL2_SIZE, 0); 106 122 SET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page), KA2PA(newpt)); … … 112 128 */ 113 129 write_barrier(); 114 SET_PTL2_PRESENT(ptl1, PTL1_INDEX(page)); 130 SET_PTL2_PRESENT(ptl1, PTL1_INDEX(page)); 115 131 } 116 132 117 133 pte_t *ptl2 = (pte_t *) PA2KA(GET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page))); 118 134 135 // printf("ptl2 = %p\n", ptl2); 136 119 137 if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT) { 138 // printf("allocating ptl3\n"); 139 120 140 pte_t *newpt = (pte_t *) frame_alloc(PTL3_SIZE, 121 141 FRAME_LOWMEM | FRAME_KA); 142 143 // printf("newpt = %p, index = %d\n", newpt, PTL2_INDEX(page)); 144 122 145 memsetb(newpt, FRAME_SIZE << PTL3_SIZE, 0); 123 146 SET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page), KA2PA(newpt)); … … 134 157 pte_t *ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page))); 135 158 159 // printf("ptl3 = %p\n", ptl3); 160 136 161 SET_FRAME_ADDRESS(ptl3, PTL3_INDEX(page), frame); 137 162 SET_FRAME_FLAGS(ptl3, PTL3_INDEX(page), flags | PAGE_NOT_PRESENT); … … 180 205 * Destroy the mapping. 181 206 * Setting to PAGE_NOT_PRESENT is not sufficient. 182 * But we need SET_FRAME for possible PT coherence maintenance. 183 * At least on ARM. 184 */ 185 //TODO: Fix this inconsistency 186 SET_FRAME_FLAGS(ptl3, PTL3_INDEX(page), PAGE_NOT_PRESENT); 207 */ 187 208 memsetb(&ptl3[PTL3_INDEX(page)], sizeof(pte_t), 0); 188 209
Note:
See TracChangeset
for help on using the changeset viewer.