how to mmap 0x1f000000 to user space?

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

 



hi,

i am newbies for mips. i want to mmap the kernel space address
0x1f00,0000 to user mode space? 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_mmap(struct file *file, struct vm_area_struct *vma)
{
	unsigned long start = vma->vm_start;
	unsigned long size  = vma->vm_end - vma->vm_start;
	unsigned long addr;
	unsigned long __iomem *buf;

#if 0
	addr = 0x1f000000;
	addr += vma->vm_pgoff;
#else
	buf = (unsigned long __iomem *)ioremap_nocache(0x1f00000, size);

	addr = vmalloc_to_pfn((void *)buf);
	addr += vma->vm_pgoff;
	
#endif

	remap_pfn_range(vma, start, addr, size, PAGE_SHARED);

	return 0;
}



Best,
Figo.zhang


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux