Changes in kernel/generic/src/mm/backend_elf.c [59fb782:38dc82d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/backend_elf.c
r59fb782 r38dc82d 75 75 .page_fault = elf_page_fault, 76 76 .frame_free = elf_frame_free, 77 78 .create_shared_data = NULL, 79 .destroy_shared_data = NULL 77 80 }; 78 81 … … 181 184 182 185 for (j = 0; j < count; j++) { 183 pte_t *pte; 186 pte_t pte; 187 bool found; 184 188 185 189 /* … … 193 197 194 198 page_table_lock(area->as, false); 195 pte = page_mapping_find(area->as, 196 base + P2SZ(j), false); 197 ASSERT(pte && PTE_VALID(pte) && 198 PTE_PRESENT(pte)); 199 found = page_mapping_find(area->as, 200 base + P2SZ(j), false, &pte); 201 202 ASSERT(found); 203 ASSERT(PTE_VALID(&pte)); 204 ASSERT(PTE_PRESENT(&pte)); 205 199 206 btree_insert(&area->sh_info->pagemap, 200 207 (base + P2SZ(j)) - area->base, 201 (void *) PTE_GET_FRAME( pte), NULL);208 (void *) PTE_GET_FRAME(&pte), NULL); 202 209 page_table_unlock(area->as, false); 203 210 204 pfn_t pfn = ADDR2PFN(PTE_GET_FRAME( pte));211 pfn_t pfn = ADDR2PFN(PTE_GET_FRAME(&pte)); 205 212 frame_reference_add(pfn); 206 213 } … … 274 281 start_anon = entry->p_vaddr + entry->p_filesz; 275 282 276 if (area->sh_info) { 283 mutex_lock(&area->sh_info->lock); 284 if (area->sh_info->shared) { 277 285 bool found = false; 278 286 … … 281 289 */ 282 290 283 mutex_lock(&area->sh_info->lock);284 291 frame = (uintptr_t) btree_search(&area->sh_info->pagemap, 285 292 upage - area->base, &leaf); … … 332 339 dirty = true; 333 340 } else { 334 pte_t *pte = page_mapping_find(AS_KERNEL, 335 base + i * FRAME_SIZE, true); 336 337 ASSERT(pte); 338 ASSERT(PTE_PRESENT(pte)); 339 340 frame = PTE_GET_FRAME(pte); 341 pte_t pte; 342 bool found; 343 344 found = page_mapping_find(AS_KERNEL, 345 base + i * FRAME_SIZE, true, &pte); 346 347 ASSERT(found); 348 ASSERT(PTE_PRESENT(&pte)); 349 350 frame = PTE_GET_FRAME(&pte); 341 351 } 342 352 } else if (upage >= start_anon) { … … 384 394 } 385 395 386 if (dirty && area->sh_info ) {396 if (dirty && area->sh_info->shared) { 387 397 frame_reference_add(ADDR2PFN(frame)); 388 398 btree_insert(&area->sh_info->pagemap, upage - area->base, … … 390 400 } 391 401 392 if (area->sh_info) 393 mutex_unlock(&area->sh_info->lock); 402 mutex_unlock(&area->sh_info->lock); 394 403 395 404 page_mapping_insert(AS, upage, frame, as_area_get_flags(area)); … … 429 438 * data. 430 439 */ 431 frame_free_noreserve(frame );440 frame_free_noreserve(frame, 1); 432 441 } 433 442 } else { … … 437 446 * anonymous). In any case, a frame needs to be freed. 438 447 */ 439 frame_free_noreserve(frame );448 frame_free_noreserve(frame, 1); 440 449 } 441 450 }
Note:
See TracChangeset
for help on using the changeset viewer.