Changeset 11714 for release/1.3


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

Propagate r11710, r11712 to 1.3.

Location:
release/1.3/source/lisp-kernel
Files:
4 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;
  • release/1.3/source/lisp-kernel/x86-asmutils32.s

    r11609 r11714  
    198198_exportfn(C(restore_windows_context))
    199199Xrestore_windows_context_start:
     200        __(movl 4(%esp),%ecx)   /* context */
    200201        __(movl 12(%esp),%edx)  /* old valence */
    201202        __(movl 8(%esp),%eax)   /* tcr */
    202203        __(movw tcr.ldt_selector(%eax), %rcontext_reg)
    203         __(movl 4(%esp),%ecx)   /* context */
    204204        __(movl %edx,rcontext(tcr.valence))
    205205        __(movl $0,rcontext(tcr.pending_exception_context))
     
    223223        __(movl win32_context.Eax(%ecx),%eax)
    224224        __(movl win32_context.Esp(%ecx),%esp)
    225         __(pushl win32_context.Eip(%ecx))
    226 Xrestore_windows_context_load_rcx:               
     225        __(pushl win32_context.EFlags(%ecx))
     226        __(pushl %cs)
     227        __(pushl win32_context.Eip(%ecx))       
     228        /* This must be the last thing before the iret, e.g., if we're
     229        interrupted before the iret, the context we're returning to here
     230        is still in %ecx.  If we're interrupted -at- the iret, then
     231        everything but that which the iret will restore has been restored. */
    227232        __(movl win32_context.Ecx(%ecx),%ecx)
    228233Xrestore_windows_context_iret:           
    229         __(ret)
     234        __(iret)
    230235Xrestore_windows_context_end:             
    231236        __(nop)
     
    247252        .globl C(restore_windows_context_start)
    248253        .globl C(restore_windows_context_end)
    249         .globl C(restore_windows_context_load_rcx)
    250254        .globl C(restore_windows_context_iret)
    251255C(restore_windows_context_start):  .long Xrestore_windows_context_start
    252256C(restore_windows_context_end): .long Xrestore_windows_context_end
    253 C(restore_windows_context_load_rcx):  .long Xrestore_windows_context_load_rcx
    254257C(restore_windows_context_iret): .long Xrestore_windows_context_iret
    255258        .text
  • release/1.3/source/lisp-kernel/x86-asmutils64.s

    r11697 r11714  
    265265        __(movq win64_context.R14(%rcx),%r14)
    266266        __(movq win64_context.R15(%rcx),%r15)
    267 Xrestore_windows_context_load_rcx:               
     267        /* This must be the last thing before the iret, e.g., if we're
     268        interrupted before the iret, the context we're returning to here
     269        is still in %rcx.  If we're interrupted -at- the iret, then
     270        everything but that which the iret will restore has been restored. */
    268271        __(movq win64_context.Rcx(%rcx),%rcx)
    269272Xrestore_windows_context_iret:           
     
    284287        .globl C(restore_windows_context_start)
    285288        .globl C(restore_windows_context_end)
    286         .globl C(restore_windows_context_load_rcx)
    287289        .globl C(restore_windows_context_iret)
    288290C(restore_windows_context_start):  .quad Xrestore_windows_context_start
    289291C(restore_windows_context_end): .quad Xrestore_windows_context_end
    290 C(restore_windows_context_load_rcx):  .quad Xrestore_windows_context_load_rcx
    291292C(restore_windows_context_iret): .quad Xrestore_windows_context_iret
    292293        .text
  • release/1.3/source/lisp-kernel/x86-constants32.h

    r11675 r11714  
    484484#define misc_data_offset misc_header_offset + node_size
    485485
     486typedef struct {
     487  natural Eip;
     488  natural Cs;                   /* in low 16 bits */
     489  natural EFlags;
     490} ia32_iret_frame;
     491
    486492#define heap_segment_size 0x00010000
    487493#define log2_heap_segment_size 16
Note: See TracChangeset for help on using the changeset viewer.