sys_remap_file_pages  [mm/fremap.c]


Creates a non-linear mapping.

A non-linear mapping is a mapping in which the pages of the file are mapped into a non-sequential order in memory. The advantage of using sys_remap_file_pages over using repeated calls to sys_mmap is that the former approach does not require the kernel to create additional VMA (Virtual Memory Area) data structures.

To create a non-linear mapping we perform the following steps:

  1. Use sys_mmap to create a mapping (which is initially linear). This mapping must be created with the MAP_SHARED flag.
  2. Use one or more calls to sys_remap_file_pages to rearrange the correspondence between the pages of the mapping and the pages of the file. It is possible to map the same page of a file into multiple locations within the mapped region.

Arguments

eax 257
ebx Start of the remapped virtual memory range.

This argument serves two purposes. First, it identifies the mapping whose pages we want to rearrange. Thus, ebx must be an address that falls within a region previously mapped by a call to sys_mmap. Second, ebx specifies the address at which the file pages identified by esi and edx will be placed.

The value specified in ebx should be multiples of the system page size. If it's not, then the kernel rounds it down to the nearest multiple of the page size.
ecx Size of the remapped virtual memory range
edx This argument is currently ignored and must be 0.
esi A file offset in units of the system page size which specifies the region of the file that is to be relocated within the mapping.
The value specified in esi should be multiples of the system page size. If it's not, then the kernel rounds it down to the nearest multiple of the page size.
edi This argument has the same meaning as for sys_mmap, but all flags other than MAP_NONBLOCK are ignored. *to be documented*

Return values

If the system call succeeds the return value is 0.
If the system call fails the return value is one of the following errno values:

-EINVAL ebx does not refer to a valid mapping created with the MAP_SHARED flag
-EINVAL ebx, ecx, edx, or esi is invalid.

Remarks

n/a

Compatibility

n/a