X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fbsd-os.c;h=eaf6e10c7f06cff1c506e4a7e9c2c309c5c08b3f;hb=667ec9d494530079bef28e8589dd0d3274b935ec;hp=bd60796eed2b9f6faf0b4936fd3e004c8f58a611;hpb=3aba91516068375e01ffec0d19bf8cbe85feb828;p=sbcl.git diff --git a/src/runtime/bsd-os.c b/src/runtime/bsd-os.c index bd60796..eaf6e10 100644 --- a/src/runtime/bsd-os.c +++ b/src/runtime/bsd-os.c @@ -18,10 +18,6 @@ * files for more information. */ -/* - * $Header$ - */ - #include #include #include @@ -30,6 +26,7 @@ #include "arch.h" #include "globals.h" #include "interrupt.h" +#include "interr.h" #include "lispregs.h" #include "sbcl.h" @@ -167,6 +164,10 @@ os_map(int fd, int offset, os_vm_address_t addr, os_vm_size_t len) 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) { @@ -194,8 +195,7 @@ is_valid_lisp_addr(os_vm_address_t addr) { return in_range_p(addr, READ_ONLY_SPACE_START, READ_ONLY_SPACE_SIZE) || in_range_p(addr, STATIC_SPACE_START , STATIC_SPACE_SIZE ) - || in_range_p(addr, DYNAMIC_0_SPACE_START, DYNAMIC_SPACE_SIZE ) - || in_range_p(addr, DYNAMIC_1_SPACE_START, DYNAMIC_SPACE_SIZE ) + || in_range_p(addr, DYNAMIC_SPACE_START , DYNAMIC_SPACE_SIZE ) || in_range_p(addr, CONTROL_STACK_START , CONTROL_STACK_SIZE ) || in_range_p(addr, BINDING_STACK_START , BINDING_STACK_SIZE ); } @@ -208,7 +208,9 @@ is_valid_lisp_addr(os_vm_address_t addr) void os_install_interrupt_handlers(void) -{} +{ + SHOW("os_install_interrupt_handlers()/bsd-os/!defined(GENCGC)"); +} #else @@ -235,293 +237,17 @@ memory_fault_handler(int signal, siginfo_t *siginfo, void *void_context) void os_install_interrupt_handlers(void) { + SHOW("os_install_interrupt_handlers()/bsd-os/defined(GENCGC)"); #if defined __FreeBSD__ - interrupt_install_low_level_handler(SIGBUS, memory_fault_handler); + undoably_install_low_level_interrupt_handler(SIGBUS, + memory_fault_handler); #elif defined __OpenBSD__ - interrupt_install_low_level_handler(SIGSEGV, memory_fault_handler); + undoably_install_low_level_interrupt_handler(SIGSEGV, + memory_fault_handler); #else #error unsupported BSD variant #endif + SHOW("leaving os_install_interrupt_handlers()"); } #endif /* !defined GENCGC */ - -/* - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -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) -{ - return wait3(status, options, rusage); -} - -#endif /* DL_WORKAROUND */