diff --git a/src/x86_64/getcontext.S b/src/x86_64/getcontext.S index 48a52d05..f6fe6ddb 100644 --- a/src/x86_64/getcontext.S +++ b/src/x86_64/getcontext.S @@ -58,7 +58,9 @@ _Ux86_64_getcontext: /* Save fp state (not needed, except for setcontext not restoring garbage). */ leaq UC_MCONTEXT_FPREGS_MEM(%rdi),%r8 +#ifdef UC_MCONTEXT_FPREGS_PTR movq %r8, UC_MCONTEXT_FPREGS_PTR(%rdi) +#endif // UC_MCONTEXT_FPREGS_PTR fnstenv (%r8) stmxcsr FPREGS_OFFSET_MXCSR(%r8) diff --git a/src/x86_64/setcontext.S b/src/x86_64/setcontext.S index 6b06a7bb..e1455d45 100644 --- a/src/x86_64/setcontext.S +++ b/src/x86_64/setcontext.S @@ -37,7 +37,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ _Ux86_64_setcontext: /* restore fp state */ + // TODO: why not just use leaq? +#ifdef UC_MCONTEXT_FPREGS_PTR mov UC_MCONTEXT_FPREGS_PTR(%rdi),%r8 +#else // UC_MCONTEXT_FPREGS_PTR + leaq UC_MCONTEXT_FPREGS_MEM(%rdi),%r8 +#endif // UC_MCONTEXT_FPREGS_PTR fldenv (%r8) ldmxcsr FPREGS_OFFSET_MXCSR(%r8)