From ee32be6651a09862742f30c32653ab10cd04ac27 Mon Sep 17 00:00:00 2001 From: Alexander Esilevich Date: Fri, 30 Jul 2010 22:22:49 +0700 Subject: [PATCH] UC_MCONTEXT_FPREGS_PTR is made optional --- src/x86_64/getcontext.S | 2 ++ src/x86_64/setcontext.S | 5 +++++ 2 files changed, 7 insertions(+) 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)