mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-26 07:11:34 -08:00
198 lines
7.2 KiB
HTML
198 lines
7.2 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>Generic design of the protection module</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>
|
|
GENERIC DESIGN OF THE PROTECTION MODULE
|
|
design.mps.prot
|
|
incomplete doc
|
|
drj 1997-04-02
|
|
|
|
INTRODUCTION
|
|
|
|
<a id="readership" name="readership">.readership</a>: Any MPS developer.
|
|
|
|
<a id="intro" name="intro">.intro</a>: This is the generic design of the Protection Module. The protection
|
|
module provides protection services to other parts of the MPS. It is expected
|
|
that different operating systems will have different implementations of this
|
|
module.
|
|
|
|
|
|
INTERFACE
|
|
|
|
<a id="if.setup" name="if.setup">.if.setup</a>:
|
|
|
|
void ProtSetup(void);
|
|
|
|
ProtSetup will be called exactly once (per process). It will be called as part
|
|
of the initialization of the first space that is created. It should arrange
|
|
for the setup and initialization of any datastructures or services that are
|
|
necessary in order to implement the protection module. (On UNIX it expected
|
|
that it will install a signal handler, on Windows it will do nothing)
|
|
|
|
<a id="if.set" name="if.set">.if.set</a>:
|
|
|
|
void ProtSet(Addr base, Addr limit, AccessSet mode)
|
|
|
|
ProtSet should set the protection of the memory between base and limit,
|
|
including base, but not including limit (ie the half-open interval
|
|
[base,limit)) to that specified by mode.
|
|
The mode parameter should have the AccessWrite bit set if write accesses to the
|
|
page are to be forbidden, and should have the AccessRead bit set if read
|
|
accesses to the page are to be forbidden. A request to forbid read accesses
|
|
(ie AccessRead is set) may also forbid write accesses, but read accesses will
|
|
not be forbidden unless AccessRead is set.
|
|
|
|
<a id="if.tramp" name="if.tramp">.if.tramp</a>:
|
|
|
|
void ProtTramp(void **resultReturn, void *(*f)(void *, size_t), void *p, size_t
|
|
s);
|
|
|
|
<a id="if.sync" name="if.sync">.if.sync</a>:
|
|
|
|
void ProtSync(Space space);
|
|
|
|
ProtSync is called to ensure that the actual protection of each segment (as
|
|
determined by the OS) is in accordance with the segments's pm field.
|
|
|
|
<a id="if.context-type" name="if.context-type">.if.context-type</a>:
|
|
|
|
typedef struct MutatorFaultContextStruct *MutatorFaultContext;
|
|
|
|
This abstract type is implemented by the protection module (impl.c.prot*). It
|
|
represents the continuation of the mutator which is restored after a mutator
|
|
fault has been handled. The functions ProtCanStepInstruction (.if.canstep
|
|
below) and ProtStepInstruction (.if.step below) inspect and manipulate the
|
|
context.
|
|
|
|
<a id="if.canstep" name="if.canstep">.if.canstep</a>:
|
|
|
|
Bool ProtCanStepInstruction(MutatorFaultContext context);
|
|
|
|
Examines the context to determine whether the protection module can single-step
|
|
the instruction which is causing the fault. Should return TRUE if and only if
|
|
the instruction can be single-stepped (ie ProtStepInstruction can be called).
|
|
|
|
<a id="if.step" name="if.step">.if.step</a>:
|
|
|
|
Bool Res ProtStepInstruction(MutatorFaultContext context);
|
|
|
|
Single-steps the instruction which is causing the fault. This function should
|
|
only be called if ProtCanStepInstruction applied to
|
|
the context returned TRUE. It should return ResUNIMPL if the instruction
|
|
cannot be single-stepped. It should return ResOK if the
|
|
instruction is single-stepped.
|
|
|
|
The mutator context will be updated by the emulation/execution of the
|
|
instruction such that resuming the mutator will not cause the
|
|
instruction which was causing the fault to be executed.
|
|
|
|
|
|
</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>
|