Ignore:
Timestamp:
Feb 11, 2009, 1:24:56 AM (11 years ago)
Author:
gb
Message:

Propagate r11710, r11712 to 1.3.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/1.3/source/lisp-kernel/thread_manager.c

    r11623 r11714  
    5050extern pc spentry_start, spentry_end,subprims_start,subprims_end;
    5151extern pc restore_windows_context_start, restore_windows_context_end,
    52   restore_windows_context_load_rcx, restore_windows_context_iret;
     52  restore_windows_context_iret;
     53
    5354
    5455extern void interrupt_handler(int, siginfo_t *, ExceptionInformation *);
     
    6061 
    6162BOOL (*pCancelIoEx)(HANDLE, OVERLAPPED*) = NULL;
    62 
    63   ;
     63BOOL (*pCancelSynchronousIo)(HANDLE) = NULL;
     64
    6465
    6566
     
    118119      }
    119120    }
     121    if (pCancelSynchronousIo) {
     122      pCancelSynchronousIo(hthread);
     123    }
    120124    QueueUserAPC(nullAPC, hthread, 0);
    121125    ResumeThread(hthread);
     
    16171621  lisp_global(TCR_KEY) = TlsAlloc();
    16181622  pCancelIoEx = windows_find_symbol(NULL, "CancelIoEx");
     1623  pCancelSynchronousIo = windows_find_symbol(NULL, "CancelSynchronousIo");
    16191624#else
    16201625  pthread_key_create((pthread_key_t *)&(lisp_global(TCR_KEY)), shutdown_thread_tcr);
     
    18731878
    18741879#ifdef WINDOWS
     1880void *
     1881pc_luser_restore_windows_context(CONTEXT *pcontext, TCR *tcr, pc where)
     1882{
     1883  /* Thread has started to return from an exception. */
     1884  if (where < restore_windows_context_iret) {
     1885    /* In the process of restoring registers; context still in
     1886       %rcx.  Just make our suspend_context be the context
     1887       we're trying to restore, so that we'll resume from
     1888       the suspend in the same context that we're trying to
     1889       restore */
     1890#ifdef WIN_64
     1891    *pcontext = * (CONTEXT *)(pcontext->Rcx);
     1892#else
     1893    *pcontext = * (CONTEXT *)(pcontext->Ecx);
     1894#endif
     1895  } else {
     1896    /* Most of the context has already been restored; fix %rcx
     1897       if need be, then restore ss:rsp, cs:rip, and flags. */
     1898#ifdef WIN_64
     1899    x64_iret_frame *iret_frame = (x64_iret_frame *) (pcontext->Rsp);
     1900
     1901    pcontext->Rip = iret_frame->Rip;
     1902    pcontext->SegCs = (WORD) iret_frame->Cs;
     1903    pcontext->EFlags = (DWORD) iret_frame->Rflags;
     1904    pcontext->Rsp = iret_frame->Rsp;
     1905    pcontext->SegSs = (WORD) iret_frame->Ss;
     1906#else
     1907    ia32_iret_frame *iret_frame = (ia32_iret_frame *) (pcontext->Esp);
     1908
     1909    pcontext->Eip = iret_frame->Eip;
     1910    pcontext->SegCs = (WORD) iret_frame->Cs;
     1911    pcontext->EFlags = (DWORD) iret_frame->EFlags;
     1912    pcontext->Esp += sizeof(ia32_iret_frame);
     1913#endif
     1914  }
     1915  tcr->pending_exception_context = NULL;
     1916}
    18751917
    18761918Boolean
     
    19041946      if ((where >= restore_windows_context_start) &&
    19051947          (where < restore_windows_context_end)) {
    1906         /* Thread has started to return from an exception. */
    1907         if (where < restore_windows_context_load_rcx) {
    1908           /* In the process of restoring registers; context still in
    1909              %rcx.  Just make our suspend_context be the context
    1910              we're trying to restore, so that we'll resume from
    1911              the suspend in the same context that we're trying to
    1912              restore */
    1913 #ifdef WIN_64
    1914           *pcontext = * (CONTEXT *)(pcontext->Rcx);
    1915 #else
    1916           fprintf(dbgout, "missing win32 suspend code, case (1)\n");
    1917 #endif
    1918         } else {
    1919           /* Most of the context has already been restored; fix %rcx
    1920              if need be, then restore ss:rsp, cs:rip, and flags. */
    1921 #ifdef WIN64
    1922           x64_iret_frame *iret_frame = (x64_iret_frame *) (pcontext->Rsp);
    1923           if (where == restore_windows_context_load_rcx) {
    1924             pcontext->Rcx = ((CONTEXT*)(pcontext->Rcx))->Rcx;
    1925           }
    1926           pcontext->Rip = iret_frame->Rip;
    1927           pcontext->SegCs = (WORD) iret_frame->Cs;
    1928           pcontext->EFlags = (DWORD) iret_frame->Rflags;
    1929           pcontext->Rsp = iret_frame->Rsp;
    1930           pcontext->SegSs = (WORD) iret_frame->Ss;
    1931 #else
    1932 #warning need context setup for win32
    1933           fprintf(dbgout, "missing win32 suspend code, case (2)\n");
    1934 #endif
    1935         }
    1936         tcr->suspend_context = NULL;
     1948        pc_luser_restore_windows_context(pcontext, tcr, where);
    19371949      } else {
    19381950        area *ts = tcr->ts_area;
Note: See TracChangeset for help on using the changeset viewer.