pte_dir = pte_alloc_kernel(&init_mm, pmd_dir, virtaddr); 
pte_dir = pte_alloc_kernel(pmd_dir, virtaddr); 
void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag){	struct vm_struct *area;	unsigned long virtaddr, retaddr;	long offset;	pgd_t *pgd_dir;	pmd_t *pmd_dir;	pte_t *pte_dir;	/*	 * Don't allow mappings that wrap..	 */	if (!size || size > physaddr + size)		return NULL;#ifdef CONFIG_AMIGA	if (MACH_IS_AMIGA) {		if ((physaddr >= 0x40000000) && (physaddr + size < 0x60000000)		    && (cacheflag == IOMAP_NOCACHE_SER))			return (void *)physaddr;	}#endif#ifdef DEBUG	printk("ioremap: 0x%lx,0x%lx(%d) - ", physaddr, size, cacheflag);#endif	/*	 * Mappings have to be aligned	 */	offset = physaddr & (IO_SIZE - 1);	physaddr &= -IO_SIZE;	size = (size + offset + IO_SIZE - 1) & -IO_SIZE;	/*	 * Ok, go for it..	 */	area = get_io_area(size);	if (!area)		return NULL;	virtaddr = (unsigned long)area->addr;	retaddr = virtaddr + offset;#ifdef DEBUG	printk("0x%lx,0x%lx,0x%lx", physaddr, virtaddr, retaddr);#endif	/*	 * add cache and table flags to physical address	 */	if (CPU_IS_040_OR_060) {		physaddr |= (_PAGE_PRESENT | _PAGE_GLOBAL040 |			     _PAGE_ACCESSED | _PAGE_DIRTY);		switch (cacheflag) {		case IOMAP_FULL_CACHING:			physaddr |= _PAGE_CACHE040;			break;		case IOMAP_NOCACHE_SER:		default:			physaddr |= _PAGE_NOCACHE_S;			break;		case IOMAP_NOCACHE_NONSER:			physaddr |= _PAGE_NOCACHE;			break;		case IOMAP_WRITETHROUGH:			physaddr |= _PAGE_CACHE040W;			break;		}	} else {		physaddr |= (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY);		switch (cacheflag) {		case IOMAP_NOCACHE_SER:		case IOMAP_NOCACHE_NONSER:		default:			physaddr |= _PAGE_NOCACHE030;			break;		case IOMAP_FULL_CACHING:		case IOMAP_WRITETHROUGH:			break;		}	}	while ((long)size > 0) {#ifdef DEBUG		if (!(virtaddr & (PTRTREESIZE-1)))			printk ("\npa=%#lx va=%#lx ", physaddr, virtaddr);#endif		pgd_dir = pgd_offset_k(virtaddr);		pmd_dir = pmd_alloc(&init_mm, pgd_dir, virtaddr);		if (!pmd_dir) {			printk("ioremap: no mem for pmd_dir\n");			return NULL;		}		if (CPU_IS_020_OR_030) {			pmd_dir->pmd[(virtaddr/PTRTREESIZE) & 15] = physaddr;			physaddr += PTRTREESIZE;			virtaddr += PTRTREESIZE;			size -= PTRTREESIZE;		} else {			pte_dir = pte_alloc_kernel(&init_mm, pmd_dir, virtaddr);			if (!pte_dir) {				printk("ioremap: no mem for pte_dir\n");				return NULL;			}			pte_val(*pte_dir) = physaddr;			virtaddr += PAGE_SIZE;			physaddr += PAGE_SIZE;			size -= PAGE_SIZE;		}	}#ifdef DEBUG	printk("\n");#endif	flush_tlb_all();	return (void *)retaddr;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/872fec16d9a0ed3b75b8893aa217e49cca575ee5/kmap.c/clean/arch/m68k/mm/kmap.c