| Home | Libraries | People | FAQ | More

### x86 and floating-point env

##### i386

"The FpCsr and the MxCsr register must be saved and restored before any call or return by any procedure that needs to modify them ..." [4].

##### x86_64

##### Windows

MxCsr - "A callee that modifies any of the non-volatile 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 ..." [5].

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 ..." [6].

"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." [7].

"The 64-bit Microsoft compiler does not use ST(0)-ST(7)/MM0-MM7". [8].

"XMM6-XMM15 must be preserved" [9]

##### 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." [10].

[4] 'Calling Conventions', Agner Fog

[5] MSDN article 'MxCsr'

[6] MSDN article 'FpCsr'

[7] MSDN article 'Legacy Floating-Point Support'

[8] 'Calling Conventions', Agner Fog

[9] MSDN article 'Register Usage'

[10] SysV ABI AMD64 Architecture Processor Supplement Draft Version 0.99.4, 3.2.1