Exemplo n.º 1
0
static int __dune_vm_clone_helper(const void *arg, ptent_t *pte, void *va)
{
       int ret;
       struct page *pg = dune_pa2page(PTE_ADDR(*pte));
       ptent_t *newRoot = (ptent_t *)arg;
       ptent_t *newPte;

       ret = dune_vm_lookup(newRoot, va, CREATE_NORMAL, &newPte);
       if (ret < 0)
               return ret;

       if (dune_page_isfrompool(PTE_ADDR(*pte)))
               dune_page_get(pg);
       *newPte = *pte;

       return 0;
}
Exemplo n.º 2
0
Arquivo: page.c Projeto: jyizheng/dune
struct page * dune_page_alloc(void)
{
	struct page *pg;

	pthread_mutex_lock(&page_mutex);
	if (SLIST_EMPTY(&pages_free)) {
		if (grow_size()) {
			pthread_mutex_unlock(&page_mutex);
			return NULL;
		}
	}

	pg = SLIST_FIRST(&pages_free);
	SLIST_REMOVE_HEAD(&pages_free, link);
	pthread_mutex_unlock(&page_mutex);

	dune_page_get(pg);

	return pg;
}