#include "interrupt.h"
#include "interr.h"
#include "lispregs.h"
+#include "runtime.h"
#include "monitor.h"
#include "alloc.h"
#include "genesis/primitive-objects.h"
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;
return dest;
}
+char *dirname(char *path)
+{
+ static char buf[PATH_MAX + 1];
+ size_t pathlen = strlen(path);
+ int i;
+
+ if (pathlen >= sizeof(buf)) {
+ lose("Pathname too long in dirname.\n");
+ return NULL;
+ }
+
+ strcpy(buf, path);
+ for (i = pathlen; i >= 0; --i) {
+ if (buf[i] == '/' || buf[i] == '\\') {
+ buf[i] = '\0';
+ break;
+ }
+ }
+
+ return buf;
+}
+
/* This is a manually-maintained version of ldso_stubs.S. */
void scratch(void)
dup(0);
LoadLibrary(0);
GetProcAddress(0, 0);
+ FreeLibrary(0);
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 */