X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fwin32-os.c;h=0073c60d3f0fb6f9a0819d1cc6062bea3c35c336;hb=e0f344219fe6cd5329aae9fc343466bcd71d4edf;hp=0f2cd291905f24b7f0a4f7b33bd051e6be4167ea;hpb=48ec282d877900caf5ea4ab42e9d87e566ce6b43;p=sbcl.git diff --git a/src/runtime/win32-os.c b/src/runtime/win32-os.c index 0f2cd29..0073c60 100644 --- a/src/runtime/win32-os.c +++ b/src/runtime/win32-os.c @@ -38,6 +38,7 @@ #include "interrupt.h" #include "interr.h" #include "lispregs.h" +#include "runtime.h" #include "monitor.h" #include "alloc.h" #include "genesis/primitive-objects.h" @@ -413,7 +414,12 @@ EXCEPTION_DISPOSITION handle_exception(EXCEPTION_RECORD *exception_record, return sigtrap_emulator(context, exception_frame); } else if (exception_record->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && - is_valid_lisp_addr(fault_address)) { + (is_valid_lisp_addr(fault_address) || + /* the linkage table does not contain valid lisp + * objects, but is also committed on-demand here + */ + in_range_p(fault_address, LINKAGE_TABLE_SPACE_START, + LINKAGE_TABLE_SPACE_END))) { /* Pick off GC-related memory fault next. */ MEMORY_BASIC_INFORMATION mem_info; @@ -624,6 +630,34 @@ void scratch(void) mkdir(0); isatty(0); access(0,0); + GetLastError(); + FormatMessageA(0, 0, 0, 0, 0, 0, 0); + _get_osfhandle(0); + ReadFile(0, 0, 0, 0, 0); + WriteFile(0, 0, 0, 0, 0); + PeekNamedPipe(0, 0, 0, 0, 0, 0); + FlushConsoleInputBuffer(0); + PeekConsoleInput(0, 0, 0, 0); + Sleep(0); + GetACP(); + GetOEMCP(); + GetConsoleCP(); + GetConsoleOutputCP(); +} + +char * +os_get_runtime_executable_path() +{ + char path[MAX_PATH + 1]; + DWORD bufsize = sizeof(path); + DWORD size; + + if ((size = GetModuleFileNameA(NULL, path, bufsize)) == 0) + return NULL; + else if (size == bufsize && GetLastError() == ERROR_INSUFFICIENT_BUFFER) + return NULL; + + return copied_string(path); } /* EOF */