* files for more information.
*/
-/*
- * $Header$
- */
-
#include <stdio.h>
#include <sys/param.h>
#include <sys/file.h>
#include "arch.h"
#include "globals.h"
#include "interrupt.h"
+#include "interr.h"
#include "lispregs.h"
#include "sbcl.h"
#include "validate.h"
vm_size_t os_vm_page_size;
-#if defined GENCGC
-#include "gencgc.h"
-#endif
/* The different BSD variants have diverged in exactly where they
* store signal context information, but at least they tend to use the
return addr;
}
+/* FIXME: If this can be a no-op on BSD/x86, then it
+ * deserves a more precise name.
+ *
+ * (Perhaps os_prepare_data_area_to_be_executed()?) */
void
os_flush_icache(os_vm_address_t address, os_vm_size_t length)
{
* any OS-dependent special low-level handling for signals
*/
-#if !defined GENCGC
-
-void
-os_install_interrupt_handlers(void)
-{}
-
-#else
+#if defined LISP_FEATURE_GENCGC
/*
* The GENCGC needs to be hooked into whatever signal is raised for
#else
#error unsupported BSD variant
#endif
- if (!gencgc_handle_wp_violation(fault_addr)) {
- interrupt_handle_now(signal, siginfo, void_context);
- }
+ os_context_t *context = arch_os_get_context(&void_context);
+ if (!gencgc_handle_wp_violation(fault_addr))
+ if(!handle_control_stack_guard_triggered(context,fault_addr))
+ /* FIXME is this context or void_context? not that it */
+ /* makes a difference currently except on linux/sparc */
+ interrupt_handle_now(signal, siginfo, void_context);
}
void
os_install_interrupt_handlers(void)
{
-#if defined __FreeBSD__
- interrupt_install_low_level_handler(SIGBUS, memory_fault_handler);
-#elif defined __OpenBSD__
- interrupt_install_low_level_handler(SIGSEGV, memory_fault_handler);
-#else
-#error unsupported BSD variant
-#endif
+ SHOW("os_install_interrupt_handlers()/bsd-os/defined(GENCGC)");
+ undoably_install_low_level_interrupt_handler(SIG_MEMORY_FAULT,
+ memory_fault_handler);
+ SHOW("leaving os_install_interrupt_handlers()");
}
-#endif /* !defined GENCGC */
-\f
-/*
- * stuff to help work with dynamically linked libraries
- */
-
-/* feh!
- *
- * DL_WORKAROUND enables "stubbing" of various functions from libc et
- * al. This is necessary when using dynamic linking in FreeBSD, as the
- * symbols in the dynamic libraries will not have known addresses (in
- * sbcl.nm).
- *
- * FIXME: This flag should be set in Config.bsd */
-#if defined __FreeBSD__
-#define DL_WORKAROUND 1
-#elif defined __OpenBSD__
-/* SBCL doesn't (yet?) work at all with dynamic libs on OpenBSD, so we
- * wouldn't get any use out of these stubs. -- WHN 20001001 */
-#define DL_WORKAROUND 0
#else
-#error unsupported BSD variant
-#endif
-
-#if DL_WORKAROUND
-#include <unistd.h>
-#include <dlfcn.h>
-#include <math.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <time.h>
-#include <sys/resource.h>
-#include <signal.h>
-#include <fcntl.h>
-
-void *ldso_stub__dlopen(const char *path, int mode)
-{
- return dlopen(path, mode);
-}
-
-void *ldso_stub__dlsym(void *handle, const char *symbol)
-{
- return dlsym(handle, symbol);
-}
-
-const char *ldso_stub__dlerror(void)
-{
- return dlerror();
-}
-int ldso_stub__access(const char *path, int mode)
-{
- return access(path, mode);
-}
-
-double ldso_stub__acos(double x)
-{
- return acos(x);
-}
-
-double ldso_stub__acosh(double x)
-{
- return acosh(x);
-}
-
-double ldso_stub__asin(double x)
-{
- return asin(x);
-}
-
-double ldso_stub__asinh(double x)
-{
- return asin(x);
-}
-
-double ldso_stub__atanh(double x)
-{
- return atanh(x);
-}
-
-
-int ldso_stub__chdir(const char *path)
-{
- return chdir(path);
-}
-
-int ldso_stub__close(int d)
-{
- return close(d);
-}
-
-int ldso_stub__closedir(DIR *dirp)
-{
- return closedir(dirp);
-}
-
-double ldso_stub__cosh(double x)
-{
- return cosh(x);
-}
-
-void ldso_stub__exit(int status)
-{
- exit(status);
-}
-
-void ldso_stub__free(void *ptr)
-{
- free(ptr);
-}
-
-int ldso_stub__fstat(int fd, struct stat *sb)
-{
- return fstat(fd, sb);
-}
-
-int ldso_stub__fsync(int fd)
-{
- return fsync(fd);
-}
-
-char *ldso_stub__getenv(const char *name)
-{
- return getenv(name);
-}
-
-int ldso_stub__gethostname(char *name, int namelen)
-{
- return gethostname(name, namelen);
-}
-
-pid_t ldso_stub__getpid(void)
-{
- return getpid();
-}
-
-int ldso_stub__getrusage(int who, struct rusage *rusage)
-{
- return getrusage(who, rusage);
-}
-
-int ldso_stub__gettimeofday(struct timeval *tp, struct timezone *tzp)
-{
- return gettimeofday(tp, tzp);
-}
-
-uid_t ldso_stub__getuid(void)
-{
- return getuid();
-}
-
-char *ldso_stub__getwd(char *buf)
-{
- return getwd(buf);
-}
-
-double ldso_stub__hypot(double x, double y)
-{
- return hypot(x, y);
-}
-
-int ldso_stub__kill(pid_t pid, int sig)
-{
- return kill(pid, sig);
-}
-
-int ldso_stub__killpg(pid_t pgrp, int sig)
-{
- return killpg(pgrp, sig);
-}
-
-off_t ldso_stub__lseek(int fildes, off_t offset, int whence)
-{
- return lseek(fildes, offset, whence);
-}
-
-int ldso_stub__lstat(const char *path, struct stat *sb)
-{
- return lstat(path, sb);
-}
-
-void *ldso_stub__malloc(size_t size)
-{
- return malloc(size);
-}
-
-int ldso_stub__mkdir(const char *path, mode_t mode)
-{
- return mkdir(path, mode);
-}
-
-int ldso_stub__open(const char *path, int flags, mode_t mode)
-{
- return open(path, flags, mode);
-}
-
-DIR *ldso_stub__opendir(const char *filename)
-{
- return opendir(filename);
-}
-
-double ldso_stub__pow(double x, double y)
-{
- return pow(x, y);
-}
-
-ssize_t ldso_stub__read(int d, void *buf, size_t nbytes)
-{
- return read(d, buf, nbytes);
-}
-
-struct dirent *ldso_stub__readdir(DIR *dirp)
-{
- return readdir(dirp);
-}
-
-int ldso_stub__readlink(const char *path, char *buf, int bufsiz)
-{
- return readlink(path, buf, bufsiz);
-}
-
-int ldso_stub__rename(const char *from, const char *to)
-{
- return rename(from, to);
-}
-
-int ldso_stub__select(int nfds, fd_set *readfs, fd_set *writefds,
- fd_set *exceptfds, struct timeval *timeout)
-{
- return select(nfds, readfs, writefds, exceptfds, timeout);
-}
-
-int ldso_stub__sigblock(int mask)
-{
- return sigblock(mask);
-}
-
-int ldso_stub__sigpause(int sigmask)
-{
- return sigpause(sigmask);
-}
-
-int ldso_stub__sigsetmask(int mask)
-{
- return sigsetmask(mask);
-}
-
-double ldso_stub__sinh(double x)
-{
- return sin(x);
-}
-
-int ldso_stub__stat(const char *path, struct stat *sb)
-{
- return stat(path, sb);
-}
-
-double ldso_stub__tanh(double x)
-{
- return tanh(x);
-}
-
-/* tzname */
-
-int ldso_stub__unlink(const char *path)
-{
- return unlink(path);
-}
-
-ssize_t ldso_stub__write(int d, const void *buf, size_t nbytes)
-{
- return write(d, buf, nbytes);
-}
-
-pid_t ldso_stub__wait3(int *status, int options, struct rusage *rusage)
+/* As of 2002.07.31, this configuration has never been tested */
+void
+os_install_interrupt_handlers(void)
{
- return wait3(status, options, rusage);
+ SHOW("os_install_interrupt_handlers()/bsd-os/!defined(GENCGC)");
}
-#endif /* DL_WORKAROUND */
+#endif /* defined GENCGC */