vma->vm_page_prot = phys_mem_access_prot(file, off, 
vma->vm_page_prot = phys_mem_access_prot(file, off >> PAGE_SHIFT, 
fb_mmap(struct file *file, struct vm_area_struct * vma){	int fbidx = iminor(file->f_dentry->d_inode);	struct fb_info *info = registered_fb[fbidx];	struct fb_ops *fb = info->fbops;	unsigned long off;#if !defined(__sparc__) || defined(__sparc_v9__)	unsigned long start;	u32 len;#endif	if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT))		return -EINVAL;	off = vma->vm_pgoff << PAGE_SHIFT;	if (!fb)		return -ENODEV;	if (fb->fb_mmap) {		int res;		lock_kernel();		res = fb->fb_mmap(info, file, vma);		unlock_kernel();		return res;	}#if defined(__sparc__) && !defined(__sparc_v9__)	/* Should never get here, all fb drivers should have their own	   mmap routines */	return -EINVAL;#else	/* !sparc32... */	lock_kernel();	/* frame buffer memory */	start = info->fix.smem_start;	len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.smem_len);	if (off >= len) {		/* memory mapped io */		off -= len;		if (info->var.accel_flags) {			unlock_kernel();			return -EINVAL;		}		start = info->fix.mmio_start;		len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.mmio_len);	}	unlock_kernel();	start &= PAGE_MASK;	if ((vma->vm_end - vma->vm_start + off) > len)		return -EINVAL;	off += start;	vma->vm_pgoff = off >> PAGE_SHIFT;	/* This is an IO map - tell maydump to skip this VMA */	vma->vm_flags |= VM_IO | VM_RESERVED;#if defined(__sparc_v9__)	if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT,				vma->vm_end - vma->vm_start, vma->vm_page_prot))		return -EAGAIN;#else#if defined(__mc68000__)#if defined(CONFIG_SUN3)	pgprot_val(vma->vm_page_prot) |= SUN3_PAGE_NOCACHE;#elif defined(CONFIG_MMU)	if (CPU_IS_020_OR_030)		pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE030;	if (CPU_IS_040_OR_060) {		pgprot_val(vma->vm_page_prot) &= _CACHEMASK040;		/* Use no-cache mode, serialized */		pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE_S;	}#endif#elif defined(__powerpc__)	vma->vm_page_prot = phys_mem_access_prot(file, off,						 vma->vm_end - vma->vm_start,						 vma->vm_page_prot);#elif defined(__alpha__)	/* Caching is off in the I/O space quadrant by design.  */#elif defined(__i386__) || defined(__x86_64__)	if (boot_cpu_data.x86 > 3)		pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;#elif defined(__mips__)	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);#elif defined(__hppa__)	pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;#elif defined(__arm__) || defined(__sh__) || defined(__m32r__)	vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);#elif defined(__ia64__)	if (efi_range_is_wc(vma->vm_start, vma->vm_end - vma->vm_start))		vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);	else		vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);#else#warning What do we have to do here??#endif	if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT,			     vma->vm_end - vma->vm_start, vma->vm_page_prot))		return -EAGAIN;#endif /* !__sparc_v9__ */	return 0;#endif /* !sparc32 */}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/8b150478aeb1a8edb9015c2f7ac4da637ff65c45/fbmem.c/buggy/drivers/video/fbmem.c