当前位置: 首页>>代码示例>>C++>>正文


C++ page2kva函数代码示例

本文整理汇总了C++中page2kva函数的典型用法代码示例。如果您正苦于以下问题:C++ page2kva函数的具体用法?C++ page2kva怎么用?C++ page2kva使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了page2kva函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: check_page_free_list

//
// Check that the pages on the page_free_list are reasonable.
//
static void
check_page_free_list(bool only_low_memory)
{
	struct Page *pp;
	unsigned pdx_limit = only_low_memory ? 4 : NPDENTRIES;
	int nfree_basemem = 0, nfree_extmem = 0;
	char *first_free_page;

	if (!page_free_list)
		panic("'page_free_list' is a null pointer!");

	// if there's a page that shouldn't be on the free list,
	// try to make sure it eventually causes trouble.
	for (pp = page_free_list; pp; pp = pp->pp_link)
		if (PDX(page2pa(pp)) < pdx_limit)
			memset(page2kva(pp), 0x97, 128);

	first_free_page = (char *) boot_alloc(0);
	for (pp = page_free_list; pp; pp = pp->pp_link) {
		// check that we didn't corrupt the free list itself
		assert(pp >= pages);
		assert(pp < pages + npages);
		assert(((char *) pp - (char *) pages) % sizeof(*pp) == 0);

		// check a few pages that shouldn't be on the free list
		assert(page2pa(pp) != 0);
		assert(page2pa(pp) != IOPHYSMEM);
		assert(page2pa(pp) != EXTPHYSMEM - PGSIZE);
		assert(page2pa(pp) != EXTPHYSMEM);
		assert(page2pa(pp) < EXTPHYSMEM || page2kva(pp) >= first_free_page);

		if (page2pa(pp) < EXTPHYSMEM)
			++nfree_basemem;
		else
			++nfree_extmem;
	}

	assert(nfree_basemem > 0);
	assert(nfree_extmem > 0);
}
开发者ID:aaandrewww,项目名称:authcontrol,代码行数:43,代码来源:pmap.c

示例2: check_page_installed_pgdir

// check page_insert, page_remove, &c, with an installed kern_pgdir
static void
check_page_installed_pgdir(void)
{
    struct PageInfo *pp, *pp0, *pp1, *pp2;
    struct PageInfo *fl;
    pte_t *ptep, *ptep1;
    uintptr_t va;
    int i;

    // check that we can read and write installed pages
    pp1 = pp2 = 0;
    assert((pp0 = page_alloc(0)));
    assert((pp1 = page_alloc(0)));
    assert((pp2 = page_alloc(0)));
    page_free(pp0);
    memset(page2kva(pp1), 1, PGSIZE);
    memset(page2kva(pp2), 2, PGSIZE);
    page_insert(kern_pgdir, pp1, (void*) PGSIZE, PTE_W);
    assert(pp1->pp_ref == 1);
    assert(*(uint32_t *)PGSIZE == 0x01010101U);
    page_insert(kern_pgdir, pp2, (void*) PGSIZE, PTE_W);
    assert(*(uint32_t *)PGSIZE == 0x02020202U);
    assert(pp2->pp_ref == 1);
    assert(pp1->pp_ref == 0);
    *(uint32_t *)PGSIZE = 0x03030303U;
    assert(*(uint32_t *)page2kva(pp2) == 0x03030303U);
    page_remove(kern_pgdir, (void*) PGSIZE);
    assert(pp2->pp_ref == 0);

    // forcibly take pp0 back
    assert(PTE_ADDR(kern_pgdir[0]) == page2pa(pp0));
    kern_pgdir[0] = 0;
    assert(pp0->pp_ref == 1);
    pp0->pp_ref = 0;

    // free the pages we took
    page_free(pp0);

    cprintf("check_page_installed_pgdir() succeeded!\n");
}
开发者ID:eshyong,项目名称:MIT-JOS,代码行数:41,代码来源:pmap.c

示例3: pgdir_alloc_page

/**
 * pgdir_alloc_page - call alloc_page & page_insert functions to 
 *                  - allocate a page size memory & setup an addr map
 *                  - pa<->la with linear address la and the PDT pgdir
 * @param pgdir    page directory
 * @param la       logical address for the page to be allocated
 * @param perm     permission of the page
 * @return         the page descriptor of the allocated
 */
struct Page *
pgdir_alloc_page(pgd_t *pgdir, uintptr_t la, uint32_t perm) {
    struct Page *page = alloc_page();
    if (page != NULL) {
        //zero it!
        memset(page2kva(page), 0, PGSIZE);
        if (page_insert(pgdir, page, la, perm) != 0) {
            free_page(page);
            return NULL;
        }
    }
    return page;
}
开发者ID:chyyuu,项目名称:ucore-arch-arm,代码行数:22,代码来源:pmm.c

示例4: page_alloc

//
// Allocates a physical page.  If (alloc_flags & ALLOC_ZERO), fills the entire
// returned physical page with '\0' bytes.  Does NOT increment the reference
// count of the page - the caller must do these if necessary (either explicitly
// or via page_insert).
//
// Returns NULL if out of free memory.
//
// Hint: use page2kva and memset
struct PageInfo *
page_alloc(int alloc_flags)
{
	// Fill this function in
	// SUNUS, 23, October, 2013
	struct PageInfo *pp = page_free_list;
	if (!pp)
		return NULL;
	page_free_list = page_free_list->pp_link;
	if (alloc_flags & ALLOC_ZERO)
		memset(page2kva(pp), '\0', PGSIZE);
	pp->pp_link = NULL;
	return pp;
}
开发者ID:sunuslee,项目名称:Mit-6.828-Fall-2012,代码行数:23,代码来源:pmap.c

示例5: check_boot_pgdir

static void
check_boot_pgdir(void) {
    pte_t *ptep;
    int i;
    for (i = 0; i < npage; i += PGSIZE) {
        assert((ptep = get_pte(boot_pgdir, (uintptr_t)KADDR(i), 0)) != NULL);
        assert(PTE_ADDR(*ptep) == i);
    }


    assert(PDE_ADDR(boot_pgdir[PDX(VPT)]) == PADDR(boot_pgdir));
    //cprintf("%08x\n",boot_pgdir[PDX(VPT)]);
    //cprintf("%08x\n",PADDR(boot_pgdir));

    assert(boot_pgdir[256] == 0);

    struct Page *p;

    p = alloc_page();

    assert(page_insert(boot_pgdir, p, 0x40000100, PTE_TYPE_SRW) == 0);
    assert(page_ref(p) == 1);
    assert(page_insert(boot_pgdir, p, 0x40000100 + PGSIZE, PTE_TYPE_SRW) == 0);
    assert(page_ref(p) == 2);

    const char *str = "ucore: Hello world!!";

    strcpy((void *)0x40000100, str);
    assert(strcmp((void *)0x40000100, (void *)(0x40000100 + PGSIZE)) == 0);
    cprintf("%s\n\n",(char*)0x40000100);
    //cprintf("mstatus=%08x\n",read_mstatus_field(MSTATUS_PRV));
//    cprintf("bageyalusilasiladi%s\n",((char*)0x40000100));
    *(char *)(page2kva(p) + 0x100) = '\0';
    //asm volatile("nop");
    //asm volatile("nop");
    //cprintf("\0\n");
 //   cprintf("%d\n",strlen((char *)0x40000100));
    assert(strlen((const char *)0x40000100) == 0);
    //assert(((const char *)0x30000100) == '\0');

    //asm volatile("nop");
//    asm volatile("nop");
    free_page(p);
    free_page(pde2page(boot_pgdir[256]));
    //cprintf("haah2\n");

    boot_pgdir[256] = 0;

    cprintf("check_boot_pgdir() succeeded!\n");
}
开发者ID:lhh520,项目名称:os-4-risc-v,代码行数:50,代码来源:pmm.c

示例6: env_setup_vm

//
// Initialize the kernel virtual memory layout for environment e.
// Allocate a page directory, set e->env_pgdir and e->env_cr3 accordingly,
// and initialize the kernel portion of the new environment's address space.
// Do NOT (yet) map anything into the user portion
// of the environment's virtual address space.
//
// Returns 0 on success, < 0 on error.  Errors include:
//	-E_NO_MEM if page directory or table could not be allocated.
//
static int
env_setup_vm(struct Env *e)
{
	int i, r;
	struct Page *p = NULL;

	// Allocate a page for the page directory
	if ((r = page_alloc(&p)) < 0)
		return r;

	//    - Remember that page_alloc doesn't zero the page.
        pde_t *pgdir = page2kva(p);
        memset(pgdir, 0, PGSIZE);
        e->env_pgdir = page2kva(p);
        e->env_cr3 = PADDR(pgdir);
        
	//    - The VA space of all envs is identical above UTOP
	//	(except at VPT and UVPT, which we've set below).
	//	See inc/memlayout.h for permissions and layout.
	//	Can you use boot_pgdir as a template?  Hint: Yes.
	for (i = PDX(UTOP); i < NPDENTRIES; i++)
		e->env_pgdir[i] = boot_pgdir[i];
	//    - The initial VA below UTOP is empty.

        //    - Note: In general, pp_ref is not maintained for
	//	physical pages mapped only above UTOP, but env_pgdir
	//	is an exception -- you need to increment env_pgdir's
	//	pp_ref for env_free to work correctly.
        p->pp_ref++;

	// VPT and UVPT map the env's own page table, with
	// different permissions.
	e->env_pgdir[PDX(VPT)]  = e->env_cr3 | PTE_P | PTE_W;
	e->env_pgdir[PDX(UVPT)] = e->env_cr3 | PTE_P | PTE_U;

	return 0;
}
开发者ID:StonyBrookUniversity,项目名称:jos,代码行数:47,代码来源:env.c

示例7: page_alloc_npages

//
// Allocates n continuous physical page. If (alloc_flags & ALLOC_ZERO), fills the n pages 
// returned physical page with '\0' bytes.  Does NOT increment the reference
// count of the page - the caller must do these if necessary (either explicitly
// or via page_insert). 
//
// In order to figure out the n pages when return it. 
// These n pages should be organized as a list.
//
// Returns NULL if out of free memory.
// Returns NULL if n <= 0
//
// Try to reuse the pages cached in the chuck list
//
// Hint: use page2kva and memset
struct Page *
page_alloc_npages(int alloc_flags, int n)
{
	// Fill this function
	/*stone's solution for lab2*/
	if (n <= 0)
		return NULL;
	size_t i = 0;
	size_t j;
	int flag = 0;
	while (i < npages){
		if (pages[i].pp_ref == 0){
			for (j = 0; j < n && i + j < npages; j++){
				if (pages[i+j].pp_ref != 0)
					break;
			}
			if (j == n) flag = 1;
			else i += j;
		}
		if (flag == 1) break;
		i++;
	}
	if (flag == 0) return NULL;

	struct Page* tmp = page_free_list;
	while (&pages[i+j] > tmp && tmp >= &pages[i])
		tmp = tmp->pp_link;
	page_free_list = tmp;
	struct Page* result = tmp;

	//stone:remove all n pages from page_free_list
	/*for (; tmp != NULL; tmp = tmp->pp_link){
		if (&pages[i+j] > tmp && tmp >= &pages[i]){
			while (&pages[i+j] > tmp->pp_link && tmp->pp_link >= &pages[i])
				tmp = tmp->pp_link;
			result->pp_link = tmp->pp_link;
		}
		result = tmp;
	}*/
	size_t k;
	for (k = 0; k < n - 1; k++){
		pages[k + i].pp_link = &pages[k + 1 + i];
	}
	result = &pages[i];
	
	if (alloc_flags & ALLOC_ZERO)
		memset(page2kva(result), '\0', n*PGSIZE);
	return result;
}
开发者ID:stone-SJH,项目名称:joslabs-byStone,代码行数:64,代码来源:pmap.c

示例8: env_setup_vm

//
// Initializes the kernel virtual memory layout for environment e.
//
// Allocates a page directory and initializes it.  Sets
// e->env_cr3 and e->env_pgdir accordingly.
//
// RETURNS
//   0 -- on sucess
//   <0 -- otherwise 
//
static int
env_setup_vm(struct Env *e)
{
	// Hint:

	int i, r;
	struct Page *p = NULL;

	Pde *pgdir;
	// Allocate a page for the page directory
	if ((r = page_alloc(&p)) < 0)
	{
		panic("env_setup_vm - page_alloc error\n");
			return r;
	}
	p->pp_ref++;
	//printf("env.c:env_setup_vm:page_alloc:p\[email protected]:%x\[email protected]:%x\tcon:%x\n",page2pa(p),(int)&p,(int)p);
//printf("env_setup_vm :	1\n");
	// Hint:
	//    - The VA space of all envs is identical above UTOP
	//      (except at VPT and UVPT) 
	//    - Use boot_pgdir
	//    - Do not make any calls to page_alloc 
	//    - Note: pp_refcnt is not maintained for physical pages mapped above UTOP.
	pgdir = (Pde *)page2kva(p);
//	printf("env.c:env_setup_vm:\tpgdir\t:con:%x\n",(int)pgdir);
	for(i=0;i<UTOP; i+=BY2PG)
		pgdir[PDX(i)] = 0;
	for(i=PDX(UTOP); i<1024;i++)
	{
//printf("boot_pgdir[%d] = %x\n",i,boot_pgdir[PDX(i)]);
		pgdir[i] = boot_pgdir[i];
	}
//printf("env_setup_vm :	2\n");

	e->env_pgdir = pgdir;
//printf("env_setup_vm :	3\n");
	// ...except at VPT and UVPT.  These map the env's own page table

	//e->env_pgdir[PDX(UVPT)]  = e->env_cr3 | PTE_P | PTE_U;

	e->env_cr3 = PADDR(pgdir);

	boot_map_segment(e->env_pgdir,UVPT,PDMAP,PADDR(pgdir),PTE_R);
//	printf("env.c:env_setup_vm:\tboot_map_segment(%x,%x,%x,%x,PTE_R)\n",e->env_pgdir,UVPT,PDMAP,PADDR(pgdir));
	e->env_pgdir[PDX(UVPT)]  = e->env_cr3 | PTE_V | PTE_R;
//printf("env_setup_vm :  4\n");
	return 0;
}
开发者ID:fmars,项目名称:MIPS_OS_Kernel,代码行数:59,代码来源:env.c

示例9: sys_page_alloc

// Allocate a page of memory and map it at 'va' with permission
// 'perm' in the address space of 'envid'.
// The page's contents are set to 0.
// If a page is already mapped at 'va', that page is unmapped as a
// side effect.
//
// perm -- PTE_U | PTE_P must be set, PTE_AVAIL | PTE_W may or may not be set,
//         but no other bits may be set.  See PTE_USER in inc/mmu.h.
//
// Return 0 on success, < 0 on error.  Errors are:
//	-E_BAD_ENV if environment envid doesn't currently exist,
//		or the caller doesn't have permission to change envid.
//	-E_INVAL if va >= UTOP, or va is not page-aligned.
//	-E_INVAL if perm is inappropriate (see above).
//	-E_NO_MEM if there's no memory to allocate the new page,
//		or to allocate any necessary page tables.
static int
sys_page_alloc(envid_t envid, void *va, int perm)
{
	// Hint: This function is a wrapper around page_alloc() and
	//   page_insert() from kern/pmap.c.
	//   Most of the new code you write should be to check the
	//   parameters for correctness.
	//   If page_insert() fails, remember to free the page you
	//   allocated!

	// LAB 4: Your code here.
	struct Env *env = NULL;
	struct Page *pp = NULL;
	int allowed_perm = 0;
	
	// Check envid and get env
	if (envid2env(envid, &env, 1) != 0){
		return -E_BAD_ENV;
	}

	// Check va
	if ((uint32_t)va >= UTOP || (uint32_t)va % PGSIZE != 0){
		return -E_INVAL;
	}

	// Check perm
	allowed_perm = PTE_U | PTE_P;
	if ((perm & allowed_perm) != allowed_perm){
	}
	allowed_perm |= PTE_W | PTE_AVAIL;
	// Check if there are other permissions
	if ((perm ^ (perm & allowed_perm)) != 0){
		return -E_INVAL;
	}
	if (page_alloc(&pp) < 0){
		return -E_NO_MEM;
	}
	// cprintf("***************** alloc page no.%d\n", page2ppn(pp));
	// insert into the page table of env
	if (page_insert(env->env_pgdir, pp, va, perm | PTE_P) != 0){
		page_free(pp);
		return -E_NO_MEM;
	}
	memset(page2kva(pp), 0, PGSIZE);

	return 0;
	// panic("sys_page_alloc not implemented");
}
开发者ID:ChenLanbo,项目名称:OS-Lab,代码行数:64,代码来源:syscall.c

示例10: sys_page_alloc

// Allocate a page of memory and map it at 'va' with permission
// 'perm' in the address space of 'envid'.
// The page's contents are set to 0.
// If a page is already mapped at 'va', that page is unmapped as a
// side effect.
//
// perm -- PTE_U | PTE_P must be set, PTE_AVAIL | PTE_W may or may not be set,
//         but no other bits may be set.
//
// Return 0 on success, < 0 on error.  Errors are:
//	-E_BAD_ENV if environment envid doesn't currently exist,
//		or the caller doesn't have permission to change envid.
//	-E_INVAL if va >= UTOP, or va is not page-aligned.
//	-E_INVAL if perm is inappropriate (see above).
//	-E_NO_MEM if there's no memory to allocate the new page,
//		or to allocate any necessary page tables.
static int
sys_page_alloc(envid_t envid, void *va, int perm)
{
	// Hint: This function is a wrapper around page_alloc() and
	//   page_insert() from kern/pmap.c.
	//   Most of the new code you write should be to check the
	//   parameters for correctness.
	//   If page_insert() fails, remember to free the page you
	//   allocated!

	// LAB 4: Your code here.
	struct Env *env;

	if(envid2env(envid, &env, 1) == -E_BAD_ENV)
	{
		//cprintf("bad environment envid in sys page alloc:%08x\n",envid);
		return -E_BAD_ENV;
	}
	else if((uintptr_t)va >= UTOP || (uint32_t)va % PGSIZE)
	       return -E_INVAL;
	else if((perm & PTE_U) && (perm & PTE_P))
	{
		if(perm & ((~(PTE_U|PTE_P|PTE_W|PTE_AVAIL) & 0xfff)))
			return -E_INVAL;		
	}
	if((vpd[PDX(va)] & PTE_P) && (vpt[VPN(va)] & PTE_P))
		page_remove(env->env_pgdir,va);

	//cprintf("env id:%08x\n",env->env_id);	
	struct Page * page;
	if(page_alloc(&page) == -E_NO_MEM)
		return -E_NO_MEM;
	//cprintf("page alloc kva:%08x\n",page2kva(page));
	// At this time, we use the page table of the kernel
	// so we clear the phsical page according to the kernel virtual address 
	memset(page2kva(page),0x0,PGSIZE);
	//cprintf("page insert,env_id:%08x,env_pgdir:%08x,page:%08x,va:%08x\n",
	//		env->env_id,env->env_pgdir,page,va);
	if(page_insert(env -> env_pgdir, page, va, perm) != 0)
	{
		page_free(page);
		return -E_NO_MEM;
	}
	//cprintf("page insert success\n");
	
	return 0;
	//panic("sys_page_alloc not implemented");
}
开发者ID:gzs715,项目名称:JOS,代码行数:64,代码来源:syscall.c

示例11: page_alloc

//
// Allocates a physical page.  If (alloc_flags & ALLOC_ZERO), fills the entire
// returned physical page with '\0' bytes.  Does NOT increment the reference
// count of the page - the caller must do these if necessary (either explicitly
// or via page_insert).
//
// Be sure to set the pp_link field of the allocated page to NULL so
// page_free can check for double-free bugs.
//
// Returns NULL if out of free memory.
//
// Hint: use page2kva and memset
struct PageInfo *
page_alloc(int alloc_flags)
{		// Fill this function in

	struct PageInfo *ppt=page_free_list;
	if (ppt ==0){
	//cprintf(" page_alloc returning null\n");
		return NULL;
	}
	page_free_list=ppt->pp_link;	
	ppt->pp_link=NULL;
	if(alloc_flags & ALLOC_ZERO){
		memset(page2kva(ppt),'\0',PGSIZE);
	}
	return ppt;
}
开发者ID:prasadv90,项目名称:AdvOS,代码行数:28,代码来源:pmap.c

示例12: pgdir_walk

// Given 'pgdir', a pointer to a page directory, pgdir_walk returns
// a pointer to the page table entry (PTE) for linear address 'va'.
// This requires walking the two-level page table structure.
//
// The relevant page table page might not exist yet.
// If this is true, and create == false, then pgdir_walk returns NULL.
// Otherwise, pgdir_walk allocates a new page table page with page_alloc. 
//    - If the allocation fails, pgdir_walk returns NULL.
//    - Otherwise, the new page's reference count is incremented,
//	the page is cleared,
//	and pgdir_walk returns a pointer into the new page table page.
//
// Hint 1: you can turn a Page * into the physical address of the
// page it refers to with page2pa() from kern/pmap.h.
//
// Hint 2: the x86 MMU checks permission bits in both the page directory
// and the page table, so it's safe to leave permissions in the page
// directory more permissive than strictly necessary.
//
// Hint 3: look at inc/mmu.h for useful macros that mainipulate page
// table and page directory entries.
//
pte_t *
pgdir_walk(pde_t *pgdir, const void *va, int create)
{
	// Fill this function in
    pde_t* pd = pgdir + (unsigned int) PDX(va);
    //PTE_ADDR used for both pte and pde
    if (*pd & PTE_P)
            return (pte_t*) KADDR(PTE_ADDR(*pd)) + (unsigned)PTX(va);
    // if page doesn't exist
    if (create == 0) return NULL;
    struct PageInfo* newpt = page_alloc(1);
    if (newpt == NULL) return NULL;
    newpt -> pp_ref = 1;
    *pd = page2pa(newpt) | PTE_P | PTE_U | PTE_W;
    return (pte_t*)page2kva(newpt) + (unsigned) PTX(va);
}
开发者ID:DoraXingyu,项目名称:JosLab_2015,代码行数:38,代码来源:pmap.c

示例13: page_alloc

//
// Allocates a physical page.  If (alloc_flags & ALLOC_ZERO), fills the entire
// returned physical page with '\0' bytes.  Does NOT increment the reference
// count of the page - the caller must do these if necessary (either explicitly
// or via page_insert).
//
// Returns NULL if out of free memory.
//
// Hint: use page2kva and memset
struct Page *
page_alloc(int alloc_flags)
{
	struct Page* allocPage;
	if(page_free_list==NULL)
		return NULL;
	allocPage=page_free_list;
	page_free_list=page_free_list->pp_link;
	allocPage->pp_link=NULL;
	if(alloc_flags&&ALLOC_ZERO)
	{
		void* kvirAddr=page2kva(allocPage);
		memset(kvirAddr,0,PGSIZE);
	}
	return allocPage;
}
开发者ID:yuki252111,项目名称:os,代码行数:25,代码来源:pmap.c

示例14: page_alloc

//
// Allocates a physical page.  If (alloc_flags & ALLOC_ZERO), fills the entire
// returned physical page with '\0' bytes.  Does NOT increment the reference
// count of the page - the caller must do these if necessary (either explicitly
// or via page_insert).
//
// Returns NULL if out of free memory.
//
// Hint: use page2kva and memset
struct Page *
page_alloc(int alloc_flags)
{
	// Fill this function in
	/*stone's solution for lab2*/
	struct Page* alloc_page;
	if (page_free_list != NULL){
		alloc_page = page_free_list;
		page_free_list = page_free_list->pp_link;
		alloc_page->pp_link = NULL;
		if (alloc_flags & ALLOC_ZERO)
			memset(page2kva(alloc_page), '\0', PGSIZE);
		return alloc_page;
	}
	return NULL;
}
开发者ID:stone-SJH,项目名称:joslabs-byStone,代码行数:25,代码来源:pmap.c

示例15: page_alloc

//
// Allocates a physical page.  If (alloc_flags & ALLOC_ZERO), fills the entire
// returned physical page with '\0' bytes.  Does NOT increment the reference
// count of the page - the caller must do these if necessary (either explicitly
// or via page_insert).
//
// Be sure to set the pp_link field of the allocated page to NULL so
// page_free can check for double-free bugs.
//
// Returns NULL if out of free memory.
//
// Hint: use page2kva and memset
struct PageInfo *
page_alloc(int alloc_flags)
{
	if(!page_free_list)	
		return NULL;

	struct PageInfo *ret = page_free_list;
	page_free_list = page_free_list->pp_link;

	ret->pp_link = NULL;
	assert(ret->pp_ref == 0);
	if(alloc_flags & ALLOC_ZERO){
		memset(page2kva(ret), '\0', PGSIZE);
	}

	return ret;
}
开发者ID:DeepinDream,项目名称:6.828-MIT-OS,代码行数:29,代码来源:pmap.c


注:本文中的page2kva函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。