From: Christophe R. <cr...@us...> - 2004-04-08 13:39:19
|
Update of /cvsroot/sbcl/sbcl/src/runtime In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9065/src/runtime Modified Files: GNUmakefile bsd-os.c bsd-os.h gencgc.c interrupt.c undefineds.h x86-arch.c x86-assem.S x86-bsd-os.c x86-bsd-os.h Log Message: 0.8.9.29: Merge netbsd_branch Index: GNUmakefile =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/GNUmakefile,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- GNUmakefile 20 Feb 2004 18:15:20 -0000 1.18 +++ GNUmakefile 8 Apr 2004 13:26:04 -0000 1.19 @@ -16,7 +16,6 @@ # Config file CFLAGS = -g -Wall -O3 ASFLAGS = $(CFLAGS) -DEPEND_FLAGS = CPPFLAGS = -I. # Some of these things might be Config-dependent in future versions, Index: bsd-os.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/bsd-os.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- bsd-os.c 20 Feb 2004 18:15:20 -0000 1.19 +++ bsd-os.c 8 Apr 2004 13:26:04 -0000 1.20 @@ -21,6 +21,8 @@ #include <stdio.h> #include <sys/param.h> #include <sys/file.h> +#include <unistd.h> +#include <assert.h> #include "sbcl.h" #include "./signal.h" #include "os.h" @@ -37,11 +39,22 @@ #include "validate.h" -vm_size_t os_vm_page_size; +os_vm_size_t os_vm_page_size; + +#ifdef __NetBSD__ +#include <sys/resource.h> +#include <string.h> +static void netbsd_init(); +#endif /* __NetBSD__ */ + void os_init(void) { os_vm_page_size = getpagesize(); + +#ifdef __NetBSD__ + netbsd_init(); +#endif /* __NetBSD__ */ } int *os_context_pc_addr(os_context_t *context) @@ -50,6 +63,8 @@ return CONTEXT_ADDR_FROM_STEM(eip); #elif defined __OpenBSD__ return CONTEXT_ADDR_FROM_STEM(pc); +#elif defined __NetBSD__ + return CONTEXT_ADDR_FROM_STEM(EIP); #elif defined LISP_FEATURE_DARWIN return &context->uc_mcontext->ss.srr0; #else @@ -63,7 +78,7 @@ /* (Unlike most of the other context fields that we access, the * signal mask field is a field of the basic, outermost context * struct itself both in FreeBSD 4.0 and in OpenBSD 2.6.) */ -#if defined __FreeBSD__ || defined LISP_FEATURE_DARWIN +#if defined __FreeBSD__ || __NetBSD__ || defined LISP_FEATURE_DARWIN return &context->uc_sigmask; #elif defined __OpenBSD__ return &context->sc_mask; @@ -162,15 +177,14 @@ { /* The way that we extract low level information like the fault * address is not specified by POSIX. */ -#if defined __FreeBSD__ - void *fault_addr = siginfo->si_addr; -#elif defined __OpenBSD__ +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) void *fault_addr = siginfo->si_addr; #elif defined LISP_FEATURE_DARWIN void *fault_addr = siginfo->si_addr; #else #error unsupported BSD variant #endif + os_context_t *context = arch_os_get_context(&void_context); if (!gencgc_handle_wp_violation(fault_addr)) if(!handle_control_stack_guard_triggered(context,fault_addr)) @@ -213,6 +227,29 @@ } #endif /* defined GENCGC */ + +#ifdef __NetBSD__ +static void netbsd_init() +{ + struct rlimit rl; + + /* NetBSD counts mmap()ed space against the process's data size limit, + * so yank it up. This might be a nasty thing to do? */ + getrlimit (RLIMIT_DATA, &rl); + /* Amazingly for such a new port, the provenance and meaning of + this number are unknown. It might just mean REALLY_BIG_LIMIT, + or possibly it should be calculated from dynamic space size. + -- CSR, 2004-04-08 */ + rl.rlim_cur = 1073741824; + if (setrlimit (RLIMIT_DATA, &rl) < 0) { + fprintf (stderr, + "RUNTIME WARNING: unable to raise process data size limit:\n\ + %s.\n\ +The system may fail to start.\n", + strerror(errno)); + } +} +#endif /* __NetBSD__ */ /* threads */ Index: bsd-os.h =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/bsd-os.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- bsd-os.h 20 Feb 2004 18:15:20 -0000 1.11 +++ bsd-os.h 8 Apr 2004 13:26:04 -0000 1.12 @@ -18,7 +18,11 @@ #include <sys/signal.h> typedef caddr_t os_vm_address_t; +#ifdef __NetBSD__ +typedef vsize_t os_vm_size_t; +#else typedef vm_size_t os_vm_size_t; +#endif typedef off_t os_vm_offset_t; typedef int os_vm_prot_t; typedef int os_context_register_t; @@ -28,7 +32,7 @@ * Linux sigaltstack(2) */ typedef struct sigaltstack stack_t; #elif defined __FreeBSD__ -/* FreeBSD 4.6 already has stack_t defined. */ +/* FreeBSD 4.6 and NetBSD 1.6 already have stack_t defined. */ #endif #if defined __FreeBSD__ @@ -45,9 +49,18 @@ * so we need to implement single stepping in a more roundabout way. */ #define CANNOT_GET_TO_SINGLE_STEP_FLAG #define SIG_MEMORY_FAULT SIGBUS + #elif defined __OpenBSD__ + typedef struct sigcontext os_context_t; #define SIG_MEMORY_FAULT SIGSEGV + +#elif defined __NetBSD__ + +#include <ucontext.h> +typedef ucontext_t os_context_t; +#define SIG_MEMORY_FAULT SIGSEGV + #elif defined LISP_FEATURE_DARWIN /* man pages claim that the third argument is a sigcontext struct, but ucontext_t is defined, matches sigcontext where sensible, @@ -59,6 +72,7 @@ #include <ucontext.h> typedef ucontext_t os_context_t; #define SIG_MEMORY_FAULT SIGBUS + #else #error unsupported BSD variant #endif Index: gencgc.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/gencgc.c,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- gencgc.c 6 Apr 2004 22:21:21 -0000 1.53 +++ gencgc.c 8 Apr 2004 13:26:04 -0000 1.54 @@ -69,7 +69,7 @@ boolean enable_page_protection = 1; /* Should we unmap a page and re-mmap it to have it zero filled? */ -#if defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) /* comment from cmucl-2.4.8: This can waste a lot of swap on FreeBSD * so don't unmap there. * Index: interrupt.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/interrupt.c,v retrieving revision 1.57 retrieving revision 1.58 diff -u -d -r1.57 -r1.58 --- interrupt.c 30 Mar 2004 12:24:53 -0000 1.57 +++ interrupt.c 8 Apr 2004 13:26:04 -0000 1.58 @@ -730,7 +730,7 @@ } #ifndef LISP_FEATURE_GENCGC -/* This function gets called from the SIGSEGV (for e.g. Linux or +/* This function gets called from the SIGSEGV (for e.g. Linux, NetBSD, & * OpenBSD) or SIGBUS (for e.g. FreeBSD) handler. Here we check * whether the signal was due to treading on the mprotect()ed zone - * and if so, arrange for a GC to happen. */ Index: undefineds.h =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/undefineds.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- undefineds.h 18 Sep 2003 21:09:10 -0000 1.14 +++ undefineds.h 8 Apr 2004 13:26:04 -0000 1.15 @@ -38,7 +38,8 @@ #if defined(hpux) \ || defined(SVR4) \ || defined(__FreeBSD__) \ - || defined(__OpenBSD__) + || defined(__OpenBSD__) \ + || defined(__NetBSD__) F(cfgetospeed) F(cfsetospeed) F(cfgetispeed) @@ -152,7 +153,7 @@ #if !defined(SVR4) F(sigsetmask) #endif -#if !defined(SVR4) && !defined(__FreeBSD__) && !defined(__OpenBSD__) +#if !defined(SVR4) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) F(sigstack) F(sigvec) #endif @@ -177,6 +178,7 @@ || defined(SVR4) \ || defined(__FreeBSD__) \ || defined(__OpenBSD__) \ + || defined(__NetBSD__) \ || defined(__linux__) F(tcgetattr) F(tcsetattr) @@ -194,7 +196,8 @@ && !defined(parisc) \ && !defined(SOLARIS) \ && !defined(__OpenBSD__) \ - && !defined(__FreeBSD__) + && !defined(__FreeBSD__) \ + && !defined(__NetBSD__) F(umount) #endif F(unlink) @@ -204,7 +207,7 @@ #ifndef irix F(vfork) #endif -#if !defined(osf1) && !defined(__FreeBSD__) && !defined(__OpenBSD__) +#if !defined(osf1) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) F(vhangup) #endif F(wait) @@ -254,6 +257,9 @@ F(gethostbyaddr) /* other miscellaneous things */ +/* FIXME: NetBSD plays some renaming games, and so cannot simply + reference symbols here. "NetBSD needs to get fixed here too PEM + 2004-03-27" */ #if defined(SVR4) || defined(__FreeBSD__) F(setpgid) F(getpgid) Index: x86-arch.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/x86-arch.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- x86-arch.c 27 Nov 2003 06:21:04 -0000 1.23 +++ x86-arch.c 8 Apr 2004 13:26:04 -0000 1.24 @@ -55,8 +55,10 @@ return &context->uc_mcontext.gregs[16]; #elif defined __FreeBSD__ return &context->uc_mcontext.mc_eflags; -#elif defined __OpenBSD__ +#elif defined __OpenBSD__ || defined __NetBSD__ return &context->sc_eflags; +#elif defined __NetBSD__ + return &(context->uc_mcontext.__gregs[_REG_EFL]); #else #error unsupported OS #endif Index: x86-assem.S =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/x86-assem.S,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- x86-assem.S 5 Apr 2004 23:39:14 -0000 1.14 +++ x86-assem.S 8 Apr 2004 13:26:04 -0000 1.15 @@ -23,15 +23,15 @@ #include "genesis/thread.h" /* Minimize conditionalization for different OS naming schemes. */ -#if defined __linux__ || defined __FreeBSD__ /* (but *not* OpenBSD) */ +#if defined __linux__ || defined __FreeBSD__ || defined __NetBSD__ /* (but *not* OpenBSD) */ #define GNAME(var) var #else #define GNAME(var) _##var #endif -/* Get the right type of alignment. Linux and FreeBSD (but not OpenBSD) +/* Get the right type of alignment. Linux, FreeBSD and NetBSD (but not OpenBSD) * want alignment in bytes. */ -#if defined(__linux__) || defined(__FreeBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) #define align_4byte 4 #define align_8byte 8 #define align_16byte 16 Index: x86-bsd-os.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/x86-bsd-os.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- x86-bsd-os.c 19 Sep 2003 15:25:53 -0000 1.3 +++ x86-bsd-os.c 8 Apr 2004 13:26:04 -0000 1.4 @@ -12,7 +12,8 @@ * flavour, with the cross-architecture complications that this * entails; unfortunately, currently the situation is worse, not * better, than in the above paragraph. */ - + +#if defined(__FreeBSD__) || defined(__OpenBSD__) int * os_context_register_addr(os_context_t *context, int offset) { @@ -44,6 +45,43 @@ return CONTEXT_ADDR_FROM_STEM(esp); } +#endif /* __FreeBSD__ || __OpenBSD__ */ + +#ifdef __NetBSD__ +int * +os_context_register_addr(os_context_t *context, int offset) +{ + switch(offset) { + case 0: + return CONTEXT_ADDR_FROM_STEM(EAX); + case 2: + return CONTEXT_ADDR_FROM_STEM(ECX); + case 4: + return CONTEXT_ADDR_FROM_STEM(EDX); + case 6: + return CONTEXT_ADDR_FROM_STEM(EBX); + case 8: + return CONTEXT_ADDR_FROM_STEM(ESP); + case 10: + return CONTEXT_ADDR_FROM_STEM(EBP); + case 12: + return CONTEXT_ADDR_FROM_STEM(ESI); + case 14: + return CONTEXT_ADDR_FROM_STEM(EDI); + default: + return 0; + } +} + +int * +os_context_sp_addr(os_context_t *context) +{ + return &(_UC_MACHINE_SP(context)); +} + +#endif /* __NetBSD__ */ + + /* FIXME: If this can be a no-op on BSD/x86, then it * deserves a more precise name. Index: x86-bsd-os.h =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/x86-bsd-os.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- x86-bsd-os.h 29 Jul 2003 13:01:56 -0000 1.3 +++ x86-bsd-os.h 8 Apr 2004 13:26:04 -0000 1.4 @@ -13,6 +13,8 @@ #define CONTEXT_ADDR_FROM_STEM(stem) &context->uc_mcontext.mc_ ## stem #elif defined __OpenBSD__ #define CONTEXT_ADDR_FROM_STEM(stem) &context->sc_ ## stem +#elif defined __NetBSD__ +#define CONTEXT_ADDR_FROM_STEM(stem) &((context)->uc_mcontext.__gregs[_REG_ ## stem]) #else #error unsupported BSD variant #endif |