mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-31 09:20:54 -08:00
208 lines
8.9 KiB
HTML
208 lines
8.9 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
|
|
<head>
|
|
|
|
<title>The design of the virtual mapping interface</title>
|
|
|
|
</head>
|
|
|
|
<body bgcolor="#FFFFFF" text="#000000" link="#000099" vlink="#660066" alink="#FF0000">
|
|
|
|
<div align="center">
|
|
|
|
<p>
|
|
<a href="/">Ravenbrook</a> /
|
|
<a href="/project/">Projects</a> /
|
|
<a href="/project/mps/">Memory Pool System</a> /
|
|
<a href="/project/mps/master/">Master Product Sources</a> /
|
|
<a href="/project/mps/master/design/">Design Documents</a>
|
|
</p>
|
|
|
|
<p><i><a href="/project/mps/">Memory Pool System Project</a></i></p>
|
|
|
|
<hr />
|
|
|
|
</div>
|
|
|
|
<pre>
|
|
THE DESIGN OF THE VIRTUAL MAPPING INTERFACE
|
|
design.mps.vm
|
|
incomplete design
|
|
richard 1998-05-11
|
|
|
|
<a id="intro" name="intro">.intro</a>: This the design of the VM interface. The VM interface provides a
|
|
simple, low-level, operating-system independent interface to address-space.
|
|
Each call to VMCreate() reserves (from the operating-system) a single
|
|
contiguous range of addresses, and returns a VMStruct thereafter used to manage
|
|
this address-space. The VM interface has separate implementations for each
|
|
platform that supports it (at least conceptually, in practice some of them may
|
|
be the same). The VM module provides a mechanism to reserve large (relative to
|
|
the amount of RAM) amounts of address space, and functions to map (back with
|
|
RAM) and unmap portions of this address space.
|
|
|
|
<a id="motivation" name="motivation">.motivation</a>: The VM is used by the VM Arena Class. It provides the basic
|
|
substrate to provide sparse address maps. Sparse address maps have at least
|
|
two uses: to encode information into the address of an object which is used in
|
|
tracing (the Zone Test) to speed things up; to avoid fragmentation at the
|
|
segment level and above (since the amount of address space reserved is large
|
|
compared to the RAM, the hope is that there will also be enough address space
|
|
somewhere to fit any particular segment in).
|
|
|
|
|
|
DEFINITIONS
|
|
|
|
<a id="def.reserve" name="def.reserve">.def.reserve</a>: The "reserve" operation: Exclusively reserve a portion of the
|
|
virtual address space without arranging RAM or backing store for the virtual
|
|
addresses. The intention is that no other component in the process will make
|
|
use of the reserved virtual addresses, but in practice this may entail assuming
|
|
a certain amount of cooperation. When reserving address space, the requester
|
|
simply asks for a particular size, not a particular range of virtual
|
|
addresses. Accessing (read/write/execute) reserved addresses is illegal unless
|
|
those addresses have been mapped.
|
|
|
|
<a id="def.map" name="def.map">.def.map</a>: The "map" operation: Arrange that a specified portion of the virtual
|
|
address space is mapped from the swap, effectively allocating RAM and/or swap
|
|
space for a particular range of addresses. If successful, accessing the
|
|
addresses is now legal. Only reserved addresses should be mapped.
|
|
|
|
<a id="def.unmap" name="def.unmap">.def.unmap</a>: The "unmap" operation: The inverse of the map operation. Arrange
|
|
that a specified portion of the virtual address space is no longer mapped,
|
|
effectively freeing up the RAM and swap space that was in use. Accessing the
|
|
addresses is now illegal. The addresses return to the reserved state.
|
|
|
|
<a id="def.vm" name="def.vm">.def.vm</a>: "VM" stands for Virtual Memory. Various meanings: A processor
|
|
architecture's virtual space and structure; The generic idea / interface /
|
|
implementation of the MPS VM module; The C structure (struct VMStruct) used to
|
|
encapsulate the functionality of the MPS VM module; An instance of such a
|
|
structure.
|
|
|
|
<a id="def.vm.mps" name="def.vm.mps">.def.vm.mps</a>: In the MPS, a "VM" is a VMStruct, providing access to the single
|
|
contiguous range of address-space that was reserved (from the operating-system)
|
|
when VMCreate was called.
|
|
|
|
|
|
INTERFACE
|
|
|
|
<a id="if.create" name="if.create">.if.create</a>: Res VMCreate(VM *VMReturn, Size size)
|
|
|
|
VMCreate is responsible both for allocating a VMStruct and for reserving an
|
|
amount of virtual address space. A VM is created and a pointer to it is
|
|
returned in the return parameter VMReturn. This VM has at least size bytes of
|
|
virtual memory reserved. If there's not enough space to allocate the VM,
|
|
ResMEMORY is returned. If there's not enough address space to reserve a block
|
|
of the given size, ResRESOURCE is returned. The reserved virtual memory can be
|
|
mapped and unmapped using VMMap and VMUnmap.
|
|
|
|
|
|
<a id="if.destroy" name="if.destroy">.if.destroy</a>: void VMDestroy(VM vm)
|
|
|
|
A VM is destroyed by calling VMDestroy. Any address space that was mapped
|
|
through this VM is unmapped.
|
|
|
|
|
|
[lots of interfaces missing here]
|
|
|
|
|
|
NOTES
|
|
|
|
<a id="diagram" name="diagram">.diagram</a>:
|
|
|
|
|
|
|
|
<a id="testing" name="testing">.testing</a>: It is important to test that a VM implementation will work in extreme
|
|
cases. <a id="testing.large" name="testing.large">.testing.large</a>: It must be able to reserve a large address space.
|
|
Clients will want multi-GB spaces, more than that OSs will allow. If they ask
|
|
for too much, mps_arena_create (and hence VMCreat4e) must fail in a predictable
|
|
way. <a id="testing.larger" name="testing.larger">.testing.larger</a>: It must be possible to allocate in a large space;
|
|
sometimes commiting will fail, because there's not enough space to replace the
|
|
"reserve" mapping. See request.epcore.160201 for details. <a id="testing.lots" name="testing.lots">.testing.lots</a>: It
|
|
must be possible to have lots of mappings. The OS must either combine adjacent
|
|
mappings or have lots of space in the kernel tables. See request.epcore.160117
|
|
for ideas on how to test this.
|
|
|
|
</pre>
|
|
|
|
|
|
<h2><a id="section-A" name="section-A">A. References</a></h2>
|
|
|
|
<!-- Template Entry
|
|
|
|
<table>
|
|
|
|
<tr valign="top">
|
|
|
|
<td>[<a id="ref-#REF#" name="ref-#REF#" href="#REF_URL#">#REF_NAME#</a>]</td>
|
|
|
|
<td>
|
|
"#REF_TITLE#";
|
|
#REF_AUTHOR#;
|
|
<URL: <a href="#REF_URL#">#REF_URL#</a>>;
|
|
#REF_DATE#.
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
-->
|
|
|
|
|
|
<h2><a id="section-B" name="section-B">B. Document History</a></h2>
|
|
|
|
<table>
|
|
|
|
<tr valign="top">
|
|
|
|
<td>2002-06-07</td>
|
|
|
|
<td><a href="mailto:rb@ravenbrook.com">RB</a></td>
|
|
|
|
<td>Converted from MMInfo database design document.</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
<h2><a id="section-C" name="section-C">C. Copyright and License</a></h2>
|
|
|
|
<p> This document is copyright © 1995-2002 <a href="http://www.ravenbrook.com/">Ravenbrook Limited</a>. All rights reserved. This is an open source license. Contact Ravenbrook for commercial licensing options. </p>
|
|
|
|
<p> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: </p>
|
|
|
|
<ol>
|
|
|
|
<li> Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. </li>
|
|
|
|
<li> Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. </li>
|
|
|
|
<li> Redistributions in any form must be accompanied by information on how to obtain complete source code for the this software and any accompanying software that uses this software. The source code must either be included in the distribution or be available for no more than the cost of distribution plus a nominal fee, and must be freely redistributable under reasonable conditions. For an executable file, complete source code means the source code for all modules it contains. It does not include source code for modules or files that typically accompany the major components of the operating system on which the executable file runs. </li>
|
|
|
|
</ol>
|
|
|
|
<p> <strong> This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement, are disclaimed. In no event shall the copyright holders and contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage. </strong> </p>
|
|
|
|
|
|
<hr />
|
|
|
|
<div align="center">
|
|
|
|
<p><code>$Id$</code></p>
|
|
|
|
<p>
|
|
<a href="/">Ravenbrook</a> /
|
|
<a href="/project/">Projects</a> /
|
|
<a href="/project/mps/">Memory Pool System</a> /
|
|
<a href="/project/mps/master/">Master Product Sources</a> /
|
|
<a href="/project/mps/master/design/">Design Documents</a>
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|