Subversion Repositories HelenOS

Rev

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

Rev 3707 Rev 3790
Line 144... Line 144...
144
    as_slab = slab_cache_create("as_slab", sizeof(as_t), 0,
144
    as_slab = slab_cache_create("as_slab", sizeof(as_t), 0,
145
        as_constructor, as_destructor, SLAB_CACHE_MAGDEFERRED);
145
        as_constructor, as_destructor, SLAB_CACHE_MAGDEFERRED);
146
   
146
   
147
    AS_KERNEL = as_create(FLAG_AS_KERNEL);
147
    AS_KERNEL = as_create(FLAG_AS_KERNEL);
148
    if (!AS_KERNEL)
148
    if (!AS_KERNEL)
149
        panic("Cannot create kernel address space\n");
149
        panic("Cannot create kernel address space.");
150
   
150
   
151
    /* Make sure the kernel address space
151
    /* Make sure the kernel address space
152
     * reference count never drops to zero.
152
     * reference count never drops to zero.
153
     */
153
     */
154
    atomic_set(&AS_KERNEL->refcount, 1);
154
    atomic_set(&AS_KERNEL->refcount, 1);
Line 442... Line 442...
442
       
442
       
443
                    cond = false;   /* we are almost done */
443
                    cond = false;   /* we are almost done */
444
                    i = (start_free - b) >> PAGE_WIDTH;
444
                    i = (start_free - b) >> PAGE_WIDTH;
445
                    if (!used_space_remove(area, start_free,
445
                    if (!used_space_remove(area, start_free,
446
                        c - i))
446
                        c - i))
447
                        panic("Could not remove used "
447
                        panic("Cannot remove used "
448
                            "space.\n");
448
                            "space.");
449
                } else {
449
                } else {
450
                    /*
450
                    /*
451
                     * The interval of used space can be
451
                     * The interval of used space can be
452
                     * completely removed.
452
                     * completely removed.
453
                     */
453
                     */
454
                    if (!used_space_remove(area, b, c))
454
                    if (!used_space_remove(area, b, c))
455
                        panic("Could not remove used "
455
                        panic("Cannot remove used "
456
                            "space.\n");
456
                            "space.");
457
                }
457
                }
458
           
458
           
459
                for (; i < c; i++) {
459
                for (; i < c; i++) {
460
                    pte_t *pte;
460
                    pte_t *pte;
461
           
461
           
Line 1664... Line 1664...
1664
            }
1664
            }
1665
        }
1665
        }
1666
    }
1666
    }
1667
 
1667
 
1668
    panic("Inconsistency detected while adding %" PRIc " pages of used "
1668
    panic("Inconsistency detected while adding %" PRIc " pages of used "
1669
        "space at %p.\n", count, page);
1669
        "space at %p.", count, page);
1670
}
1670
}
1671
 
1671
 
1672
/** Mark portion of address space area as unused.
1672
/** Mark portion of address space area as unused.
1673
 *
1673
 *
1674
 * The address space area must be already locked.
1674
 * The address space area must be already locked.
Line 1843... Line 1843...
1843
        }
1843
        }
1844
    }
1844
    }
1845
 
1845
 
1846
error:
1846
error:
1847
    panic("Inconsistency detected while removing %" PRIc " pages of used "
1847
    panic("Inconsistency detected while removing %" PRIc " pages of used "
1848
        "space from %p.\n", count, page);
1848
        "space from %p.", count, page);
1849
}
1849
}
1850
 
1850
 
1851
/** Remove reference to address space area share info.
1851
/** Remove reference to address space area share info.
1852
 *
1852
 *
1853
 * If the reference count drops to 0, the sh_info is deallocated.
1853
 * If the reference count drops to 0, the sh_info is deallocated.