Changeset 13433


Ignore:
Timestamp:
Feb 6, 2010, 4:28:32 AM (10 years ago)
Author:
gb
Message:

Basically propagate r13431 to 1.4.

Location:
release/1.4/source/lisp-kernel
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • release/1.4/source/lisp-kernel/Threads.h

    r13075 r13433  
    183183
    184184
    185 LispObj create_system_thread(size_t stack_size,
     185Boolean create_system_thread(size_t stack_size,
    186186                             void* stackaddr,
    187187#ifdef WINDOWS
  • release/1.4/source/lisp-kernel/area.h

    r13075 r13433  
    123123#define MIN_VSTACK_SIZE (1<<16)
    124124#define VSTACK_HARDPROT (1<<12)
     125#ifdef PPC
    125126#define VSTACK_SOFTPROT (1<<16)
     127#else
     128#define VSTACK_SOFTPROT CSTACK_SOFTPROT
     129#endif
    126130#define MIN_TSTACK_SIZE (1<<18)
    127131#define TSTACK_HARDPROT 0
  • release/1.4/source/lisp-kernel/memory.c

    r13075 r13433  
    313313}
    314314
     315
     316/* Cause the mapped memory region at ADDR to become completely unmapped.
     317   ADDR should be an address returned by MapMemoryForStack() or MapMemory(),
     318   and NBYTES should be the size of the mapped region at that address. */
    315319int
    316320UnMapMemory(LogicalAddress addr, natural nbytes)
     
    320324#endif
    321325#ifdef WINDOWS
    322   /* Can't MEM_RELEASE here because we only want to free a chunk */
    323   return VirtualFree(addr, nbytes, MEM_DECOMMIT);
     326  return !VirtualFree(addr, 0, MEM_RELEASE);
    324327#else
    325328  return munmap(addr, nbytes);
     
    457460}
    458461
    459 /*
    460   Un-protect the first nbytes bytes in specified area.
    461   Note that this may cause the area to be empty.
    462 */
    463 void
    464 unprotect_area_prefix(protected_area_ptr area, size_t delta)
    465 {
    466   unprotect_area(area);
    467   area->start += delta;
    468   if ((area->start + area->protsize) <= area->end) {
    469     protect_area(area);
    470   }
    471 }
    472 
    473 
    474 /*
    475   Extend the protected area, causing the preceding nbytes bytes
    476   to be included and protected.
    477 */
    478 void
    479 protect_area_prefix(protected_area_ptr area, size_t delta)
    480 {
    481   unprotect_area(area);
    482   area->start -= delta;
    483   protect_area(area);
    484 }
     462
     463
    485464
    486465protected_area_ptr
     
    556535  if (n && ! p->nprot) {
    557536    ProtectMemory(start, n);
     537#ifdef WINDOWS
     538    VirtualAlloc(start+n-page_size,page_size,MEM_COMMIT,PAGE_READWRITE|PAGE_GUARD);
     539#endif
    558540    p->nprot = n;
    559541  }
     
    949931{
    950932  area *a = readonly_area;
    951   UnMapMemory(a->low,align_to_power_of_2(a->active-a->low, log2_page_size));
     933  UnCommitMemory(a->low,align_to_power_of_2(a->active-a->low, log2_page_size));
    952934  a->active = a->low;
    953935  a->ndnodes = 0;
  • release/1.4/source/lisp-kernel/thread_manager.c

    r13112 r13433  
    14261426    free(tcr->tlb_pointer);
    14271427    tcr->tlb_pointer = NULL;
     1428#ifdef WINDOWS
     1429    if (tcr->osid != 0) {
     1430      CloseHandle((HANDLE)(tcr->osid));
     1431    }
     1432#endif
    14281433    tcr->osid = 0;
    14291434    tcr->interrupt_pending = 0;
     
    18201825
    18211826#ifdef WINDOWS
    1822 LispObj
     1827Boolean
    18231828create_system_thread(size_t stack_size,
    18241829                     void* stackaddr,
     
    18271832{
    18281833  HANDLE thread_handle;
     1834  Boolean won = false;
    18291835
    18301836  stack_size = ((stack_size+(((1<<16)-1)))&~((1<<16)-1));
    18311837
    18321838  thread_handle = (HANDLE)_beginthreadex(NULL,
    1833                                          0/*stack_size*/,
     1839                                         stack_size,
    18341840                                         start_routine,
    18351841                                         param,
     
    18391845  if (thread_handle == NULL) {
    18401846    wperror("CreateThread");
    1841   }
    1842   return (LispObj) ptr_to_lispobj(thread_handle);
    1843 }
    1844 #else
    1845 LispObj
     1847  } else {
     1848    won = true;
     1849    CloseHandle(thread_handle);
     1850  }
     1851  return won;
     1852}
     1853#else
     1854Boolean
    18461855create_system_thread(size_t stack_size,
    18471856                     void* stackaddr,
     
    18871896  UNLOCK(lisp_global(TCR_AREA_LOCK),current);
    18881897  pthread_attr_destroy(&attr);
    1889   return (LispObj) ptr_to_lispobj(returned_thread);
     1898  return (returned_thread != NULL);
    18901899}
    18911900#endif
     
    21272136      result = true;
    21282137#ifdef WINDOWS
    2129       /* What we really want to de hear is (something like)
     2138      /* What we really want to do here is (something like)
    21302139         forcing the thread to run quit_handler().  For now,
    2131          mark the TCR as dead and kill thw Windows thread. */
     2140         mark the TCR as dead and kill the Windows thread. */
    21322141      tcr->osid = 0;
    21332142      if (!TerminateThread((HANDLE)osid, 0)) {
     2143        CloseHandle((HANDLE)osid);
    21342144        result = false;
    21352145      } else {
     2146        CloseHandle((HANDLE)osid);
    21362147        shutdown_thread_tcr(tcr);
    21372148      }
  • release/1.4/source/lisp-kernel/x86-exceptions.c

    r13075 r13433  
    18361836    return SIGILL;
    18371837  case EXCEPTION_IN_PAGE_ERROR:
     1838  case STATUS_GUARD_PAGE_VIOLATION:
    18381839    return SIGBUS;
    18391840  default:
     
    36583659    int err;
    36593660
    3660 /* can't use UnMapMemory() beacuse it only uses MEM_DECOMMIT */
    3661 #ifdef WINDOWS
    3662     err = VirtualFree(base, nbytes, MEM_RELEASE);
    3663 #else
    3664     err = munmap(base, nbytes);
    3665 #endif
     3661    err = UnMapMemory(base, nbytes);
    36663662    if (err != 0)
    36673663      Fatal("munmap in delete_watched_area", "");
  • release/1.4/source/lisp-kernel/x86-gc.c

    r13176 r13433  
    27862786      a->active += n;
    27872787      memmove(oldfree, ro_base, n);
    2788       UnMapMemory((void *)ro_base, n);
     2788      UnCommitMemory((void *)ro_base, n);
    27892789      a->ndnodes = area_dnode(a, a->active);
    27902790      pure_space_active = r->active = r->low;
Note: See TracChangeset for help on using the changeset viewer.