Re: how to mmap 0x1f000000 to user space?

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

 



What does the vendor UM say on the memory base?

//Markus

On 24 Oct 2009, at 07:28, figo zhang wrote:

hi,
i am newbies for mips. i want to mmap the kernel space address
0x1f00,0000 to user mode space for MIPS32 CPU? how to write the mmap file mothod?
here is my code, is it right? Would you like to give me some advise?
Thanks!

static int test_reg_mmap(struct file * file, struct vm_area_struct * vma)
{
  unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
  unsigned long size =  vma->vm_end-vma->vm_start;
  unsigned int *pfn;
  unsigned int __iomem *buf;
  #if 0
   offset += 0xbf000000;
   #else
       buf = (unsigned int  * )ioremap_nocache(0x1f000000, size);
        pfn = vmalloc_to_pfn((void *)buf);
  offset += pfn;
 #endif
      if ((offset>__pa(high_memory)) || (file->f_flags & O_SYNC)) {
       vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
  }
       /* Don't try to swap out physical pages.. */
     vma->vm_flags |= VM_RESERVED;

  /* Don't dump addresses that are not real memory to a core file.*/
  if (offset >= __pa(high_memory) || (file->f_flags & O_SYNC))
    vma->vm_flags |= VM_IO;

if (remap_pfn_range(vma, vma->vm_start, offset, vma->vm_end-vma- >vm_start,
               vma->vm_page_prot))
  return 0;
}



Best,
Figo.zhang

Attachment: PGP.sig
Description: This is a digitally signed message part


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux