364 Embedded Linux System Design and Development
10.4 File / Memory Mapping—The Intricacies of mmap()
in uClinux
Memory regions in Linux are mapped into the process address space using
the
mmap() system call. The mapped region is controlled using protection
flags such as
PROT_READ and PROT_WRITE and the usability specified either
private or shared mapping using
MAP_PRIVATE and MAP_SHARED flags. For
example, the loader maps text regions of a shared library as read-only, shared
(
PROT_READ and MAP_SHARED) regions in the application’s process space.
mmap() internally fills up VM data structures that describe the property of
each region mapped and leaves the rest to the page fault handler. Using the
fault condition and the flags in the VM data structures the ...