• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
    • Help
      • Online help
      • Learn Git
      • Welcome to Bitbucket
      • Keyboard shortcuts
    • Log In
    Android SDK
    1. Android SDK

    linux-imx

    Public
    Actions
    • Clone

    Learn more about cloning repositories

    You have read-only access

    Navigation
    • Source
    • Commits
    • Branches
    • Forks
    1. Android SDK
    2. linux-imx

    Source

    linux-imx/Documentation/nommu-mmap.txt
    Martin KepplingerMartin Kepplinger committed 83d4fcb3a0b22 Jun 2018
    Raw file
    Source viewDiff to previous
    ​x
    mapping, and may move it [#]_ if MREMAP_MAYMOVE is specified and if the new size
     
    1
    =============================
    2
    No-MMU memory mapping support
    3
    =============================
    4
    ​
    5
    The kernel has limited support for memory mapping under no-MMU conditions, such
    6
    as are used in uClinux environments. From the userspace point of view, memory
    7
    mapping is made use of in conjunction with the mmap() system call, the shmat()
    8
    call and the execve() system call. From the kernel's point of view, execve()
    9
    mapping is actually performed by the binfmt drivers, which call back into the
    10
    mmap() routines to do the actual work.
    11
    ​
    12
    Memory mapping behaviour also involves the way fork(), vfork(), clone() and
    13
    ptrace() work. Under uClinux there is no fork(), and clone() must be supplied
    14
    the CLONE_VM flag.
    15
    ​
    16
    The behaviour is similar between the MMU and no-MMU cases, but not identical;
    17
    and it's also much more restricted in the latter case:
    18
    ​
    19
     (#) Anonymous mapping, MAP_PRIVATE
    20
    ​
    21
        In the MMU case: VM regions backed by arbitrary pages; copy-on-write
    22
        across fork.
    23
    ​
    24
        In the no-MMU case: VM regions backed by arbitrary contiguous runs of
    25
        pages.
    26
    ​
    27
     (#) Anonymous mapping, MAP_SHARED
    28
    ​
    29
        These behave very much like private mappings, except that they're
    30
        shared across fork() or clone() without CLONE_VM in the MMU case. Since
    31
        the no-MMU case doesn't support these, behaviour is identical to
    32
        MAP_PRIVATE there.
    33
    ​
    34
     (#) File, MAP_PRIVATE, PROT_READ / PROT_EXEC, !PROT_WRITE
    35
    ​
    36
        In the MMU case: VM regions backed by pages read from file; changes to
    37
        the underlying file are reflected in the mapping; copied across fork.
    38
    ​
    39
        In the no-MMU case:
    40
    ​
    41
             - If one exists, the kernel will re-use an existing mapping to the
    42
               same segment of the same file if that has compatible permissions,
    43
               even if this was created by another process.
    44
    ​
    45
             - If possible, the file mapping will be directly on the backing device
    46
               if the backing device has the NOMMU_MAP_DIRECT capability and
    47
               appropriate mapping protection capabilities. Ramfs, romfs, cramfs
    48
               and mtd might all permit this.
    49
    ​
    50
         - If the backing device can't or won't permit direct sharing,
    51
               but does have the NOMMU_MAP_COPY capability, then a copy of the
    52
               appropriate bit of the file will be read into a contiguous bit of
    53
               memory and any extraneous space beyond the EOF will be cleared
    54
    ​
    55
         - Writes to the file do not affect the mapping; writes to the mapping
    56
           are visible in other processes (no MMU protection), but should not
    57
           happen.
    58
    ​
    59
     (#) File, MAP_PRIVATE, PROT_READ / PROT_EXEC, PROT_WRITE
    60
    ​
    61
        In the MMU case: like the non-PROT_WRITE case, except that the pages in
    62
        question get copied before the write actually happens. From that point
    63
        on writes to the file underneath that page no longer get reflected into
    64
        the mapping's backing pages. The page is then backed by swap instead.
    65
    ​
    66
        In the no-MMU case: works much like the non-PROT_WRITE case, except
    67
        that a copy is always taken and never shared.
    68
    ​
    69
     (#) Regular file / blockdev, MAP_SHARED, PROT_READ / PROT_EXEC / PROT_WRITE
    70
    ​
    71
        In the MMU case: VM regions backed by pages read from file; changes to
    72
        pages written back to file; writes to file reflected into pages backing
    73
        mapping; shared across fork.
    74
    ​
    75
        In the no-MMU case: not supported.
    76
    ​
    77
     (#) Memory backed regular file, MAP_SHARED, PROT_READ / PROT_EXEC / PROT_WRITE
    78
    ​
    79
        In the MMU case: As for ordinary regular files.
    80
    ​
    81
        In the no-MMU case: The filesystem providing the memory-backed file
    82
        (such as ramfs or tmpfs) may choose to honour an open, truncate, mmap
    83
        sequence by providing a contiguous sequence of pages to map. In that
    84
        case, a shared-writable memory mapping will be possible. It will work
    85
        as for the MMU case. If the filesystem does not provide any such
    86
        support, then the mapping request will be denied.
    87
    ​
    88
     (#) Memory backed blockdev, MAP_SHARED, PROT_READ / PROT_EXEC / PROT_WRITE
    89
    ​
    90
        In the MMU case: As for ordinary regular files.
    91
    ​
    92
        In the no-MMU case: As for memory backed regular files, but the
    • Git repository management for enterprise teams powered by Atlassian Bitbucket
    • Atlassian Bitbucket v5.10.0
    • Documentation
    • Contact Support
    • Request a feature
    • About
    • Contact Atlassian
    Atlassian

    Everything looks good. Well let you know here if theres anything you should know about.