Re: how to use mmap() on a disk file to get a kernel address?

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

 



HI,

You cannot do this since mmap function is used to map something to your user space address.
You can remap kernel memory to user space by remap_pfn_range than access the kernel memory by using the mapped
user space address.

MH


On Thu, Dec 26, 2013 at 3:42 PM, Yu Bi <lazysmartegg@xxxxxxxxx> wrote:
Hi,
   I try to mmap a file in a linux kernel module. I have tried to use the function do_mmap_pgoff. But the address returned is memory virtual address in current process' user space, i.e., below the kernel boundary. Instead, I want to map the file in the kernel space and get the kernel virtual address of the mapped region. Is there any kernel API in Linux support this operation? Or I have to reimplement a kernel mmap version ? 
  But reimplement a kernel version mmap() is  not easy I guess. Do you have any idea? 
   

      
   
   

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[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