Skip to Content
Linux Device Drivers Development
book

Linux Device Drivers Development

by John Madieu
October 2017
Intermediate to advanced
586 pages
14h 8m
English
Packt Publishing
Content preview from Linux Device Drivers Development

Using remap_pfn_range

remap_pfn_range() maps physical memory (by means of kernel logical address) to a user space process. It is particularly useful for implementing the mmap() system call.

After calling the mmap() system call on a file (whether it is a device file or not), the CPU will switch to privileged mode and run the corresponding file_operations.mmap() kernel function, which in turn will call remap_pfn_range(). The kernel PTE of the mapped region will be derived and given to the process, of course with different protection flags. The process's VMA list is updated with a new VMA entry (with appropriate attributes) , which will use PTE to access the same memory.

Thus, instead of wasting memory by copying, the kernel just duplicates ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Device Drivers, Second Edition

Linux Device Drivers, Second Edition

Jonathan Corbet, Alessandro Rubini
Linux Device Drivers, 3rd Edition

Linux Device Drivers, 3rd Edition

Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman

Publisher Resources

ISBN: 9781785280009Supplemental Content