1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>x86 and floating-point env</title> 5<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../index.html" title="Chapter 1. Context"> 8<link rel="up" href="../rationale.html" title="Rationale"> 9<link rel="prev" href="other_apis_.html" title="Other APIs"> 10<link rel="next" href="../reference.html" title="Reference"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="other_apis_.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../rationale.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h3 class="title"> 27<a name="context.rationale.x86_and_floating_point_env"></a><a class="link" href="x86_and_floating_point_env.html" title="x86 and floating-point env">x86 and 28 floating-point env</a> 29</h3></div></div></div> 30<h5> 31<a name="context.rationale.x86_and_floating_point_env.h0"></a> 32 <span class="phrase"><a name="context.rationale.x86_and_floating_point_env.i386"></a></span><a class="link" href="x86_and_floating_point_env.html#context.rationale.x86_and_floating_point_env.i386">i386</a> 33 </h5> 34<p> 35 "The FpCsr and the MxCsr register must be saved and restored before 36 any call or return by any procedure that needs to modify them ..." 37 <a href="#ftn.context.rationale.x86_and_floating_point_env.f0" class="footnote" name="context.rationale.x86_and_floating_point_env.f0"><sup class="footnote">[4]</sup></a>. 38 </p> 39<h5> 40<a name="context.rationale.x86_and_floating_point_env.h1"></a> 41 <span class="phrase"><a name="context.rationale.x86_and_floating_point_env.x86_64"></a></span><a class="link" href="x86_and_floating_point_env.html#context.rationale.x86_and_floating_point_env.x86_64">x86_64</a> 42 </h5> 43<h5> 44<a name="context.rationale.x86_and_floating_point_env.h2"></a> 45 <span class="phrase"><a name="context.rationale.x86_and_floating_point_env.windows"></a></span><a class="link" href="x86_and_floating_point_env.html#context.rationale.x86_and_floating_point_env.windows">Windows</a> 46 </h5> 47<p> 48 MxCsr - "A callee that modifies any of the non-volatile fields within 49 MxCsr must restore them before returning to its caller. Furthermore, a caller 50 that has modified any of these fields must restore them to their standard 51 values before invoking a callee ..." <a href="#ftn.context.rationale.x86_and_floating_point_env.f1" class="footnote" name="context.rationale.x86_and_floating_point_env.f1"><sup class="footnote">[5]</sup></a>. 52 </p> 53<p> 54 FpCsr - "A callee that modifies any of the fields within FpCsr must 55 restore them before returning to its caller. Furthermore, a caller that has 56 modified any of these fields must restore them to their standard values before 57 invoking a callee ..." <a href="#ftn.context.rationale.x86_and_floating_point_env.f2" class="footnote" name="context.rationale.x86_and_floating_point_env.f2"><sup class="footnote">[6]</sup></a>. 58 </p> 59<p> 60 "The MMX and floating-point stack registers (MM0-MM7/ST0-ST7) are preserved 61 across context switches. There is no explicit calling convention for these 62 registers." <a href="#ftn.context.rationale.x86_and_floating_point_env.f3" class="footnote" name="context.rationale.x86_and_floating_point_env.f3"><sup class="footnote">[7]</sup></a>. 63 </p> 64<p> 65 "The 64-bit Microsoft compiler does not use ST(0)-ST(7)/MM0-MM7". 66 <a href="#ftn.context.rationale.x86_and_floating_point_env.f4" class="footnote" name="context.rationale.x86_and_floating_point_env.f4"><sup class="footnote">[8]</sup></a>. 67 </p> 68<p> 69 "XMM6-XMM15 must be preserved" <a href="#ftn.context.rationale.x86_and_floating_point_env.f5" class="footnote" name="context.rationale.x86_and_floating_point_env.f5"><sup class="footnote">[9]</sup></a> 70 </p> 71<h5> 72<a name="context.rationale.x86_and_floating_point_env.h3"></a> 73 <span class="phrase"><a name="context.rationale.x86_and_floating_point_env.sysv"></a></span><a class="link" href="x86_and_floating_point_env.html#context.rationale.x86_and_floating_point_env.sysv">SysV</a> 74 </h5> 75<p> 76 "The control bits of the MxCsr register are callee-saved (preserved 77 across calls), while the status bits are caller-saved (not preserved). The 78 x87 status word register is caller-saved, whereas the x87 control word (FpCsr) 79 is callee-saved." <a href="#ftn.context.rationale.x86_and_floating_point_env.f6" class="footnote" name="context.rationale.x86_and_floating_point_env.f6"><sup class="footnote">[10]</sup></a>. 80 </p> 81<div class="footnotes"> 82<br><hr style="width:100; text-align:left;margin-left: 0"> 83<div id="ftn.context.rationale.x86_and_floating_point_env.f0" class="footnote"><p><a href="#context.rationale.x86_and_floating_point_env.f0" class="para"><sup class="para">[4] </sup></a> 84 'Calling Conventions', Agner Fog 85 </p></div> 86<div id="ftn.context.rationale.x86_and_floating_point_env.f1" class="footnote"><p><a href="#context.rationale.x86_and_floating_point_env.f1" class="para"><sup class="para">[5] </sup></a> 87 <a href="http://http://msdn.microsoft.com/en-us/library/yxty7t75.aspx" target="_top">MSDN 88 article 'MxCsr'</a> 89 </p></div> 90<div id="ftn.context.rationale.x86_and_floating_point_env.f2" class="footnote"><p><a href="#context.rationale.x86_and_floating_point_env.f2" class="para"><sup class="para">[6] </sup></a> 91 <a href="http://http://msdn.microsoft.com/en-us/library/ms235300.aspx" target="_top">MSDN 92 article 'FpCsr'</a> 93 </p></div> 94<div id="ftn.context.rationale.x86_and_floating_point_env.f3" class="footnote"><p><a href="#context.rationale.x86_and_floating_point_env.f3" class="para"><sup class="para">[7] </sup></a> 95 <a href="http://msdn.microsoft.com/en-us/library/a32tsf7t%28VS.80%29.aspx" target="_top">MSDN 96 article 'Legacy Floating-Point Support'</a> 97 </p></div> 98<div id="ftn.context.rationale.x86_and_floating_point_env.f4" class="footnote"><p><a href="#context.rationale.x86_and_floating_point_env.f4" class="para"><sup class="para">[8] </sup></a> 99 'Calling Conventions', Agner Fog 100 </p></div> 101<div id="ftn.context.rationale.x86_and_floating_point_env.f5" class="footnote"><p><a href="#context.rationale.x86_and_floating_point_env.f5" class="para"><sup class="para">[9] </sup></a> 102 <a href="http://msdn.microsoft.com/en-us/library/9z1stfyw%28v=vs.100%29.aspx" target="_top">MSDN 103 article 'Register Usage'</a> 104 </p></div> 105<div id="ftn.context.rationale.x86_and_floating_point_env.f6" class="footnote"><p><a href="#context.rationale.x86_and_floating_point_env.f6" class="para"><sup class="para">[10] </sup></a> 106 SysV ABI AMD64 Architecture Processor Supplement Draft Version 0.99.4, 107 3.2.1 108 </p></div> 109</div> 110</div> 111<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 112<td align="left"></td> 113<td align="right"><div class="copyright-footer">Copyright © 2014 Oliver Kowalke<p> 114 Distributed under the Boost Software License, Version 1.0. (See accompanying 115 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) 116 </p> 117</div></td> 118</tr></table> 119<hr> 120<div class="spirit-nav"> 121<a accesskey="p" href="other_apis_.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../rationale.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 122</div> 123</body> 124</html> 125