Changes in kernel/genarch/src/mm/page_pt.c [15187c3:f18d01b6] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/mm/page_pt.c
r15187c3 rf18d01b6 82 82 83 83 if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT) { 84 pte_t *newpt = (pte_t *) frame_alloc(PTL1_SIZE,85 FRAME_LOWMEM | FRAME_KA);86 memsetb(newpt, FRAME_SIZE <<PTL1_SIZE, 0);84 pte_t *newpt = (pte_t *) 85 PA2KA(frame_alloc(PTL1_FRAMES, FRAME_LOWMEM, PTL1_SIZE - 1)); 86 memsetb(newpt, PTL1_SIZE, 0); 87 87 SET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page), KA2PA(newpt)); 88 88 SET_PTL1_FLAGS(ptl0, PTL0_INDEX(page), … … 101 101 102 102 if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT) { 103 pte_t *newpt = (pte_t *) frame_alloc(PTL2_SIZE,104 FRAME_LOWMEM | FRAME_KA);105 memsetb(newpt, FRAME_SIZE <<PTL2_SIZE, 0);103 pte_t *newpt = (pte_t *) 104 PA2KA(frame_alloc(PTL2_FRAMES, FRAME_LOWMEM, PTL2_SIZE - 1)); 105 memsetb(newpt, PTL2_SIZE, 0); 106 106 SET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page), KA2PA(newpt)); 107 107 SET_PTL2_FLAGS(ptl1, PTL1_INDEX(page), … … 118 118 119 119 if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT) { 120 pte_t *newpt = (pte_t *) frame_alloc(PTL3_SIZE,121 FRAME_LOWMEM | FRAME_KA);122 memsetb(newpt, FRAME_SIZE << PTL3_SIZE, 0);120 pte_t *newpt = (pte_t *) 121 PA2KA(frame_alloc(PTL3_FRAMES, FRAME_LOWMEM, PTL2_SIZE - 1)); 122 memsetb(newpt, PTL2_SIZE, 0); 123 123 SET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page), KA2PA(newpt)); 124 124 SET_PTL3_FLAGS(ptl2, PTL2_INDEX(page), … … 219 219 memsetb(&ptl0[PTL0_INDEX(page)], sizeof(pte_t), 0); 220 220 #endif 221 frame_free(KA2PA((uintptr_t) ptl3) );221 frame_free(KA2PA((uintptr_t) ptl3), PTL3_FRAMES); 222 222 } else { 223 223 /* … … 253 253 memsetb(&ptl0[PTL0_INDEX(page)], sizeof(pte_t), 0); 254 254 #endif 255 frame_free(KA2PA((uintptr_t) ptl2) );255 frame_free(KA2PA((uintptr_t) ptl2), PTL2_FRAMES); 256 256 } else { 257 257 /* … … 284 284 285 285 memsetb(&ptl0[PTL0_INDEX(page)], sizeof(pte_t), 0); 286 frame_free(KA2PA((uintptr_t) ptl1) );286 frame_free(KA2PA((uintptr_t) ptl1), PTL1_FRAMES); 287 287 } 288 288 #endif /* PTL1_ENTRIES != 0 */ … … 363 363 * @param size Size in bytes defining the range of PTL0 entries that will be 364 364 * altered by this function. 365 * 365 366 */ 366 367 void pt_mapping_make_global(uintptr_t base, size_t size) 367 368 { 369 ASSERT(size > 0); 370 368 371 uintptr_t ptl0 = PA2KA((uintptr_t) AS_KERNEL->genarch.page_table); 369 372 uintptr_t ptl0_step = ptl0_step_get(); 370 size_t order; 371 uintptr_t addr; 372 373 size_t frames; 374 373 375 #if (PTL1_ENTRIES != 0) 374 order = PTL1_SIZE;376 frames = PTL1_FRAMES; 375 377 #elif (PTL2_ENTRIES != 0) 376 order = PTL2_SIZE;378 frames = PTL2_FRAMES; 377 379 #else 378 order = PTL3_SIZE; 379 #endif 380 381 ASSERT(size > 0); 382 383 for (addr = ALIGN_DOWN(base, ptl0_step); addr - 1 < base + size - 1; 380 frames = PTL3_FRAMES; 381 #endif 382 383 for (uintptr_t addr = ALIGN_DOWN(base, ptl0_step); 384 addr - 1 < base + size - 1; 384 385 addr += ptl0_step) { 385 uintptr_t l1; 386 387 l1 = (uintptr_t) frame_alloc(order, FRAME_KA | FRAME_LOWMEM); 388 memsetb((void *) l1, FRAME_SIZE << order, 0); 386 uintptr_t l1 = PA2KA(frame_alloc(frames, FRAME_LOWMEM, 0)); 387 memsetb((void *) l1, FRAMES2SIZE(frames), 0); 389 388 SET_PTL1_ADDRESS(ptl0, PTL0_INDEX(addr), KA2PA(l1)); 390 389 SET_PTL1_FLAGS(ptl0, PTL0_INDEX(addr),
Note:
See TracChangeset
for help on using the changeset viewer.