X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fwin32-os.c;h=80a6ed2b1a53a03c722e121abb79bb35fb374d19;hb=f7faed97898dd0e94a18b0d1fca03aaa0fe24ab0;hp=8cdc8320fbbcc3fb5f5abd91396317e18aff0c2a;hpb=a2b7a6a58e894c02cff583d2d7d1b971a53d7c2d;p=sbcl.git diff --git a/src/runtime/win32-os.c b/src/runtime/win32-os.c index 8cdc832..80a6ed2 100644 --- a/src/runtime/win32-os.c +++ b/src/runtime/win32-os.c @@ -161,7 +161,22 @@ os_validate(os_vm_address_t addr, os_vm_size_t len) return 0; } - if ((mem_info.State == MEM_RESERVE) && (mem_info.RegionSize >=len)) return addr; + if ((mem_info.State == MEM_RESERVE) && (mem_info.RegionSize >=len)) { + /* It would be correct to return here. However, support for Wine + * is beneficial, and Wine has a strange behavior in this + * department. It reports all memory below KERNEL32.DLL as + * reserved, but disallows MEM_COMMIT. + * + * Let's work around it: reserve the region we need for a second + * time. The second reservation is documented to fail on normal NT + * family, but it will succeed on Wine if this region is + * actually free. + */ + VirtualAlloc(addr, len, MEM_RESERVE, PAGE_EXECUTE_READWRITE); + /* If it is wine, the second call has succeded, and now the region + * is really reserved. */ + return addr; + } if (mem_info.State == MEM_RESERVE) { fprintf(stderr, "validation of reserved space too short.\n"); @@ -384,7 +399,7 @@ handle_exception(EXCEPTION_RECORD *exception_record, * exception handler if the gc doesn't take the wp violation? */ if (exception_record->ExceptionInformation[0]) { - int index = find_page_index(fault_address); + page_index_t index = find_page_index(fault_address); if ((index != -1) && (page_table[index].write_protected)) { gencgc_handle_wp_violation(fault_address); } @@ -549,6 +564,7 @@ void scratch(void) Sleep(0); WriteFile(0, 0, 0, 0, 0); _get_osfhandle(0); + _rmdir(0); _pipe(0,0,0); access(0,0); close(0); @@ -557,11 +573,17 @@ void scratch(void) strerror(42); write(0, 0, 0); RtlUnwind(0, 0, 0, 0); + MapViewOfFile(0,0,0,0,0); + UnmapViewOfFile(0); + FlushViewOfFile(0,0); #ifndef LISP_FEATURE_SB_UNICODE CreateDirectoryA(0,0); + CreateFileMappingA(0,0,0,0,0,0); + CreateFileA(0,0,0,0,0,0,0); GetComputerNameA(0, 0); GetCurrentDirectoryA(0,0); GetEnvironmentVariableA(0, 0, 0); + GetFileAttributesA(0); GetVersionExA(0); MoveFileA(0,0); SHGetFolderPathA(0, 0, 0, 0, 0); @@ -569,10 +591,13 @@ void scratch(void) SetEnvironmentVariableA(0, 0); #else CreateDirectoryW(0,0); + CreateFileMappingW(0,0,0,0,0,0); + CreateFileW(0,0,0,0,0,0,0); FormatMessageW(0, 0, 0, 0, 0, 0, 0); GetComputerNameW(0, 0); GetCurrentDirectoryW(0,0); GetEnvironmentVariableW(0, 0, 0); + GetFileAttributesW(0); GetVersionExW(0); MoveFileW(0,0); SHGetFolderPathW(0, 0, 0, 0, 0); @@ -582,7 +607,7 @@ void scratch(void) } char * -os_get_runtime_executable_path() +os_get_runtime_executable_path(int external) { char path[MAX_PATH + 1]; DWORD bufsize = sizeof(path);