Re: Linux-2.6.12 memory mapping broken

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 20 Jun 2005, David S. Miller wrote:

From: "Richard B. Johnson" <[email protected]>
Date: Mon, 20 Jun 2005 15:53:34 -0400 (EDT)

I can test any patches.

You have to let remap_pfn_range() fill in the PTEs for you,
you can't fill them in yourself.  Just supply the correct
"pfn" argument and you should be all set.


So I just supply the pointer now?

Right now my code does:

This is version-dependent, therefore a MACRO:
#define REMAP(a,b,c,d,e) remap_pfn_range((a), (b), (c) >> PAGE_SHIFT, (d), (e))

SHOW is a MACRO to write debugging info if enabled.

static int mmap(struct file *fp, struct vm_area_struct *vma)
{
    int minor, ret = 0;
    size_t len;
    SHOW(mmap);
    minor = MINOR(fp->f_dentry->d_inode->i_rdev);	// Extended open
    DEB(printk("UNIQUE.dma.len = %08x\n", UNIQUE.dma.len));
    DEB(printk("vma->vm_end-vma->vm_start=%08lx\n",vma->vm_end-vma->vm_start));
    len = MIN(UNIQUE.dma.len, (vma->vm_end - vma->vm_start));
    down(&UNIQUE.pci_sem);				// Acquire resource
    vma->vm_flags |= (VM_IO | VM_SHM | VM_LOCKED);	// Set required flags
    vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
    DEB(printk("About to execute remap_pfn_range\n"));
    DEB(printk("    vma->vm_start = %08lx\n", vma->vm_start));
    DEB(printk("     base address = %08x\n", UNIQUE.dma.base));
    DEB(printk("           length = %08x\n", len));
    DEB(printk("vma->vm_page_prot = %08x\n", *((size_t *)&vma->vm_page_prot)));
    ret = REMAP(vma, vma->vm_start, UNIQUE.dma.base, len, vma->vm_page_prot);
    DEB(printk("   returned value = %d\n", ret));
    up(&UNIQUE.pci_sem);				// Release resource
    return ret;
}

If I just give it the pointer, what do I put in the other
passed parameters?


Cheers,
Dick Johnson
Penguin : Linux version 2.6.11.9 on an i686 machine (5537.79 BogoMips).
 Notice : All mail here is now cached for review by Dictator Bush.
                 98.36% of all statistics are fiction.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux