Changeset 896
- Timestamp:
- Oct 26, 2004, 11:56:15 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ccl/lisp-kernel/lisp-exceptions.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/lisp-kernel/lisp-exceptions.c
r894 r896 1550 1550 tcr->save_vsp = (LispObj*) ptr_from_lispobj(xpGPR(xp, vsp)); 1551 1551 tcr->save_tsp = (LispObj*) ptr_from_lispobj(xpGPR(xp, tsp)); 1552 1552 1553 enable_fp_exceptions(); 1553 1554 1554 1555 … … 2031 2032 old_valence = prepare_to_wait_for_exception_lock(tcr, context); 2032 2033 wait_for_exception_lock_in_handler(tcr, context, &xframe_link); 2033 #ifdef DARWIN2034 enable_fp_exceptions();2035 #endif2036 2034 PMCL_exception_handler(signum, context, tcr, info); 2037 2035 unlock_exception_lock_in_handler(tcr); … … 2042 2040 } 2043 2041 #ifdef DARWIN 2044 DarwinSigReturn(context); 2042 /* 2043 No, I'm not proud of this. 2044 We have to use DarwinSigReturn to work around an OSX G5 bug. 2045 To make matters worse, Darwin loses track of the MSR[FE0,FE1] 2046 bits in a thread's context when it receives a signal via 2047 pthread_kill. We can at least fix it in this case by returning 2048 to code which uses a UUO to set the MSR[FE0,FE1] bits, and 2049 make the handler for -that- UUO return to the real address that 2050 was interrupted via pthread_kill. 2051 2052 I'm so ashamed. 2053 */ 2054 { 2055 2056 lisp_frame *cur_frame = ((lisp_frame *)xpGPR(context,sp)), 2057 *new_frame = cur_frame-1; 2058 xpGPR(context,sp) = (LispObj)new_frame; 2059 new_frame->backlink = cur_frame; 2060 new_frame->savevsp=0; 2061 new_frame->savefn=0; 2062 new_frame->savelr = (LispObj)xpPC(context); 2063 xpPC(context) = (LispObj *)enable_fp_exceptions; 2064 DarwinSigReturn(context); 2065 } 2045 2066 #endif 2046 2067 } … … 2437 2458 ts.srr1 &= ~MSR_FE0_FE1_MASK; 2438 2459 } 2439 ts.srr0 += 4; 2460 /* 2461 Hack-o-rama warning (isn't it about time for such a warning?): 2462 pthread_kill() seems to want to lose the MSR's FE0/FE1 bits. 2463 Our handler for lisp's use of pthread_kill() pushes a phony 2464 lisp frame on the stack and force the context to resume at 2465 the UUO in enable_fp_exceptions(); the "saveLR" field of that 2466 lisp frame contains the -real- address that process_interrupt 2467 should have returned to, and the fact that it's in a lisp 2468 frame should convince the GC to notice that address if it 2469 runs in the tiny time window between returning from our 2470 interrupt handler and ... here. 2471 If the top frame on the stack is a lisp frame, discard it 2472 and set ts.srr0 to the saveLR field in that frame. Otherwise, 2473 just adjust ts.srr0 to skip over the UUO. 2474 */ 2475 { 2476 lisp_frame *tos = (lisp_frame *)ts.r1, 2477 *next_frame = tos->backlink; 2478 2479 if (tos == (next_frame -1)) { 2480 ts.srr0 = tos->savelr; 2481 ts.r1 = (LispObj) next_frame; 2482 } else { 2483 ts.srr0 += 4; 2484 } 2485 } 2440 2486 thread_set_state(thread, 2441 2487 MACHINE_THREAD_STATE,
Note:
See TracChangeset
for help on using the changeset viewer.
