Ejemplo n.º 1
0
static void
init_commands(void)
{
	attr_init();
	bmap_init();
	fadvise_init();
	file_init();
	freeze_init();
	fsync_init();
	getrusage_init();
	help_init();
	imap_init();
	inject_init();
	madvise_init();
	mincore_init();
	mmap_init();
	open_init();
	parent_init();
	pread_init();
	prealloc_init();
	fiemap_init();
	pwrite_init();
	quit_init();
	resblks_init();
	sendfile_init();
	shutdown_init();
	truncate_init();
}
Ejemplo n.º 2
0
void pmem_init() {
    bmap_init(&first_bmap, first_storage, (sizeof(first_storage) * 8));

    first_region.bmap = &first_bmap;
    first_region.start = 0;
    first_region.length = ((first_bmap.bits - (1 /* savety zone */)) * PMEM_PAGESIZE);
    first_region.next = NULL;

    pmem_region_head = &first_region;
    pmem_region_tail = pmem_region_head;

    spl_init(&pmem_lock);

    /* reserve the page at address zero, as most people don't
     * know how to handle it. rm_init() needs to spare this
     * page when reserving real mode memory! */
    pmem_reserve(0, PMEM_PAGESIZE);

    /* from 4K to 0xa0000 (start of kernel memory) for
     * real mode */
    pmem_reserve(PMEM_PAGESIZE, PMEM_PAGESIZE * 158);

    /* reserve the kernel's physical memory, so nobody
     * else tries to use it */
    if(!pmem_reserve(0xA0000, (((size_t)&_core_lma_end) - 0xA0000))) {
        error("failed to protect physical lower and kernel memory\n");
    }

    /* here we are sufficiently initialized, so virtual memory
     * can allocate physical memory for the initial mappings,
     * required to get the kernel heap working. this in turn
     * enables us, to allocate more memory to add additional
     * regions to the physical memory. */
    kheap_init();

    extp_iterate(EXTP_PMEM_REGION, pmem_iterate_extp);

    /* some debugging information */
    pmem_region_t* current = pmem_region_head;
    while(current) {
        trace("pmem: %p - %p (%dKB)\n", current->start, 
            current->start + current->length, current->length / 1024);
        current = current->next;
    }
}