Messages in this thread | | | From | Thiago Robert dos Santos <> | Date | Wed, 17 Nov 2004 18:43:46 -0200 (BRDT) | Subject | remap_page_range |
| |
All,
I'm having a problem with remap_page_range in the 2.6 kernel series. I use remap_page_range inside the mmap function of a module I wrote in order to map a given device's memory into user space.
Apparently, everything works fine but I just can't access the device's memory (even tough I get a valid point from the mmap system call). This is the mmap function I wrote:
static int pcimap_mmap (struct file *filp, struct vm_area_struct *vma) {
int unit, reg; unsigned long size, phy_addr;
unit = MINOR(filp->f_dentry->d_inode->i_rdev) >> 4; reg = MINOR(filp->f_dentry->d_inode->i_rdev) & 0x0f;
size = vma->vm_end - vma->vm_start;
/* Mapping must be page aligned and not larger than the region size */ if ((size + vma->vm_pgoff * PAGE_SIZE) > pcidevs[unit].reg[reg].size) { return -EINVAL; }
/* Get device's memory physical address for mapping */ phy_addr = pcidevs[unit].reg[reg].phy_addr + vma->vm_pgoff * PAGE_SIZE;
/* Map device's memory in the requested address space range */ if (remap_page_range (vma, phy_addr, 0, size, vma->vm_page_prot)) { return -EAGAIN; }
filp->f_dentry->d_inode->i_count.counter++;
return 0; }
Can anyone help me?
Thanks in advance.
Thiago Robert[unhandled content-type:application/octet-stream] | |