Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78064 - trunk/libs/context/doc
From: oliver.kowalke_at_[hidden]
Date: 2012-04-18 09:16:05


Author: olli
Date: 2012-04-18 09:16:04 EDT (Wed, 18 Apr 2012)
New Revision: 78064
URL: http://svn.boost.org/trac/boost/changeset/78064

Log:
context: documentation related to preserving floating-pointer registers

Text files modified:
   trunk/libs/context/doc/rationale.qbk | 66 ++++++++++++++++++++++++++++++++++++++++
   1 files changed, 66 insertions(+), 0 deletions(-)

Modified: trunk/libs/context/doc/rationale.qbk
==============================================================================
--- trunk/libs/context/doc/rationale.qbk (original)
+++ trunk/libs/context/doc/rationale.qbk 2012-04-18 09:16:04 EDT (Wed, 18 Apr 2012)
@@ -7,6 +7,14 @@
 
 [section:rationale Rationale]
 
+[heading No inline-assembler]
+
+Some newer compiler (for instance MSVC 10 for x86_64 and itanium) do not
+support inline assembler.
+[footnote [@http://msdn.microsoft.com/en-us/library/4ks26t93.aspx MSDN article
+'Inline Assembler']].
+
+
 [heading Protecting the stack]
 
 Because the stack's size is fixed -- there is no support for split stacks yet -- it
@@ -85,4 +93,62 @@
 
 [endsect]
 
+
+[section x86 and floating-point env]
+
+[heading i386]
+
+"The FpCsr and the MxCsr register must be saved an restored before any call or return
+by any procedure that needs to modify them ..."
+
+
+[heading x86_64]
+
+[heading Windows]
+
+MxCsr - "A callee that modifies any of the nonvolatile fields within MxCsr must restore
+them before returning to its caller. Furthermore, a caller that has modified any
+of these fields must restore them to their standard values before invoking a callee ..."
+[footnote [@http://http://msdn.microsoft.com/en-us/library/yxty7t75.aspx MSDN article
+'MxCsr']].
+
+FpCsr - "A callee that modifies any of the fields within FpCsr must restore them before
+returning to its caller. Furthermore, a caller that has modified any of these
+fields must restore them to their standard values before invoking a callee ..."
+[footnote [@http://http://msdn.microsoft.com/en-us/library/ms235300.aspx MSDN article
+'FpCsr']].
+
+Conclusion: because caller as well as callee preserve FpCsr and MxCsr __start_fcontext__
+and __jump_fcontext__ are not required to preserve FpCsr and MxCsr.
+
+"The MMX and floating-point stack registers (MM0-MM7/ST0-ST7) are preserved across
+context switches. There is no explicit calling convention for these registers."
+[footnote [@http://msdn.microsoft.com/en-us/library/a32tsf7t%28VS.80%29.aspx MSDN article
+'Legacy Floating-Point Support']].
+
+"The 64-bit Microsoft compiler does not use ST(0)-ST(7)/MM0-MM7".
+[footnote [@ 'Calling Conventions', Agner Fog]].
+
+Conclusion: because no explicit calling convetion exists and MS compiler do not use those
+registers __start_fcontext__ and __jump_fcontext__ do not preserve those registers.
+
+"XMM6-XMM15 must be preserved"
+[footnote [@http://msdn.microsoft.com/en-us/library/9z1stfyw%28v=vs.90%29.aspx MSDN
+article 'Register Usage']]
+
+
+[heading SysV]
+
+"The control bits of the MxCsr register are callee-saved (preserved across calls),
+while the status bits are caller-saved (not preserved). The x87 status word register is
+caller-saved, whereas the x87 control word (FpCsr) is callee-saved."
+[footnote [@boost:/libs/context/doc/pdf/x86_64-sysv.pdf SysV ABI AMD64 Architecture
+Processor Supplement Draft Version 0.99.4, 3.2.1]].
+
+Conclusion: FpCsr and MxCsr must be preserved.
+
+
+[endsect]
+
+
 [endsect]


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk