Update of /cvsroot/sbcl/sbcl/src/runtime
In directory sc8-pr-cvs1:/tmp/cvs-serv31380/src/runtime
Modified Files:
Config.sparc-sunos ppc-linux-os.c purify.c sparc-arch.c
sparc-sunos-os.c sunos-os.c thread.c thread.h x86-linux-os.h
Log Message:
0.pre8.39:
=== Threads merge, 0.78125 metres ===
Merge patch (CSR sbcl-devel 2003-04-04) supporting SPARC/SunOS. This version
builds on SPARC/SunOS and x86/Linux in #!-sb-thread mode; it has not been
tested on x86/Linux with threads enabled (and will obviously not run on
SPARC/SunOS with threads, because of the minor matter of various implementation
details such as a garbage collector and multiprocessing primitives).
Index: Config.sparc-sunos
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/Config.sparc-sunos,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Config.sparc-sunos 1 Sep 2002 15:14:05 -0000 1.3
+++ Config.sparc-sunos 5 Apr 2003 13:04:15 -0000 1.4
@@ -22,6 +22,6 @@
OS_SRC = sunos-os.c sparc-sunos-os.c os-common.c
#LINKFLAGS+=-static
LINKFLAGS+=
-OS_LIBS= -ldl -lsocket -lnsl
+OS_LIBS= -ldl -lsocket -lnsl -lrt
GC_SRC= cheneygc.c
Index: ppc-linux-os.c
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/ppc-linux-os.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ppc-linux-os.c 3 Apr 2003 18:27:26 -0000 1.5
+++ ppc-linux-os.c 5 Apr 2003 13:04:15 -0000 1.6
@@ -41,10 +41,10 @@
struct thread *arch_os_get_current_thread() {
return all_threads;
}
-struct thread *arch_os_thread_init() {
+int arch_os_thread_init(struct thread *thread) {
return 1; /* success */
}
-struct thread *arch_os_thread_cleanup() {
+int arch_os_thread_cleanup(struct thread *thread) {
return 1; /* success */
}
Index: purify.c
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/purify.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- purify.c 3 Apr 2003 18:27:28 -0000 1.25
+++ purify.c 5 Apr 2003 13:04:15 -0000 1.26
@@ -17,8 +17,10 @@
#include <sys/types.h>
#include <stdlib.h>
#include <strings.h>
+#if (defined(LISP_FEATURE_SB_THREAD) && defined(LISP_FEATURE_LINUX))
#include <sys/ptrace.h>
#include <linux/user.h>
+#endif
#include <errno.h>
#include "runtime.h"
Index: sparc-arch.c
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/sparc-arch.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- sparc-arch.c 19 Aug 2002 12:14:04 -0000 1.7
+++ sparc-arch.c 5 Apr 2003 13:04:15 -0000 1.8
@@ -351,6 +351,11 @@
undoably_install_low_level_interrupt_handler(SIGEMT, sigemt_handler);
}
+void get_spinlock(lispobj *word, int value) {
+ /* FIXME: dummy definition */
+ *word = value;
+}
+
extern lispobj call_into_lisp(lispobj fun, lispobj *args, int nargs);
Index: sparc-sunos-os.c
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/sparc-sunos-os.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- sparc-sunos-os.c 6 Aug 2002 11:46:33 -0000 1.4
+++ sparc-sunos-os.c 5 Apr 2003 13:04:15 -0000 1.5
@@ -36,6 +36,19 @@
#include "validate.h"
+#ifdef LISP_FEATURE_SB_THREAD
+#error "Define threading support functions"
+#else
+struct thread *arch_os_get_current_thread() {
+ return all_threads;
+}
+int arch_os_thread_init(struct thread *thread) {
+ return 1; /* success */
+}
+int arch_os_thread_cleanup(struct thread *thread) {
+ return 1; /* success */
+}
+#endif
os_context_register_t *
os_context_register_addr(os_context_t *context, int offset)
Index: sunos-os.c
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/sunos-os.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- sunos-os.c 6 Aug 2002 11:46:33 -0000 1.7
+++ sunos-os.c 5 Apr 2003 13:04:15 -0000 1.8
@@ -150,14 +150,26 @@
Just assume address is valid if it lies within one of the known
spaces. (Unlike sunos-os which keeps track of every valid page.) */
- 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, CONTROL_STACK_START , CONTROL_STACK_SIZE )
- || in_range_p(addr, BINDING_STACK_START , BINDING_STACK_SIZE ));
+
+ /* FIXME: this looks like a valid definition for all targets with
+ cheney-gc; it may not be impressively smart (witness the
+ comment above) but maybe associating these functions with the
+ GC rather than the OS would be a maintainability win. -- CSR,
+ 2003-04-04 */
+ struct thread *th;
+ if(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))
+ return 1;
+ for_each_thread(th) {
+ if((th->control_stack_start <= addr) && (addr < th->control_stack_end))
+ return 1;
+ if(in_range_p(addr, th->binding_stack_start, BINDING_STACK_SIZE))
+ return 1;
+ }
+ return 0;
}
-
Index: thread.c
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/thread.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- thread.c 4 Apr 2003 13:08:11 -0000 1.6
+++ thread.c 5 Apr 2003 13:04:15 -0000 1.7
@@ -1,6 +1,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <sched.h>
+#include <signal.h>
#include <stddef.h>
#ifndef CLONE_PARENT /* lameass glibc 2.2 doesn't define this */
#define CLONE_PARENT 0x00008000 /* even though the manpage documents it */
@@ -50,8 +51,13 @@
fprintf(stderr, "/continue\n");
}
th->unbound_marker = UNBOUND_MARKER_WIDETAG;
+#ifdef LISP_FEATURE_SB_THREAD
/* wait here until our thread is linked into all_threads: see below */
while(th->pid<1) sched_yield();
+#else
+ if(th->pid < 1)
+ lose("th->pid not set up right");
+#endif
if(arch_os_thread_init(th)==0)
return 1; /* failure. no, really */
@@ -249,8 +255,6 @@
return 0;
}
-
-
void block_sigcont(void)
{
/* don't allow ourselves to receive SIGCONT while we're in the
@@ -270,4 +274,3 @@
sigwaitinfo(&set,0);
sigprocmask(SIG_UNBLOCK,&set,0);
}
-
Index: thread.h
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/thread.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- thread.h 3 Apr 2003 18:27:31 -0000 1.4
+++ thread.h 5 Apr 2003 13:04:15 -0000 1.5
@@ -88,6 +88,7 @@
#endif
}
-
+int arch_os_thread_init(struct thread *thread);
+extern struct thread *arch_os_get_current_thread();
#endif /* _INCLUDE_THREAD_H_ */
Index: x86-linux-os.h
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/x86-linux-os.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- x86-linux-os.h 2 Apr 2003 11:15:23 -0000 1.5
+++ x86-linux-os.h 5 Apr 2003 13:04:15 -0000 1.6
@@ -8,9 +8,7 @@
return (os_context_t *) *void_context;
}
-extern struct thread *arch_os_get_current_thread();
unsigned long os_context_fp_control(os_context_t *context);
void os_restore_fp_control(os_context_t *context);
-int arch_os_thread_init(struct thread *thread);
#endif /* _X86_LINUX_OS_H */
|