Subversion Repositories HelenOS

Rev

Rev 1851 | Rev 1890 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1851 Rev 1889
Line 357... Line 357...
357
                     */
357
                     */
358
       
358
       
359
                    cond = false;   /* we are almost done */
359
                    cond = false;   /* we are almost done */
360
                    i = (start_free - b) >> PAGE_WIDTH;
360
                    i = (start_free - b) >> PAGE_WIDTH;
361
                    if (!used_space_remove(area, start_free, c - i))
361
                    if (!used_space_remove(area, start_free, c - i))
362
                        panic("Could not remove used space.");
362
                        panic("Could not remove used space.\n");
363
                } else {
363
                } else {
364
                    /*
364
                    /*
365
                     * The interval of used space can be completely removed.
365
                     * The interval of used space can be completely removed.
366
                     */
366
                     */
367
                    if (!used_space_remove(area, b, c))
367
                    if (!used_space_remove(area, b, c))
Line 387... Line 387...
387
        /*
387
        /*
388
         * Finish TLB shootdown sequence.
388
         * Finish TLB shootdown sequence.
389
         */
389
         */
390
        tlb_invalidate_pages(AS->asid, area->base + pages*PAGE_SIZE, area->pages - pages);
390
        tlb_invalidate_pages(AS->asid, area->base + pages*PAGE_SIZE, area->pages - pages);
391
        tlb_shootdown_finalize();
391
        tlb_shootdown_finalize();
-
 
392
       
-
 
393
        /*
-
 
394
         * Invalidate software translation caches (e.g. TSB on sparc64).
-
 
395
         */
-
 
396
        as_invalidate_translation_cache(as, area->base + pages*PAGE_SIZE, area->pages - pages);
392
    } else {
397
    } else {
393
        /*
398
        /*
394
         * Growing the area.
399
         * Growing the area.
395
         * Check for overlaps with other address space areas.
400
         * Check for overlaps with other address space areas.
396
         */
401
         */
Line 438... Line 443...
438
    base = area->base;
443
    base = area->base;
439
 
444
 
440
    /*
445
    /*
441
     * Start TLB shootdown sequence.
446
     * Start TLB shootdown sequence.
442
     */
447
     */
443
    tlb_shootdown_start(TLB_INVL_PAGES, AS->asid, area->base, area->pages);
448
    tlb_shootdown_start(TLB_INVL_PAGES, as->asid, area->base, area->pages);
444
 
449
 
445
    /*
450
    /*
446
     * Visit only the pages mapped by used_space B+tree.
451
     * Visit only the pages mapped by used_space B+tree.
447
     */
452
     */
448
    for (cur = area->used_space.leaf_head.next; cur != &area->used_space.leaf_head; cur = cur->next) {
453
    for (cur = area->used_space.leaf_head.next; cur != &area->used_space.leaf_head; cur = cur->next) {
Line 461... Line 466...
461
                ASSERT(pte && PTE_VALID(pte) && PTE_PRESENT(pte));
466
                ASSERT(pte && PTE_VALID(pte) && PTE_PRESENT(pte));
462
                if (area->backend && area->backend->frame_free) {
467
                if (area->backend && area->backend->frame_free) {
463
                    area->backend->frame_free(area,
468
                    area->backend->frame_free(area,
464
                        b + j*PAGE_SIZE, PTE_GET_FRAME(pte));
469
                        b + j*PAGE_SIZE, PTE_GET_FRAME(pte));
465
                }
470
                }
466
                page_mapping_remove(as, b + j*PAGE_SIZE);
471
                page_mapping_remove(as, b + j*PAGE_SIZE);              
467
                page_table_unlock(as, false);
472
                page_table_unlock(as, false);
468
            }
473
            }
469
        }
474
        }
470
    }
475
    }
471
 
476
 
472
    /*
477
    /*
473
     * Finish TLB shootdown sequence.
478
     * Finish TLB shootdown sequence.
474
     */
479
     */
475
    tlb_invalidate_pages(AS->asid, area->base, area->pages);
480
    tlb_invalidate_pages(as->asid, area->base, area->pages);
476
    tlb_shootdown_finalize();
481
    tlb_shootdown_finalize();
477
   
482
   
-
 
483
    /*
-
 
484
     * Invalidate potential software translation caches (e.g. TSB on sparc64).
-
 
485
     */
-
 
486
    as_invalidate_translation_cache(as, area->base, area->pages);
-
 
487
   
478
    btree_destroy(&area->used_space);
488
    btree_destroy(&area->used_space);
479
 
489
 
480
    area->attributes |= AS_AREA_ATTR_PARTIAL;
490
    area->attributes |= AS_AREA_ATTR_PARTIAL;
481
   
491
   
482
    if (area->sh_info)
492
    if (area->sh_info)
Line 485... Line 495...
485
    mutex_unlock(&area->lock);
495
    mutex_unlock(&area->lock);
486
 
496
 
487
    /*
497
    /*
488
     * Remove the empty area from address space.
498
     * Remove the empty area from address space.
489
     */
499
     */
490
    btree_remove(&AS->as_area_btree, base, NULL);
500
    btree_remove(&as->as_area_btree, base, NULL);
491
   
501
   
492
    free(area);
502
    free(area);
493
   
503
   
494
    mutex_unlock(&AS->lock);
504
    mutex_unlock(&as->lock);
495
    interrupts_restore(ipl);
505
    interrupts_restore(ipl);
496
    return 0;
506
    return 0;
497
}
507
}
498
 
508
 
499
/** Share address space area with another or the same address space.
509
/** Share address space area with another or the same address space.