Changeset 14805


Ignore:
Timestamp:
May 20, 2011, 9:59:00 AM (8 years ago)
Author:
gb
Message:

In _SPcallback, save the caller's mxcsr on and restore it from the
stack, not in tcr.foreign_mxcsr. Different callers can legitimately
have different mxcsr values (as long as they save/restore the mxcsr
before changing its value), and we want callbacks to restore the caller's
value (not that of the most recent callback on the thread.)

callback_to_lisp() in the CCL kernel is an example of a C function that
calls into lisp with an atypical value in the mxcsr. It's not clear
that that's a useful value, but callback_to_lisp() saves/restores the
mxcsr before setting it to that value.

Reported problems which are symptoms of the mxcsr getting trashed in
the IDE seem to stem from the fact that callback_to_lisp() invokes a
callback with this atypical mxcsr value when unresolved EEPs are used
from callbacks. We might want to change callback_to_lisp() to not do
that, but the problem is and always has been that callbacks don't
restore the mxcsr that they were called with. The treatment of
the mxcsr by _SPffcall (and the behavior of callback_to_lisp()) just
exposed that problem.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/x86-spentry64.s

    r14629 r14805  
    46174617        __ifndef(`WINDOWS')
    46184618        __endif
     4619        /* Save caller's mxcsr */
     4620        __(subq $16,%rsp)
     4621        __(stmxcsr (%rsp))
     4622        __(andb $~mxcsr_all_exceptions,(%rsp))
    46194623        /* C NVRs   */
    46204624        __(push %csave0)
     
    46854689         __(movq 24(%rsp),%save3)
    46864690        __endif
    4687         __(stmxcsr rcontext(tcr.foreign_mxcsr))
    4688         __(andb $~mxcsr_all_exceptions,rcontext(tcr.foreign_mxcsr))
    46894691        __(ldmxcsr rcontext(tcr.lisp_mxcsr))
    46904692        __(movq $nrs.callbacks,%fname)
     
    47174719        __(pop %csave1)
    47184720        __(pop %csave0)
     4721        __(ldmxcsr (%rsp))
     4722        __(addq $16,%rsp)
    47194723        __(movq -8(%rbp),%rax)
    47204724        __(movq -16(%rbp),%rdx)
Note: See TracChangeset for help on using the changeset viewer.