linux-mips
[Top] [All Lists]

how to mmap 0x1f000000 to user space?

To: linux-mips@linux-mips.org
Subject: how to mmap 0x1f000000 to user space?
From: figo zhang <figo1802@gmail.com>
Date: Sat, 24 Oct 2009 13:28:48 +0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=gEb29mp6cuBUGFohdqKVRbK9NMRLcyYBaBT7cpSAaUA=; b=jZEoKTKxQAeR1MJgG1GcoLK0AB3pmCEAGD6m5xc4/W/82j5xwk/IF8zWp2GdRh8rkQ t8jFNgDm27E6NIc6utusDDhwcRQlv2bZeLGsmyrHlFY03hgXTFyDg2wy8xlG5KC/WH9A sUm+OjUcsff00rTiFNNCZm1Hdo5NJJhKpFnN8=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=xpgkK3kK6xMdDVRNPbWq+9N1Vkaq93FAY3g52MtbrhzdyYWlfrKhge08+KzSqZttdk 8ghbOyMQb9isfE8Itw6aMTkEN3cJtm/8P5i9NaYoMSL0NB0D7rLttROqZczdn4p9wP6F TsxbzWoZgDpskWzDD51/5s3oJJ7pgMXUCW52M=
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
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
<Prev in Thread] Current Thread [Next in Thread>