1.0.9.30: Make SBCL work on MIPS/Linux with larger page sizes.
authorThiemo Seufer <ths@networkno.de>
Wed, 5 Sep 2007 01:20:45 +0000 (01:20 +0000)
committerThiemo Seufer <ths@networkno.de>
Wed, 5 Sep 2007 01:20:45 +0000 (01:20 +0000)
- Supports now up to 64k pages, aas defined by the o32 ABI.
- Tested on a bcm1480 with a kernel for 16k pages.
- The pagesize handling in SBCL is very broken for most other
  architectures / OSes.

contrib/sb-sprof/sb-sprof.lisp
src/compiler/mips/backend-parms.lisp
src/compiler/ppc/backend-parms.lisp
src/runtime/gc.h
src/runtime/runtime.c
src/runtime/thread.c
version.lisp-expr

index b68c78b..a6e461c 100644 (file)
@@ -345,7 +345,7 @@ profiling")
 
 (defvar *alloc-region-size*
   #-gencgc
-  4096
+  (get-page-size)
   ;; This hardcoded 2 matches the one in gc_find_freeish_pages. It's not
   ;; really worth genesifying.
   #+gencgc
index 1df277b..e1c1a1d 100644 (file)
@@ -1,11 +1,12 @@
 (in-package "SB!VM")
 
-;;; FIXME: Do I need a different one for little-endian? :spim,
-;;; perhaps?
 (def!constant +backend-fasl-file-implementation+ :mips)
 (setf *backend-register-save-penalty* 3)
 (setf *backend-byte-order*
       #!+little-endian :little-endian
       #!-little-endian :big-endian)
-;;; FIXME: Check this. Where is it used?
-(setf *backend-page-size* 4096)
+
+(progn ;eval-when (:compile-toplevel :load-toplevel :execute)
+  ;; The o32 ABI specifies 4k-64k as page size. We have to pick the
+  ;; maximum since mprotect() works only with page granularity.
+  (setf *backend-page-size* 65536))
index ebaf637..d15cc53 100644 (file)
@@ -5,7 +5,7 @@
 (setf *backend-byte-order* :big-endian)
 
 (eval-when (:compile-toplevel :load-toplevel :execute)
-  ;; On Linux, the ABI specifies the page size to be 4k-65k, use the
+  ;; On Linux, the ABI specifies the page size to be 4k-64k, use the
   ;; maximum of that range. FIXME: it'd be great if somebody would
   ;; find out whether using exact multiples of the page size actually
   ;; matters in the few places where that's done, or whether we could
index 224ae6c..a619175 100644 (file)
@@ -21,7 +21,7 @@
 #ifdef LISP_FEATURE_GENCGC
 #define PAGE_BYTES GENCGC_PAGE_SIZE
 #else
-#define PAGE_BYTES 0x1000
+#define PAGE_BYTES BACKEND_PAGE_SIZE
 #endif
 
 typedef signed long page_index_t;
index ab61951..5db1453 100644 (file)
@@ -332,7 +332,7 @@ main(int argc, char *argv[], char *envp[])
     }
 
     /* Align down to multiple of page_table page size */
-    dynamic_space_size = (dynamic_space_size/PAGE_BYTES) * PAGE_BYTES;
+    dynamic_space_size &= ~(PAGE_BYTES - 1);
 
     /* KLUDGE: os_vm_page_size is set by os_init(), and on some
      * systems (e.g. Alpha) arch_init() needs need os_vm_page_size, so
index 0bc37a2..e61ecbe 100644 (file)
@@ -373,12 +373,19 @@ create_thread_struct(lispobj initial_function) {
     /* Give a chance for cleanup threads to run. */
     sched_yield();
 #endif
-    /* may as well allocate all the spaces at once: it saves us from
+    /* May as well allocate all the spaces at once: it saves us from
      * having to decide what to do if only some of the allocations
-     * succeed */
-    spaces=os_validate(0, THREAD_STRUCT_SIZE);
+     * succeed.  SPACES must be page-aligned, since the GC expects the
+     * control stack to start at a page boundary.  We can't rely on the
+     * alignment passed from os_validate, since that might assume the
+     * current (e.g. 4k) pagesize, while we calculate with the biggest
+     * (e.g. 64k) pagesize allowed by the ABI.  */
+    spaces=os_validate(0, THREAD_STRUCT_SIZE + BACKEND_PAGE_SIZE);
     if(!spaces)
          return NULL;
+    spaces = (void *)((((unsigned long)(char *)spaces)
+                       + BACKEND_PAGE_SIZE - 1)
+                      & ~(BACKEND_PAGE_SIZE - 1));
     per_thread=(union per_thread_data *)
         (spaces+
          THREAD_CONTROL_STACK_SIZE+
index 7c53621..510933c 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.9.29"
+"1.0.9.30"