📄 traps7.htm
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="GENERATOR" content="Quadralay WebWorks Publisher Professional Edition 6.0.5">
<meta name="TEMPLATEBASE" content="book_html">
<meta name="LASTUPDATED" content="08/22/03 10:13:21">
<title>8.6 Rules for trap handlers</title>
<STYLE TYPE="text/css">
<!--
span.Signal { text-transform: uppercase; font-family: Verdana }
-->
</STYLE>
</head>
<body link="#3366CC" vlink="#9999CC" text="#000000" alink="#0000CC" bgcolor="#FFFFFF"
background="images/backgrnd.gif">
<p><img src="images/stlogo.gif" width="106" height="83" align="left"
alt="logo here!"> </p>
<table width="331" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td><a href="c2isetto.htm"><img src="images/navtoc.gif" width="84" height="23"
border="0" alt="TOC"> </a></td>
<td><a href="traps6.htm"><img src="images/navprev.gif" width="80" height="23"
border="0" alt="PREV"> </a></td>
<td><a href="traps8.htm"><img src="images/navnext.gif" width="83" height="23"
border="0" alt="NEXT"> </a></td>
<td><a href="c2isetix.htm"><img src="images/navidx.gif" width="84" height="23"
border="0" alt="INDEX"> </a></td>
</tr>
</table>
<p><br clear="all">
</p>
<hr align="left">
<blockquote>
<h2>
<a name="1204710"> </a><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif">8.6 Rules for trap handlers</font>
</h2><hr>
<p>
<a name="1204711"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">The ST20-C2 trap mechanism, if used incorrectly, can cause a system to crash via deadlock or livelock. However a few simple rules prevent this possibility.</font>
</p>
<ul>
<p> <font size=2 face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204712"> </a>Trap handlers must have their enable mask set so that during the handler all traps in their trap group are disabled. This is required to prevent re-entrancy to the handler.</font></p>
<dl>
<dt> <a name="1204713"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">Trap handlers can be made to be re-entrant by copying the trapped state information to a temporary storage location on entry, restoring it before exit and having a means to allocate a unique workspace to each instance of the handler. However, the handler must still protect itself against re-entrancy while the state copying and workspace assignment are being performed.</font>
</dl>
<p> <font size=2 face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204714"> </a>Trap handlers must not deschedule or timeslice. Trap handlers alter the <span class=Signal>Enables</span> register, therefore, no other process must execute until the handler has completed. This avoids another process executing with the `wrong' trap enables.</font></p>
<dl>
<dt> <a name="1204715"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">This means that trap handlers must not execute any communication instructions (for example, <strong>in</strong> and <strong>out</strong>). In the event of a handler requiring synchronization with another process then a semaphore may be used with the handler performing a <strong>signal</strong>.</font>
</dl>
<p> <font size=2 face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204716"> </a>Trap handlers must terminate via <strong>tret</strong>. At the end of handling a trap the handler must return to the trapped process and restore the enable flags. This must be done as an atomic operation as otherwise there is a danger of traps conspiring to cause a second instance of the handler to run. The only exception to this is that a scheduler kernel may use <strong>restart</strong> to return to a previously shadowed process.</font></p>
</ul>
</blockquote>
<hr>
<table width="331" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td><a href="c2isetto.htm"><img src="images/navtoc.gif" width="84" height="23"
border="0" alt="TOC"> </a></td>
<td><a href="traps6.htm"><img src="images/navprev.gif" width="80" height="23"
border="0" alt="PREV"> </a></td>
<td><a href="traps8.htm"><img src="images/navnext.gif" width="83" height="23"
border="0" alt="NEXT"> </a></td>
<td><a href="c2isetix.htm"><img src="images/navidx.gif" width="84" height="23"
border="0" alt="INDEX"> </a></td>
</tr>
</table>
<font size=1 face="Verdana, Arial, Helvetica, sans-serif"> © 1997, 2001, 2002, 2003 STMicroelectronics. All Rights Reserved.<br>
ADCS 7301761C</font>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -