Changeset 9556
- Timestamp:
- May 20, 2008, 2:26:07 AM (17 years ago)
- File:
-
- 1 edited
-
branches/win64/lisp-kernel/thread_manager.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/win64/lisp-kernel/thread_manager.c
r9319 r9556 53 53 54 54 #ifdef WINDOWS 55 extern pc spentry_start, spentry_end,subprims_start,subprims_end; 56 extern pc restore_win64_context_start, restore_win64_context_end, 57 restore_win64_context_load_rcx, restore_win64_context_iret; 58 59 extern void interrupt_handler(int, siginfo_t *, ExceptionInformation *); 60 55 61 int 56 62 raise_thread_interrupt(TCR *target) 57 63 { 58 } 64 /* GCC doesn't align CONTEXT corrcectly */ 65 char _contextbuf[sizeof(CONTEXT)+__alignof(CONTEXT)]; 66 CONTEXT *pcontext; 67 HANDLE hthread = (HANDLE)(target->osid); 68 pc where; 69 area *cs = target->cs_area, *ts = target->cs_area; 70 DWORD rc; 71 72 pcontext = (CONTEXT *)((((natural)&_contextbuf)+15)&~15); 73 rc = SuspendThread(hthread); 74 if (rc == -1) { 75 return -1; 76 } 77 /* What if the suspend count is > 1 at this point ? I don't think 78 that that matters, but I'm not sure */ 79 pcontext->ContextFlags = CONTEXT_ALL; 80 rc = GetThreadContext(hthread, pcontext); 81 if (rc == 0) { 82 wperror("GetThreadContext"); 83 } 84 where = (pc)(xpPC(pcontext)); 85 86 if ((target->valence != TCR_STATE_LISP) || 87 (TCR_INTERRUPT_LEVEL(target) < 0) || 88 (target->unwinding != 0) || 89 (!((where < (pc)lisp_global(HEAP_END)) && 90 (where >= (pc)lisp_global(HEAP_START))) && 91 !((where < spentry_end) && (where >= spentry_start)) && 92 !((where < subprims_end) && (where >= subprims_start)) && 93 !((where < (pc) 0x16000) && 94 (where >= (pc) 0x15000)) && 95 !((where < (pc) (ts->high)) && 96 (where >= (pc) (ts->low))))) { 97 /* If the thread's in a blocking syscall, it'd be nice to 98 get it out of that state here. */ 99 target->interrupt_pending = (1LL << (nbits_in_word - 1LL)); 100 ResumeThread(hthread); 101 return 0; 102 } else { 103 /* Thread is running lisp code with interupts enabled. Set it 104 so that it calls out and then returns to the context, 105 handling any necessary pc-lusering. */ 106 LispObj foreign_rsp = (((LispObj)(target->foreign_sp))-128)&~15; 107 CONTEXT *icontext = ((CONTEXT *) foreign_rsp) -1; 108 icontext = (CONTEXT *)(((LispObj)icontext)&~15); 109 110 *icontext = *pcontext; 111 112 xpGPR(pcontext,REG_RCX) = SIGNAL_FOR_PROCESS_INTERRUPT; 113 xpGPR(pcontext,REG_RDX) = 0; 114 xpGPR(pcontext,REG_R8) = (LispObj) icontext; 115 xpGPR(pcontext,REG_RSP) = ((LispObj *)icontext)-1; 116 *(((LispObj *)icontext)-1) = (LispObj)raise_thread_interrupt; 117 xpPC(pcontext) = (pc)interrupt_handler; 118 SetThreadContext(hthread,pcontext); 119 ResumeThread(hthread); 120 return 0; 121 } 122 } 123 59 124 #else 60 125 int … … 654 719 tsd_get(LispObj key) 655 720 { 656 TlsGetValue((DWORD)key);721 return TlsGetValue((DWORD)key); 657 722 } 658 723 #else … … 1135 1200 tcr_cleanup(tcr); 1136 1201 #endif 1137 1202 return NULL; 1138 1203 } 1139 1204 … … 1181 1246 xDisposeThread(TCR *tcr) 1182 1247 { 1248 return 0; /* I don't think that this is ever called. */ 1183 1249 } 1184 1250 #else … … 1320 1386 1321 1387 #ifdef WINDOWS 1322 extern pc spentry_start, spentry_end,subprims_start,subprims_end;1323 extern pc restore_win64_context_start, restore_win64_context_end,1324 restore_win64_context_load_rcx, restore_win64_context_iret;1325 1388 1326 1389 Boolean
Note:
See TracChangeset
for help on using the changeset viewer.
