0.6.12.16:
authorWilliam Harold Newman <william.newman@airmail.net>
Sun, 27 May 2001 13:02:55 +0000 (13:02 +0000)
committerWilliam Harold Newman <william.newman@airmail.net>
Sun, 27 May 2001 13:02:55 +0000 (13:02 +0000)
made LOAD handle EXTERNAL-FORMAT just the same way as
COMPILE-FILE already did, refusing any value other
than :DEFAULT
removed unused (and deprecated on OpenBSD) setregid/setreuid
stuff
converted "i386" to "__i386__" at various
"egrep 'def.*[^_]i386'" locations
added src/runtime/trymap.c (and noted that trymap fails for
the mapped area which the OpenBSD port uses for its
control stack, so now the mystery is no longer why
the OpenBSD port now complains about memory faults,
but why the OpenBSD port ever worked in the past)

12 files changed:
package-data-list.lisp-expr
src/code/target-load.lisp
src/compiler/fndb.lisp
src/compiler/x86/parms.lisp
src/runtime/.cvsignore
src/runtime/gc.c
src/runtime/interrupt.c
src/runtime/ldso-stubs.S
src/runtime/linux-os.c
src/runtime/trymap.c [new file with mode: 0644]
src/runtime/undefineds.h
version.lisp-expr

index 45e55dd..ee65d18 100644 (file)
@@ -1513,8 +1513,7 @@ no guarantees of interface stability."
              "UNIX-LSTAT" "UNIX-MKDIR" "UNIX-OPEN" "UNIX-PATHNAME" "UNIX-PID"
              "UNIX-PIPE" "UNIX-READ" "UNIX-READLINK" "UNIX-RECV" "UNIX-RENAME"
              "UNIX-RMDIR" "UNIX-SELECT" "UNIX-SEND" "UNIX-SETPGRP"
-             "UNIX-SETREGID" "UNIX-SETREUID" "UNIX-SOCKET" "UNIX-STAT"
-             "UNIX-SYMLINK" "UNIX-SYNC"
+             "UNIX-SOCKET" "UNIX-STAT" "UNIX-SYMLINK" "UNIX-SYNC"
              "UNIX-TIMES" "UNIX-TRUNCATE" "UNIX-TTYNAME"
              "UNIX-UID" "UNIX-UNLINK" "UNIX-UTIMES" "UNIX-WRITE" "WINSIZE"
              "WRITEGRP" "WRITEOTH" "WRITEOWN" "WS-COL" "WS-ROW" "WS-XPIXEL"
index f7eae58..fe2bd03 100644 (file)
 ;;; take effect. If the compiler is loaded, we make the
 ;;; compiler-policy local to LOAD by binding it to itself.
 ;;;
-;;; FIXME: ANSI specifies a &KEY :EXTERNAL-FORMAT argument.
-;;;
 ;;; FIXME: Daniel Barlow's ilsb.tar ILISP-for-SBCL patches contain an
 ;;; implementation of "DEFUN SOURCE-FILE" which claims, in a comment, that CMU
 ;;; CL does not correctly record source file information when LOADing a
             &key
             (verbose *load-verbose*)
             (print *load-print*)
-            (if-does-not-exist t))
+            (if-does-not-exist t)
+            (external-format :default))
   #!+sb-doc
-  "Loads the file given by FILESPEC into the Lisp environment, returning
-   T on success. These options are defined:
-
-   :IF-DOES-NOT-EXIST
-       What should we do if the file can't be located? If true (the
-       default), signal an error. If NIL, simply return NIL.
-
-   :VERBOSE
-       If true, print a line describing each file loaded. The default
-       is *LOAD-VERBOSE*.
-
-   :PRINT
-       If true, print information about loaded values. When loading the
-       source, the result of evaluating each top-level form is printed.
-       The default is *LOAD-PRINT*."
+  "Load the file given by FILESPEC into the Lisp environment, returning
+   T on success."
+  (unless (eq external-format :default)
+    (error "Non-:DEFAULT EXTERNAL-FORMAT values are not supported."))
 
   (let ((*load-depth* (1+ *load-depth*))
        ;; KLUDGE: I can't find in the ANSI spec where it says that
index 703fdb3..584d42b 100644 (file)
    (:verbose t)
    (:print t)
    (:if-does-not-exist (member :error :create nil))
-   ;; FIXME: ANSI specifies an :EXTERNAL-FORMAT keyword too.
-   )
+   (:external-format (member :default)))
   t)
 
 (defknown directory (pathname-designator &key
index af9899a..e342bf8 100644 (file)
 ;;;     stomping on an address range that the dynamic libraries want to use. 
 ;;;     (They want to use this address range even if we try to reserve it
 ;;;     with a call to validate() as the first operation in main().)
-
 #!+linux
 (progn
 
index e2d15f3..0d803f2 100644 (file)
@@ -2,3 +2,4 @@ depend
 sbcl
 sbcl.h
 sbcl.nm
+trymap
index 894f28e..b944ef1 100644 (file)
@@ -921,12 +921,12 @@ trans_return_pc_header(lispobj object)
        return ret;
 }
 
-/* On the 386, closures hold a pointer to the raw address instead of the
-   function object, so we can use CALL [$FDEFN+const] to invoke the function
-   without loading it into a register.  Given that code objects don't move,
-   we don't need to update anything, but we do have to figure out that the
-   function is still live. */
-#ifdef i386
+/* On the 386, closures hold a pointer to the raw address instead of
+ * the function object, so we can use CALL [$FDEFN+const] to invoke
+ * the function without loading it into a register. Given that code
+ * objects don't move, we don't need to update anything, but we do
+ * have to figure out that the function is still live. */
+#ifdef __i386__
 static
 scav_closure_header(where, object)
 lispobj *where, object;
@@ -2102,7 +2102,7 @@ gc_init(void)
        scavtab[type_FunctionHeader] = scav_function_header;
        scavtab[type_ClosureFunctionHeader] = scav_function_header;
        scavtab[type_ReturnPcHeader] = scav_return_pc_header;
-#ifdef i386
+#ifdef __i386__
        scavtab[type_ClosureHeader] = scav_closure_header;
        scavtab[type_FuncallableInstanceHeader] = scav_closure_header;
        scavtab[type_ByteCodeFunction] = scav_closure_header;
index 4dc22af..cb5fcaf 100644 (file)
@@ -592,18 +592,19 @@ uninstall_low_level_interrupt_handlers_atexit(void)
     }
 }
 
-/* Install a special low-level handler for signal; or if handler is
- * SIG_DFL, remove any special handling for signal.
+/* Undoably install a special low-level handler for signal; or if
+ * handler is SIG_DFL, remove any special handling for signal.
  *
- * The "undoably_" part is because we also arrange with atexit() for
- * the handler to be restored to its old value. This is for tidiness,
- * though it shouldn't really matter in normal operation of the
- * program, except perhaps that it removes a window when e.g. SIGINT
- * would be handled bizarrely. The original motivation was that some
- * memory corruption problems in OpenBSD ca sbcl-0.6.12.12 became
- * unnecessarily hard to debug when they ended up back in gencgc.c
- * code (courtesy of the gencgc SIGSEGV handler) after exit() was
- * called. */
+ * The "undoably" aspect is because we also arrange with atexit() for
+ * the handler to be restored to its old value. This is for tidiness:
+ * it shouldn't matter much ordinarily, but it does remove a window
+ * where e.g. memory fault signals (SIGSEGV or SIGBUS, which in
+ * ordinary operation of SBCL are sent to the generational garbage
+ * collector, then possibly onward to Lisp code) or SIGINT (which is
+ * ordinarily passed to Lisp code) could otherwise be handled
+ * bizarrely/brokenly because the Lisp code would try to deal with
+ * them using machinery (like stream output buffers) which has already
+ * been dismantled. */
 void
 undoably_install_low_level_interrupt_handler (int signal,
                                              void handler(int,
index 101eaf5..e06c4c2 100644 (file)
@@ -111,8 +111,6 @@ ldso_stub__ ## fct: ; \
  LDSO_STUBIFY(send)
  LDSO_STUBIFY(setitimer)
  LDSO_STUBIFY(setpgrp)
- LDSO_STUBIFY(setregid)
- LDSO_STUBIFY(setreuid)
  LDSO_STUBIFY(sigblock)
  LDSO_STUBIFY(sigpause)
  LDSO_STUBIFY(sigsetmask)
@@ -707,8 +705,6 @@ ldso_stub__ ## fct: ; \
 /*  LDSO_STUBIFY(setpriority) */
 /*  LDSO_STUBIFY(setprotoent) */
 /*  LDSO_STUBIFY(setpwent) */
-/*  LDSO_STUBIFY(setregid) */
-/*  LDSO_STUBIFY(setreuid) */
 /*  LDSO_STUBIFY(setrlimit) */
 /*  LDSO_STUBIFY(setrpcent) */
 /*  LDSO_STUBIFY(setservent) */
index e09565f..e5e17c0 100644 (file)
@@ -64,8 +64,8 @@ void os_init(void)
     }
 
     os_vm_page_size = getpagesize();
-   /* this could just as well be in arch_init, but it's not  */
-#ifdef i386
+   /* This could just as well be in arch_init(), but it's not. */
+#ifdef __i386__
     SET_FPU_CONTROL_WORD(0x1372|4|8|16|32); /* no interrupts */
 #endif
 }
@@ -249,10 +249,10 @@ sigsegv_handler(int signal, siginfo_t *info, void* void_context)
     os_context_t *context = (os_context_t*)void_context;
     os_vm_address_t addr;
 
-#ifdef i386
+#ifdef __i386__
     interrupt_handle_now(signal,contextstruct);
 #else
-#define CONTROL_STACK_TOP (((char*)CONTROL_STACK_START)+CONTROL_STACK_SIZE)
+    char *control_stack_top = (char*)CONTROL_STACK_START + CONTROL_STACK_SIZE;
     
     addr = arch_get_bad_addr(signal,info,context);
 
@@ -270,11 +270,16 @@ sigsegv_handler(int signal, siginfo_t *info, void* void_context)
         */
        *os_context_register_addr(context,reg_ALLOC) -= (1L<<63);
        interrupt_handle_pending(context);
-    } else if (addr > CONTROL_STACK_TOP && addr < BINDING_STACK_START) {
-       fprintf(stderr, "Possible stack overflow at 0x%016lX: CONTROL_STACK_TOP=%lx, BINDING_STACK_START=%lx\n",addr, CONTROL_STACK_TOP,BINDING_STACK_START);
-       /* try to fix control frame pointer */
+    } else if (addr > control_stack_top && addr < BINDING_STACK_START) {
+       fprintf(stderr,
+               "Possible stack overflow at 0x%016lX:\n"
+               "control_stack_top=%lx, BINDING_STACK_START=%lx\n",
+               addr,
+               control_stack_top,
+               BINDING_STACK_START);
+       /* Try to fix control frame pointer. */
        while ( ! (CONTROL_STACK_START <= *current_control_frame_pointer &&
-                  *current_control_frame_pointer <= CONTROL_STACK_TOP))
+                  *current_control_frame_pointer <= control_stack_top))
            ((char*)current_control_frame_pointer) -= sizeof(lispobj);
        ldb_monitor();
     } else if (!interrupt_maybe_gc(signal, info, context)) {
@@ -284,8 +289,6 @@ sigsegv_handler(int signal, siginfo_t *info, void* void_context)
 }
 #endif
 
-
-
 void
 os_install_interrupt_handlers(void)
 {
diff --git a/src/runtime/trymap.c b/src/runtime/trymap.c
new file mode 100644 (file)
index 0000000..013daf7
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * a utility for experimenting with mmap()-at-absolute-address-ranges
+ * as a crude way of checking whether it's reasonable for SBCL to
+ * reserve those address ranges for itself
+ */
+
+/*
+ * 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/types.h>
+#include <sys/mman.h>
+
+long
+hexparse(char *s)
+{
+    long result;
+    if (1 != sscanf(s, "%lx", &result)) {
+       fprintf(stderr, "can't parse \"%s\" as hexadecimal integer\n", s);
+       exit(1);
+    }
+    return result;
+}
+
+int
+main(int argc, char *argv[])
+{
+    char *addr;
+    char *requested_addr;
+
+    /* FIXME: It would be nice to make the no-command-line-arguments
+     * case of this program automatically check all the spaces that
+     * SBCL likes to map. Then we could execute this program as a
+     * sanity check in make-target-2.sh before we try to execute sbcl
+     * itself. */
+    if (argc != 3) {
+       fprintf(stderr, "usage: %s $addr $size\n", argv[0]);
+       exit(1);
+    }
+
+    requested_addr = (char*)hexparse(argv[1]);
+    addr = mmap(requested_addr,
+               hexparse(argv[2]),
+               0x7,
+               MAP_PRIVATE | MAP_ANON | MAP_FIXED,
+               -1,
+               0);
+
+    /* FIXME: It would be nice to make this a stronger test. E.g.
+     * besides just trying to mmap() the area, we could check that the
+     * area is not already mapped (perhaps by checking that attempts
+     * to reference the to-be-mapped area cause SIGSEGV or SIGBUS).
+     * (At least on OpenBSD, "A successful mmap deletes any previous
+     * mapping in the allocated address range.") */
+    if (addr != requested_addr) {
+       perror("mmap");
+    }
+       
+    exit(0);
+}
index 5ca4e20..0688a08 100644 (file)
@@ -128,10 +128,6 @@ F(setpgrp)
 #if !defined(SVR4) ||  defined(SOLARIS25)
 F(setpriority)
 #endif
-#if !defined(hpux) && !defined(SVR4) ||  defined(SOLARIS25)
-F(setregid)
-F(setreuid)
-#endif
 F(setrlimit)
 F(setsockopt)
 F(settimeofday)
index 9c62f13..aba2d4f 100644 (file)
@@ -15,4 +15,4 @@
 ;;; versions, and a string like "0.6.5.12" is used for versions which
 ;;; aren't released but correspond only to CVS tags or snapshots.
 
-"0.6.12.15"
+"0.6.12.16"