Changeset 13433
- Timestamp:
- Feb 6, 2010, 4:28:32 AM (11 years ago)
- Location:
- release/1.4/source/lisp-kernel
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
release/1.4/source/lisp-kernel/Threads.h
r13075 r13433 183 183 184 184 185 LispObjcreate_system_thread(size_t stack_size,185 Boolean create_system_thread(size_t stack_size, 186 186 void* stackaddr, 187 187 #ifdef WINDOWS -
release/1.4/source/lisp-kernel/area.h
r13075 r13433 123 123 #define MIN_VSTACK_SIZE (1<<16) 124 124 #define VSTACK_HARDPROT (1<<12) 125 #ifdef PPC 125 126 #define VSTACK_SOFTPROT (1<<16) 127 #else 128 #define VSTACK_SOFTPROT CSTACK_SOFTPROT 129 #endif 126 130 #define MIN_TSTACK_SIZE (1<<18) 127 131 #define TSTACK_HARDPROT 0 -
release/1.4/source/lisp-kernel/memory.c
r13075 r13433 313 313 } 314 314 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. */ 315 319 int 316 320 UnMapMemory(LogicalAddress addr, natural nbytes) … … 320 324 #endif 321 325 #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); 324 327 #else 325 328 return munmap(addr, nbytes); … … 457 460 } 458 461 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 485 464 486 465 protected_area_ptr … … 556 535 if (n && ! p->nprot) { 557 536 ProtectMemory(start, n); 537 #ifdef WINDOWS 538 VirtualAlloc(start+n-page_size,page_size,MEM_COMMIT,PAGE_READWRITE|PAGE_GUARD); 539 #endif 558 540 p->nprot = n; 559 541 } … … 949 931 { 950 932 area *a = readonly_area; 951 Un MapMemory(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)); 952 934 a->active = a->low; 953 935 a->ndnodes = 0; -
release/1.4/source/lisp-kernel/thread_manager.c
r13112 r13433 1426 1426 free(tcr->tlb_pointer); 1427 1427 tcr->tlb_pointer = NULL; 1428 #ifdef WINDOWS 1429 if (tcr->osid != 0) { 1430 CloseHandle((HANDLE)(tcr->osid)); 1431 } 1432 #endif 1428 1433 tcr->osid = 0; 1429 1434 tcr->interrupt_pending = 0; … … 1820 1825 1821 1826 #ifdef WINDOWS 1822 LispObj 1827 Boolean 1823 1828 create_system_thread(size_t stack_size, 1824 1829 void* stackaddr, … … 1827 1832 { 1828 1833 HANDLE thread_handle; 1834 Boolean won = false; 1829 1835 1830 1836 stack_size = ((stack_size+(((1<<16)-1)))&~((1<<16)-1)); 1831 1837 1832 1838 thread_handle = (HANDLE)_beginthreadex(NULL, 1833 0/*stack_size*/,1839 stack_size, 1834 1840 start_routine, 1835 1841 param, … … 1839 1845 if (thread_handle == NULL) { 1840 1846 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 1854 Boolean 1846 1855 create_system_thread(size_t stack_size, 1847 1856 void* stackaddr, … … 1887 1896 UNLOCK(lisp_global(TCR_AREA_LOCK),current); 1888 1897 pthread_attr_destroy(&attr); 1889 return ( LispObj) ptr_to_lispobj(returned_thread);1898 return (returned_thread != NULL); 1890 1899 } 1891 1900 #endif … … 2127 2136 result = true; 2128 2137 #ifdef WINDOWS 2129 /* What we really want to d e hearis (something like)2138 /* What we really want to do here is (something like) 2130 2139 forcing the thread to run quit_handler(). For now, 2131 mark the TCR as dead and kill th wWindows thread. */2140 mark the TCR as dead and kill the Windows thread. */ 2132 2141 tcr->osid = 0; 2133 2142 if (!TerminateThread((HANDLE)osid, 0)) { 2143 CloseHandle((HANDLE)osid); 2134 2144 result = false; 2135 2145 } else { 2146 CloseHandle((HANDLE)osid); 2136 2147 shutdown_thread_tcr(tcr); 2137 2148 } -
release/1.4/source/lisp-kernel/x86-exceptions.c
r13075 r13433 1836 1836 return SIGILL; 1837 1837 case EXCEPTION_IN_PAGE_ERROR: 1838 case STATUS_GUARD_PAGE_VIOLATION: 1838 1839 return SIGBUS; 1839 1840 default: … … 3658 3659 int err; 3659 3660 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); 3666 3662 if (err != 0) 3667 3663 Fatal("munmap in delete_watched_area", ""); -
release/1.4/source/lisp-kernel/x86-gc.c
r13176 r13433 2786 2786 a->active += n; 2787 2787 memmove(oldfree, ro_base, n); 2788 Un MapMemory((void *)ro_base, n);2788 UnCommitMemory((void *)ro_base, n); 2789 2789 a->ndnodes = area_dnode(a, a->active); 2790 2790 pure_space_active = r->active = r->low;
Note: See TracChangeset
for help on using the changeset viewer.