0.7.4.18: Fixing Alpha fixes
authorDaniel Barlow <dan@telent.net>
Fri, 7 Jun 2002 11:30:46 +0000 (11:30 +0000)
committerDaniel Barlow <dan@telent.net>
Fri, 7 Jun 2002 11:30:46 +0000 (11:30 +0000)
        Check in the _extra_ files needed for OSF/1
Disable PRINTNOISE in gc.c

src/code/osf1-os.lisp [new file with mode: 0644]
src/runtime/Config.alpha-osf1 [new file with mode: 0644]
src/runtime/alpha-osf1-os.c [new file with mode: 0644]
src/runtime/alpha-osf1-os.h [new file with mode: 0644]
src/runtime/gc.c
src/runtime/osf1-os.c [new file with mode: 0644]
src/runtime/osf1-os.h [new file with mode: 0644]
version.lisp-expr

diff --git a/src/code/osf1-os.lisp b/src/code/osf1-os.lisp
new file mode 100644 (file)
index 0000000..496e6b2
--- /dev/null
@@ -0,0 +1,64 @@
+;;;; OS interface functions for CMU CL under OSF/1
+
+;;;; This software is part of the SBCL system. See the README file for
+;;;; more information.
+;;;;
+;;;; This software is derived from the CMU CL system, which was
+;;;; written at Carnegie Mellon University and released into the
+;;;; public domain. The software is in the public domain and is
+;;;; provided with absolutely no warranty. See the COPYING and CREDITS
+;;;; files for more information.
+
+(in-package "SB!SYS")
+
+;;; Check that target machine features are set up consistently with
+;;; this file.
+#!-osf1 (error "missing :OSF1 feature")
+
+(defun software-type ()
+  #!+sb-doc
+  "Return a string describing the supporting software."
+  (values "OSF/1"))
+
+(defvar *software-version* nil)
+
+(defun software-version ()
+  #!+sb-doc
+  "Return a string describing version of the supporting software, or NIL
+  if not available."
+  (or *software-version*
+      (setf *software-version*
+           (string-trim '(#\newline)
+                        (with-output-to-string (stream)
+                          (sb!ext:run-program "/bin/uname" `("-r")
+                                              :output stream))))))
+
+(defun os-cold-init-or-reinit () ; KLUDGE: don't know what to do here
+  (/show "entering osf1-os.lisp OS-COLD-INIT-OR-REINIT")
+  (setf *software-version* nil)
+  (/show "setting *DEFAULT-PATHNAME-DEFAULTS*")
+  (setf *default-pathname-defaults*
+       ;; (temporary value, so that #'PATHNAME won't blow up when
+       ;; we call it below:)
+       (make-trivial-default-pathname)
+       *default-pathname-defaults*
+       ;; (final value, constructed using #'PATHNAME:)
+       (pathname (sb!unix:posix-getcwd/)))
+  (/show "leaving osf1-os.lisp OS-COLD-INIT-OR-REINIT"))
+
+;;; Return system time, user time and number of page faults.
+(defun get-system-info ()
+  (multiple-value-bind
+      (err? utime stime maxrss ixrss idrss isrss minflt majflt)
+      (sb!unix:unix-getrusage sb!unix:rusage_self)
+    (declare (ignore maxrss ixrss idrss isrss minflt))
+    (unless err? ; FIXME: nonmnemonic (reversed) name for ERR?
+      (error "Unix system call getrusage failed: ~A." (strerror utime)))
+    (values utime stime majflt)))
+
+;;; Return the system page size.
+(defun get-page-size ()
+  ;; probably should call getpagesize()
+  ;; FIXME: Or we could just get rid of this, since the uses of it look
+  ;; disposable.
+  4096)
diff --git a/src/runtime/Config.alpha-osf1 b/src/runtime/Config.alpha-osf1
new file mode 100644 (file)
index 0000000..02c8e14
--- /dev/null
@@ -0,0 +1,30 @@
+# This software is part of the SBCL system. See the README file for
+# more information.
+#
+# This software is derived from the CMU CL system, which was
+# written at Carnegie Mellon University and released into the
+# public domain. The software is in the public domain and is
+# provided with absolutely no warranty. See the COPYING and CREDITS
+# files for more information.
+
+CFLAGS += -Dalpha -Dosf1 -O0 -g -D_XOPEN_SOURCE=500 -D_OSF_SOURCE=500
+ASFLAGS += -Dalpha -Dosf1 #-ULANGUAGE_ASSEMBLY
+LD = ld -taso 
+LINKFLAGS = -non_shared # dynamic -v -g  -Wl,-T  -Wl,ld-script.alpha-linux
+NM = nm -B
+
+ASSEM_SRC = alpha-assem.s # ldso-stubs.s
+ARCH_SRC = alpha-arch.c undefineds.c
+
+# cancel gnumake's builtin rule for .S files, because digital's cc doesn't
+# know what to do with them
+%.o: %.S
+
+# copy .S files to .s, because digital cc does know what to do with _those_
+%.s:%.S
+       cp $^ $@
+
+OS_SRC = osf1-os.c  alpha-osf1-os.c os-common.c 
+OS_LIBS= #-ldl
+
+GC_SRC= gc.c
diff --git a/src/runtime/alpha-osf1-os.c b/src/runtime/alpha-osf1-os.c
new file mode 100644 (file)
index 0000000..8610500
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * This is the Compaq/Digital Alpha Linux incarnation of
+ * arch-dependent OS-dependent routines. See also "linux-os.c".  */
+
+/*
+ * This software is part of the SBCL system. See the README file for
+ * more information.
+ *
+ * This software is derived from the CMU CL system, which was
+ * written at Carnegie Mellon University and released into the
+ * public domain. The software is in the public domain and is
+ * provided with absolutely no warranty. See the COPYING and CREDITS
+ * files for more information.
+ */
+
+/* Some of these header files may be redundant. -- Dan Barlow
+ * ca. 2001-05-01 */
+
+#include <stdio.h>
+#include <sys/param.h>
+#include <sys/file.h>
+#include "./signal.h"
+#include "os.h"
+#include "arch.h"
+#include "globals.h"
+#include "interrupt.h"
+#include "interr.h"
+#include "lispregs.h"
+#include "sbcl.h"
+#include <sys/socket.h>
+#include <sys/utsname.h>
+
+#include <sys/types.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <c_asm.h>
+#include <ucontext.h>
+
+#include "validate.h"
+size_t os_vm_page_size;
+
+#if defined GENCGC             /* unlikely ... */
+#error SBCL Alpha does not work with the GENCGC
+#include "gencgc.h"
+#endif
+
+os_context_register_t   *
+os_context_register_addr(os_context_t *context, int offset)
+{
+    return &context->uc_mcontext.sc_regs[offset];
+}
+
+os_context_register_t *
+os_context_float_register_addr(os_context_t *context, int offset)
+{
+    return &context->uc_mcontext.sc_fpregs[offset];
+}
+
+os_context_register_t *
+os_context_pc_addr(os_context_t *context)
+{
+    return &((context->uc_mcontext).sc_pc);
+}
+
+sigset_t *
+os_context_sigmask_addr(os_context_t *context)
+{
+    return &context->uc_sigmask;
+}
+
+unsigned long
+os_context_fp_control(os_context_t *context)
+{
+    return 0; /* FIXME */
+    /* ieee_fpcr_to_swcr((context->uc_mcontext).sc_fpcr); */
+}
+
+
+void os_flush_icache(os_vm_address_t address, os_vm_size_t length)
+{
+#ifdef __GNUC__
+    asm volatile ("imb" : : : "memory" ); 
+#else
+    /* digital CC has different syntax */
+    asm("imb");
+#endif
+}
diff --git a/src/runtime/alpha-osf1-os.h b/src/runtime/alpha-osf1-os.h
new file mode 100644 (file)
index 0000000..3f52c30
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef _ALPHA_OSF1_OS_H
+#define _ALPHA_OSF1_OS_H
+
+typedef struct ucontext os_context_t;
+
+static inline os_context_t *arch_os_get_context(void **void_context) {
+  return (os_context_t *) *void_context;
+}
+
+#endif /* _ALPHA_OSF1_OS_H */
index 482cf65..693eb95 100644 (file)
@@ -28,8 +28,8 @@
 #include "interr.h"
 
 /* So you need to debug? */
-#define PRINTNOISE
 #if 0
+#define PRINTNOISE
 #define DEBUG_SPACE_PREDICATES
 #define DEBUG_SCAVENGE_VERBOSE
 #define DEBUG_COPY_VERBOSE
diff --git a/src/runtime/osf1-os.c b/src/runtime/osf1-os.c
new file mode 100644 (file)
index 0000000..c3aa9fc
--- /dev/null
@@ -0,0 +1,157 @@
+/*
+ * This file (along with os.h) exports an OS-independent interface to
+ * the operating system VM facilities. Surprise surprise, this
+ * interface looks a lot like the Mach interface (but simpler in some
+ * places). For some operating systems, a subset of these functions
+ * will have to be emulated.
+ * 
+ * This is the OSF/1 version, based on the Linux version, itself based
+ * on the OSF1 version from CMUCL by Sean Hallgren.  Now _there's_ 
+ * a metacircularity for you ...
+ */
+
+/*
+ * This software is part of the SBCL system. See the README file for
+ * more information.
+ *
+ * This software is derived from the CMU CL system, which was
+ * written at Carnegie Mellon University and released into the
+ * public domain. The software is in the public domain and is
+ * provided with absolutely no warranty. See the COPYING and CREDITS
+ * files for more information.
+ */
+
+#include <stdio.h>
+#include <sys/param.h>
+#include <sys/file.h>
+#include "./signal.h"
+#include "os.h"
+#include "arch.h"
+#include "globals.h"
+#include "interrupt.h"
+#include "interr.h"
+#include "lispregs.h"
+#include "sbcl.h"
+#include <sys/socket.h>
+#include <sys/utsname.h>
+#include <errno.h>
+#include <sys/sysinfo.h>
+#include <sys/proc.h>
+#include <sys/mman.h>
+#include <machine/hal_sysinfo.h>
+
+#include <sys/types.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "validate.h"
+size_t os_vm_page_size;
+
+#if defined GENCGC
+#include "gencgc.h"
+#endif
+\f
+
+void os_init(void)
+{
+
+    os_vm_page_size = getpagesize();
+
+}
+
+
+os_vm_address_t
+os_validate(os_vm_address_t addr, os_vm_size_t len)
+{
+    int flags = MAP_PRIVATE|MAP_ANONYMOUS;
+    if (addr) flags |= MAP_FIXED;
+    else  flags |= MAP_VARIABLE;
+
+    if((addr=mmap(addr,len,OS_VM_PROT_ALL,flags,-1,0)) == (os_vm_address_t) -1)
+       perror("mmap");
+    
+    return addr;
+}
+
+void
+os_invalidate(os_vm_address_t addr, os_vm_size_t len)
+{
+    if (munmap(addr,len) == -1) {
+       perror("munmap");
+    }
+}
+
+os_vm_address_t
+os_map(int fd, int offset, os_vm_address_t addr, os_vm_size_t len)
+{
+    addr = mmap(addr, len,
+               OS_VM_PROT_ALL,
+               MAP_PRIVATE | MAP_FILE | MAP_FIXED,
+               fd, (off_t) offset);
+
+    if (addr == MAP_FAILED) {
+       perror("mmap");
+       lose("unexpected mmap(..) failure");
+    }
+
+    return addr;
+}
+
+void
+os_protect(os_vm_address_t address, os_vm_size_t length, os_vm_prot_t prot)
+{
+    if (mprotect(address, length, prot) == -1) {
+       perror("mprotect");
+    }
+}
+
+boolean
+is_valid_lisp_addr(os_vm_address_t addr)
+{
+    int ret;
+    os_vm_address_t newaddr;
+    newaddr=os_trunc_to_page(addr);
+    if((ret=mvalid(newaddr,newaddr-addr+4,OS_VM_PROT_ALL)) == 0)
+       return TRUE;
+    else if(errno==EINVAL)
+       perror("mvalid");
+    return FALSE;
+}
+\f
+/*
+ * any OS-dependent special low-level handling for signals
+ */
+
+
+static void
+sigsegv_handler(int signal, siginfo_t *info, void* void_context)
+{
+    os_context_t *context = arch_os_get_context(&void_context);
+
+    os_vm_address_t addr = arch_get_bad_addr(signal,info,context);
+    
+    if (addr != NULL &&        
+       *os_context_register_addr(context,reg_ALLOC) & (1L<<63)){
+       /* this is lifted from linux-os.c, so violates OOAO */
+       *os_context_register_addr(context,reg_ALLOC) -= (1L<<63);
+       interrupt_handle_pending(context);
+    } else if(((addr>=DYNAMIC_0_SPACE_END) && (addr<DYNAMIC_1_SPACE_START)) ||
+             ((addr>=DYNAMIC_1_SPACE_END) && (addr<CONTROL_STACK_START))){
+       /* there's empty gap between these spaces.  This clause needs
+          review if the spaces are ever juggled to make this untrue */
+       fprintf(stderr, "bad address 0x%p\n",addr);
+       lose("ran off end of dynamic space");
+    } else if (!interrupt_maybe_gc(signal, info, context)) {
+       interrupt_handle_now(signal, info, context);
+    }
+}
+
+
+void
+os_install_interrupt_handlers(void)
+{
+    undoably_install_low_level_interrupt_handler(SIGSEGV, sigsegv_handler);
+}
+
diff --git a/src/runtime/osf1-os.h b/src/runtime/osf1-os.h
new file mode 100644 (file)
index 0000000..b82e313
--- /dev/null
@@ -0,0 +1,19 @@
+#include <sys/types.h>
+#include <sys/mman.h>
+#include "target-arch-os.h"
+#include "target-arch.h"
+
+typedef caddr_t os_vm_address_t;
+typedef size_t os_vm_size_t;
+typedef off_t os_vm_offset_t;
+typedef int os_vm_prot_t;
+
+#define OS_VM_PROT_READ PROT_READ
+#define OS_VM_PROT_WRITE PROT_WRITE
+#define OS_VM_PROT_EXECUTE PROT_EXEC
+
+typedef long os_context_register_t ;
+
+#ifndef NSIG                   /* osf1 -D_XOPEN_SOURCE_EXTENDED omits this */
+#define NSIG (SIGMAX+1)
+#endif
index 0e10092..003bd24 100644 (file)
@@ -18,4 +18,4 @@
 ;;; for internal versions, especially for internal versions off the
 ;;; main CVS branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
 
-"0.7.4.17"
+"0.7.4.18"