[Top] [All Lists]

Re: how to mmap 0x1f000000 to user space?

To: figo zhang <>
Subject: Re: how to mmap 0x1f000000 to user space?
From: Markus Gothe <>
Date: Sat, 24 Oct 2009 18:27:39 +0200
In-reply-to: <>
Original-recipient: rfc822;
References: <>
What does the vendor UM say on the memory base?


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

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?

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;
       buf = (unsigned int  * )ioremap_nocache(0x1f000000, size);
        pfn = vmalloc_to_pfn((void *)buf);
  offset += pfn;
      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,
  return 0;


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

<Prev in Thread] Current Thread [Next in Thread>