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


C++ pmd_bad函数代码示例

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


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

示例1: m4u_v2p_new

int m4u_v2p_new(unsigned int va)
{
   unsigned int pmdOffset = (va & (PMD_SIZE - 1));
   unsigned int pageOffset = (va & (PAGE_SIZE - 1));
   pgd_t *pgd;
   pmd_t *pmd;
   pte_t *pte;
   unsigned int pa;
   printk("Enter m4u_user_v2p()! 0x%x\n", va);
   
   pgd = pgd_offset(current->mm, va); /* what is tsk->mm */
   printk("m4u_user_v2p(), pgd 0x%x\n", pgd);    
   printk("pgd_none=%d, pgd_bad=%d\n", pgd_none(*pgd), pgd_bad(*pgd));
   
   if(pgd_none(*pgd)||pgd_bad(*pgd))
   {
      printk("Error: m4u_user_v2p(), virtual addr 0x%x, pgd invalid! \n", va);
      return 0;
   }
   
   pmd = pmd_offset(pgd, va);
   printk("m4u_user_v2p(), pmd 0x%x\n", pmd);
   printk("pmd_none=%d, pmd_bad=%d, pmd_val=0x%x\n", pmd_none(*pmd), pmd_bad(*pmd), pmd_val(*pmd));
   
   
   /* If this is a page table entry, keep on walking to the next level */ 
   if (( (unsigned int)pmd_val(*pmd) & PMD_TYPE_MASK) == PMD_TYPE_TABLE)
   {
      if(pmd_none(*pmd)||pmd_bad(*pmd))
      {
         printk("Error: m4u_user_v2p(), virtual addr 0x%x, pmd invalid! \n", va);
         return 0;
      }
      
      pte = pte_offset_map(pmd, va);
      printk("m4u_user_v2p(), pte 0x%x\n", pte);
      if(pte_present(*pte)) 
      { 
         pa=(pte_val(*pte) & (PAGE_MASK)) | pageOffset; 
         printk("PA = 0x%8x\n", pa);
         return pa; 
      }
   }
   else /* Only 1 level page table */
   {
      if(pmd_none(*pmd))
      {
         printk("Error: m4u_user_v2p(), virtual addr 0x%x, pmd invalid! \n", va);
         return 0;
      }
      pa=(pte_val(*pmd) & (PMD_MASK)) | pmdOffset; 
      printk("PA = 0x%8x\n", pa);
      return pa;

   }
   
   return 0;   
}
开发者ID:SelfImp,项目名称:m75,代码行数:58,代码来源:vdec.c

示例2: partial_clear

/*
 * This function zeroes out partial mmap'ed pages at truncation time..
 */
static void partial_clear(struct vm_area_struct *vma, unsigned long address)
{
	pgd_t *page_dir;
	pmd_t *page_middle;
	pte_t *page_table, pte;

	page_dir = pgd_offset(vma->vm_mm, address);
	if (pgd_none(*page_dir))
		return;
	if (pgd_bad(*page_dir)) {
		printk("bad page table directory entry %p:[%lx]\n", page_dir, pgd_val(*page_dir));
		pgd_clear(page_dir);
		return;
	}
	page_middle = pmd_offset(page_dir, address);
	if (pmd_none(*page_middle))
		return;
	if (pmd_bad(*page_middle)) {
		printk("bad page table directory entry %p:[%lx]\n", page_dir, pgd_val(*page_dir));
		pmd_clear(page_middle);
		return;
	}
	page_table = pte_offset(page_middle, address);
	pte = *page_table;
	if (!pte_present(pte))
		return;
	flush_cache_page(vma, address);
	address &= ~PAGE_MASK;
	address += pte_page(pte);
	if (address >= high_memory)
		return;
	memset((void *) address, 0, PAGE_SIZE - (address & ~PAGE_MASK));
	flush_page_to_ram(pte_page(pte));
}
开发者ID:shattered,项目名称:linux-m68k,代码行数:37,代码来源:memory.c

示例3: zap_pte_range

static inline void zap_pte_range(pmd_t * pmd, unsigned long address, unsigned long size)
{
	pte_t * pte;

	if (pmd_none(*pmd))
		return;
	if (pmd_bad(*pmd)) {
		printk("zap_pte_range: bad pmd (%08lx)\n", pmd_val(*pmd));
		pmd_clear(pmd);
		return;
	}
	pte = pte_offset(pmd, address);
	address &= ~PMD_MASK;
	if (address + size > PMD_SIZE)
		size = PMD_SIZE - address;
	size >>= PAGE_SHIFT;
	for (;;) {
		pte_t page;
		if (!size)
			break;
		page = *pte;
		pte++;
		size--;
		if (pte_none(page))
			continue;
		pte_clear(pte-1);
		free_pte(page);
	}
}
开发者ID:shattered,项目名称:linux-m68k,代码行数:29,代码来源:memory.c

示例4: remove_mapping_pte_range

static inline void
remove_mapping_pte_range (pmd_t *pmd, unsigned long address, unsigned long size)
{
	pte_t *pte;
	unsigned long end;

	if (pmd_none (*pmd))
		return;
	if (pmd_bad (*pmd)){
		printk ("remove_graphics_pte_range: bad pmd (%08lx)\n", pmd_val (*pmd));
		pmd_clear (pmd);
		return;
	}
	pte = pte_offset (pmd, address);
	address &= ~PMD_MASK;
	end = address + size;
	if (end > PMD_SIZE)
		end = PMD_SIZE;
	do {
		pte_t entry = *pte;
		if (pte_present (entry))
			set_pte (pte, pte_modify (entry, PAGE_NONE));
		address += PAGE_SIZE;
		pte++;
	} while (address < end);
						  
}
开发者ID:dmgerman,项目名称:linux-pre-history,代码行数:27,代码来源:umap.c

示例5: fault_is_priv

/*
 * fault_is_priv()
 *	Return true if the fault is a privilege violation.
 */
STATIC int fault_is_priv(struct pt_regs *regs,
			 unsigned long missqw0, 
			 unsigned long missqw1)
{
	pgd_t *pgd;
	pmd_t *pmd;
	pte_t *ptep;
	unsigned long address;

	/*
	 * Check if this is user or kernel in pt_regs/CSR.
	 */
	pgd = (pgd_t *)(MMU_MISSQW0_PGD_GET(missqw0) << MMU_MISSQW0_PGD_SHIFT);
	address =  (unsigned long)(MMU_MISSQW1_VPN_GET(missqw1) << MMU_VPN_SHIFT);
	pmd = (pmd_t *)__pgd_offset(pgd, address);
	if (unlikely(pmd_none(*pmd)) || (unlikely(pmd_bad(*pmd)))) {
		return 0;
	}

	ptep = pte_offset_map(pmd, address);
	if (unlikely(pte_none(*ptep)) || (unlikely(pte_bad(*ptep)))) {
		return 0;
	}

	/*
	 * If the PTE is a supervisory PTE and we are in user_mode()
	 * declare this as a privilege violation.
	 */
	if (user_mode(regs) && ((pte_val(*ptep) & L_PTE_USER) == 0)) {
		return 1;
	}
	return 0;
}
开发者ID:kizukukoto,项目名称:WDN900_GPL,代码行数:37,代码来源:fault.c

示例6: imm_get_physical

u32
imm_get_physical(void *v, u32 immid)
{
	pmd_t *pmd;
	pte_t *pte;
	pgd_t *pgd;
	u32 val = 0, virtual = (u32)v;
	struct mm_struct* mm;

	if (IMMID_USER(immid))
		mm = current->mm;
	else
		mm = &init_mm;

	pgd = pgd_offset(mm, virtual);
	if (!pgd_none(*pgd) && !pgd_bad(*pgd)) {
		/* 1st level entry pointer */
		pmd = pmd_offset(pgd, virtual);
		if (!pmd_none(*pmd) && !pmd_bad(*pmd)) {
			/* 2nd level entry pointer */
			pte = pte_offset_kernel(pmd, virtual);
			if (pte) {
				val = (*(u32 *)((u32)pte-2048))&PAGE_MASK;
				val += virtual%PAGE_SIZE;
			}
		} else if (!pmd_none(*pmd)) {
开发者ID:12019,项目名称:kernel_zte_u880,代码行数:26,代码来源:policy.c

示例7: zap_pte_range

static inline int zap_pte_range(struct mm_struct *mm, pmd_t * pmd, unsigned long address, unsigned long size)
{
	pte_t * pte;
	int freed;

	if (pmd_none(*pmd))
		return 0;
	if (pmd_bad(*pmd)) {
		pmd_ERROR(*pmd);
		pmd_clear(pmd);
		return 0;
	}
	pte = pte_offset(pmd, address);
	address &= ~PMD_MASK;
	if (address + size > PMD_SIZE)
		size = PMD_SIZE - address;
	size >>= PAGE_SHIFT;
	freed = 0;
	for (;;) {
		pte_t page;
		if (!size)
			break;
		page = ptep_get_and_clear(pte);
		pte++;
		size--;
		if (pte_none(page))
			continue;
		freed += free_pte(page);
	}
	return freed;
}
开发者ID:davidbau,项目名称:davej,代码行数:31,代码来源:memory.c

示例8: my_follow_page

static struct page* my_follow_page(struct vm_area_struct *vma, unsigned long addr) {
	pud_t *pud = NULL;
	pmd_t *pmd = NULL;
	pgd_t *pgd = NULL;
	pte_t *pte = NULL;
	spinlock_t *ptl = NULL;
	struct page* page = NULL;
	struct mm_struct *mm = current->mm;
	pgd = pgd_offset(current->mm, addr);
	if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd))) {
		goto out;
	}
	pud = pud_offset(pgd, addr);
	if (pud_none(*pud) || unlikely(pud_bad(*pud))) {
		goto out;
	}
	printk("aaaa\n");
	pmd = pmd_offset(pud, addr);
	if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd))) {
		goto out;
	}
	pte = pte_offset_map_lock(current->mm, pmd, addr, &ptl);
	printk("bbbb\n");
	if (!pte) goto out;
	printk("cccc\n");
	if (!pte_present(*pte)) goto unlock;
	page = pfn_to_page(pte_pfn(*pte));
	if (!page) goto unlock;
	get_page(page);
unlock:
	pte_unmap_unlock(pte, ptl);
out:
	return page;
}
开发者ID:gowithqi,项目名称:linux_kernel_mm,代码行数:34,代码来源:zzq_vm.c

示例9: filemap_sync_pte_range

static int filemap_sync_pte_range(pmd_t * pmd,
	unsigned long address, unsigned long end, 
	struct vm_area_struct *vma, unsigned int flags)
{
	pte_t *pte;
	int error;

	if (pmd_none(*pmd))
		return 0;
	if (pmd_bad(*pmd)) {
		pmd_ERROR(*pmd);
		pmd_clear(pmd);
		return 0;
	}
	pte = pte_offset_map(pmd, address);
	if ((address & PMD_MASK) != (end & PMD_MASK))
		end = (address & PMD_MASK) + PMD_SIZE;
	error = 0;
	do {
		error |= filemap_sync_pte(pte, vma, address, flags);
		address += PAGE_SIZE;
		pte++;
	} while (address && (address < end));

	pte_unmap(pte - 1);

	return error;
}
开发者ID:BackupTheBerlios,项目名称:tuxap,代码行数:28,代码来源:msync.c

示例10: show_pte

/*
 * Dump out the page tables associated with 'addr' in mm 'mm'.
 */
void show_pte(struct mm_struct *mm, unsigned long addr)
{
    pgd_t *pgd;

    if (!mm)
        mm = &init_mm;

    pr_alert("pgd = %p\n", mm->pgd);
    pgd = pgd_offset(mm, addr);
    pr_alert("[%08lx] *pgd=%016llx", addr, pgd_val(*pgd));

    do {
        pud_t *pud;
        pmd_t *pmd;
        pte_t *pte;

        if (pgd_none(*pgd) || pgd_bad(*pgd))
            break;

        pud = pud_offset(pgd, addr);
        if (pud_none(*pud) || pud_bad(*pud))
            break;

        pmd = pmd_offset(pud, addr);
        printk(", *pmd=%016llx", pmd_val(*pmd));
        if (pmd_none(*pmd) || pmd_bad(*pmd))
            break;

        pte = pte_offset_map(pmd, addr);
        printk(", *pte=%016llx", pte_val(*pte));
        pte_unmap(pte);
    } while(0);

    printk("\n");
}
开发者ID:pranav01,项目名称:android_kernel_cyanogen_msm8916,代码行数:38,代码来源:fault.c

示例11: get_phys_addr

static unsigned long get_phys_addr(struct task_struct * p, unsigned long ptr)
{
    pgd_t *page_dir;
    pmd_t *page_middle;
    pte_t pte;

    if (!p || !p->mm || ptr >= TASK_SIZE)
        return 0;
    page_dir = pgd_offset(p->mm,ptr);
    if (pgd_none(*page_dir))
        return 0;
    if (pgd_bad(*page_dir)) {
        printk("bad page directory entry %08lx\n", pgd_val(*page_dir));
        pgd_clear(page_dir);
        return 0;
    }
    page_middle = pmd_offset(page_dir,ptr);
    if (pmd_none(*page_middle))
        return 0;
    if (pmd_bad(*page_middle)) {
        printk("bad page middle entry %08lx\n", pmd_val(*page_middle));
        pmd_clear(page_middle);
        return 0;
    }
    pte = *pte_offset(page_middle,ptr);
    if (!pte_present(pte))
        return 0;
    return pte_page(pte) + (ptr & ~PAGE_MASK);
}
开发者ID:liexusong,项目名称:linux2.0-comment,代码行数:29,代码来源:array.c

示例12: alloc_init_pte

static void alloc_init_pte(pmd_t *pmd, unsigned long addr,
				  unsigned long end, unsigned long pfn,
				  pgprot_t prot,
				  phys_addr_t (*pgtable_alloc)(void))
{
	pte_t *pte;

	if (pmd_none(*pmd) || pmd_sect(*pmd)) {
		phys_addr_t pte_phys;
		BUG_ON(!pgtable_alloc);
		pte_phys = pgtable_alloc();
		pte = pte_set_fixmap(pte_phys);
		if (pmd_sect(*pmd))
			split_pmd(pmd, pte);
		__pmd_populate(pmd, pte_phys, PMD_TYPE_TABLE);
		flush_tlb_all();
		pte_clear_fixmap();
	}
	BUG_ON(pmd_bad(*pmd));

	pte = pte_set_fixmap_offset(pmd, addr);
	do {
		set_pte(pte, pfn_pte(pfn, prot));
		pfn++;
	} while (pte++, addr += PAGE_SIZE, addr != end);

	pte_clear_fixmap();
}
开发者ID:1314cc,项目名称:linux,代码行数:28,代码来源:mmu.c

示例13: unuse_pmd

static inline int unuse_pmd(struct vm_area_struct * vma, pmd_t *dir,
	unsigned long address, unsigned long size, unsigned long offset,
	unsigned int type, unsigned long page)
{
	pte_t * pte;
	unsigned long end;

	if (pmd_none(*dir))
		return 0;
	if (pmd_bad(*dir)) {
		printk("unuse_pmd: bad pmd (%08lx)\n", pmd_val(*dir));
		pmd_clear(dir);
		return 0;
	}
	pte = pte_offset(dir, address);
	offset += address & PMD_MASK;
	address &= ~PMD_MASK;
	end = address + size;
	if (end > PMD_SIZE)
		end = PMD_SIZE;
	do {
		if (unuse_pte(vma, offset+address-vma->vm_start, pte, type, page))
			return 1;
		address += PAGE_SIZE;
		pte++;
	} while (address < end);
	return 0;
}
开发者ID:shattered,项目名称:linux-m68k,代码行数:28,代码来源:swapfile.c

示例14: free_pgd_slow

void free_pgd_slow(pgd_t *pgd)
{
	pmd_t *pmd;
	pte_t *pte;

	if (!pgd)
		return;

	/* pgd is always present and good */
	pmd = (pmd_t *)pgd;
	if (pmd_none(*pmd))
		goto free;
	if (pmd_bad(*pmd)) {
		pmd_ERROR(*pmd);
		pmd_clear(pmd);
		goto free;
	}

	pte = pte_offset(pmd, 0);
	pmd_clear(pmd);
	pte_free(pte);
	pmd_free(pmd);
free:
	free_pages((unsigned long) pgd, 2);
}
开发者ID:hugh712,项目名称:Jollen,代码行数:25,代码来源:mm-armv.c

示例15: unswap_pmd

static inline void unswap_pmd(struct vm_area_struct * vma, pmd_t *dir,
			      unsigned long address, unsigned long size,
			      unsigned long offset, unsigned long entry,
			      unsigned long page /* , int isswap */)
{
	pte_t * pte;
	unsigned long end;

	if (pmd_none(*dir))
		return;
	if (pmd_bad(*dir)) {
		printk("unswap_pmd: bad pmd (%08lx)\n", pmd_val(*dir));
		pmd_clear(dir);
		return;
	}
	pte = pte_offset(dir, address);
	offset += address & PMD_MASK;
	address &= ~PMD_MASK;
	end = address + size;
	if (end > PMD_SIZE)
		end = PMD_SIZE;
	do {
		unswap_pte(vma, offset+address-vma->vm_start, pte, entry,
			   page /* , isswap */);
		address += PAGE_SIZE;
		pte++;
	} while (address < end);
}
开发者ID:chinnyannieb,项目名称:empeg-hijack,代码行数:28,代码来源:stram.c


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