Fresh IDE . Artifact [e4c05f4ed6]
Not logged in

This repository is a mirror!

The original is located on: https://fresh.flatassembler.net/fossil/repo/fresh
If you want to follow the project, please update your remote-url

Artifact e4c05f4ed61fd5ef16074414ba7bcbaf41a8f305:


 
<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title><style type="text/css">
<!--
.style1 {font-size: 18px;font-weight: bold;font-family: Georgia, "Times New Roman", Times, serif;}
.style2 {font-size: 14px}
a{color:#0000cc;text-decoration:none}
a:visited{color:#0000cc;text-decoration:none}
-->
</style></head>
<body style="margin:0px 0px 0px 0px;">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="#cccccc"><span class="style1" style="margin-left:5px">sys_mremap &nbsp;<span class="style2">[mm/mremap.c] </span></span></td>
  </tr>
  <tr>
    <td><p style="margin-left:22px;margin-top:0px"><br />
      Expands (or shrinks) an existing memory mapping, potentially moving it at the   same time.<br />
      <br />
    In Linux the memory is divided into pages. A user process has (one or)   several linear virtual memory segments. Each virtual memory segment has one or   more mappings to real memory pages (in the page table). Each virtual memory   segment has its own protection (access rights), which may cause a segmentation   violation if the memory is accessed incorrectly (e.g., writing to a read-only   segment). Accessing virtual memory outside of the segments will also cause a   segmentation violation.</p>
      <p style="margin-left:10px"><strong>Arguments</strong></p>
      <table width="100%" border="0" style="margin-left:20px; margin-right:20px">
        <tr>
          <td width="6%" valign="top"><em>eax</em></td>
          <td width="94%">163</td>
        </tr>
        <tr>
          <td valign="top"><em>ebx</em></td>
          <td>Old address of the virtual memory block that you want to expand (or shrink). It    has to be page aligned.</td>
        </tr>
        <tr>
          <td valign="top"><em>ecx</em></td>
          <td>Old   size of the virtual memory block</td>
        </tr>
        <tr>
          <td valign="top"><em>edx</em></td>
          <td>Requested size of the   virtual memory block after the resize. </td>
        </tr>
        <tr>
          <td valign="top"><em>esi</em></td>
          <td>Flags:
            <table width="100%" border="0" style="border:dashed;border-bottom-width:1px;border-left-width:1px;border-right-width:1px;border-top-width:1px;border-color:#333333">
              <tr>
                <td><table width="100%" border="0">
                  <tr>
                    <td width="15%" valign="top"><code>MREMAP_MAYMOVE</code></td>
                    <td width="85%"><code>By default, if there is not sufficient space to expand a mapping at its current   location, then sys_mremap fails. If this flag is specified, then the kernel   is permitted to relocate the mapping to a new virtual address, if necessary. If   the mapping is relocated, then absolute pointers into the old mapping location   become invalid (offsets relative to the starting address of the mapping should   be employed). </code></td>
                  </tr>
                  <tr>
                    <td valign="top"><code>MREMAP_FIXED</code></td>
                    <td><code>                      This flag serves a similar purpose to the MAP_FIXED flag of <a href="90.html">sys_mmap</a>. If this flag is specified, then sys_mremap accepts a fifth argument, <em>edi</em>, which   specifies a page-aligned address to which the mapping must be moved. Any   previous mapping at the address range specified by <em>edi</em> and <em>edx</em> is unmapped. If MREMAP_FIXED is specified, then MREMAP_MAYMOVE must also be specified.</code></td>
                  </tr>

                </table></td>
              </tr>
            </table></td>
        </tr>
        <tr>
          <td valign="top"><em>edi</em></td>
          <td>New address. This argument is valid only if MREMAP_FIXED is specified.</td>
        </tr>
      </table>
      <p style="margin-left:10px" ><strong>Return values</strong></p>
      <p style="margin-left:22px;margin-right:10px" >If the system call succeeds the return value is a pointer to the new virtual memory area.<br />
If the system call fails the return value is one of the following <em>errno</em> values:</p>
      <table width="100%" border="0" style="border:dashed;border-bottom-width:1px;border-left-width:1px;border-right-width:1px;border-top-width:1px;border-color:#333333;margin-left:22px;margin-right:22px">
        <tr>
          <td><table width="100%" border="0">
              <tr>
                <td width="10%" valign="top"><code>-EAGAIN </code></td>
                <td width="90%"><code>The caller tried to expand a memory segment that is locked, but this was not   possible without exceeding the RLIMIT_MEMLOCK resource limit. </code></td>
              </tr>
              <tr>
                <td valign="top"><code>-EFAULT </code></td>
                <td><code>&quot;Segmentation fault.&quot; Some address in the range <em>ebx</em> to <em>ebx</em>+<em>ecx</em> is an invalid virtual memory address for this   process. You can also get EFAULT even if there exist mappings that cover the   whole address space requested, but those mappings are of different types. </code></td>
              </tr>
              <tr>
                <td valign="top"><code>-EINVAL </code></td>
                <td><code>An invalid argument was given. Possible causes are: <em>ebx</em> was not   page aligned; a value other than MREMAP_MAYMOVE or MREMAP_FIXED was specified in <em>esi; </em> <em>edx</em> was zero; <em>edx</em> or <em>edi</em> was invalid; or the new address range specified by <em>edi </em>and <em>edx</em> overlapped the old address range   specified by <em>ebx</em> and <em>ecx</em>; or MREMAP_FIXED was   specified without also specifying MREMAP_MAYMOVE. </code></td>
              </tr>
              <tr>
                <td valign="top"><code>-ENOMEM</code></td>
                <td><code>The memory area cannot be expanded at the current virtual address, and the MREMAP_MAYMOVE flag is not set in <em>esi</em>. Or, there is not enough   (virtual) memory available.</code></td>
              </tr>
          </table></td>
        </tr>
      </table>
      <p style="margin-left:10px"><strong>Remarks</strong></p>
      <p style="margin-left:22px">If the memory segment specified by <em>ebx </em>and <em>ecx</em> is   locked (using <a href="150.html">sys_mlock</a> or similar), then this lock is maintained when the   segment is resized and/or relocated. As a consequence, the amount of memory   locked by the process may change. </p>
      <p style="margin-left:10px"><strong>Compatibility</strong></p>
    <p style="margin-left:22px">n/a</p></td>
  </tr>
</table></body></html>