X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fruntime.c;h=0307d055fc20a220daf39b74151b9a0d77e554e9;hb=a7c2a16d0c2be6709becc962be1cb5e0aeda68c6;hp=3b36bf87c878adfc2798c5f856e6e824cddc3f4d;hpb=cea4896b2482b7b2b429c1631d774b4cfbc0efba;p=sbcl.git diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c index 3b36bf8..0307d05 100644 --- a/src/runtime/runtime.c +++ b/src/runtime/runtime.c @@ -14,6 +14,7 @@ */ #include +#include #include #include #include @@ -21,6 +22,10 @@ #include #include +#if defined(SVR4) || defined(__linux__) +#include +#endif + #include "signal.h" #include "runtime.h" @@ -35,9 +40,6 @@ #include "interr.h" #include "monitor.h" #include "validate.h" -#if defined GENCGC -#include "gencgc.h" -#endif #include "core.h" #include "save.h" #include "lispregs.h" @@ -48,18 +50,21 @@ #endif /* SIGINT handler that invokes the monitor (for when Lisp isn't up to it) */ - -static void sigint_handler(int signal, siginfo_t *info, void *void_context) +static void +sigint_handler(int signal, siginfo_t *info, void *void_context) { - printf("\nSIGINT hit at 0x%08lX\n", *os_context_pc_addr(void_context)); - ldb_monitor(); + lose("\nSIGINT hit at 0x%08lX\n", + (unsigned long) *os_context_pc_addr(void_context)); } /* (This is not static, because we want to be able to call it from * Lisp land.) */ -void sigint_init(void) +void +sigint_init(void) { + SHOW("entering sigint_init()"); install_handler(SIGINT, sigint_handler); + SHOW("leaving sigint_init()"); } /* @@ -75,6 +80,7 @@ successful_malloc(size_t size) } else { return result; } + return (void *) NULL; /* dummy value: return something ... */ } char * @@ -111,7 +117,7 @@ int main(int argc, char *argv[], char *envp[]) { /* the name of the core file we're to execute. Note that this is - * a malloc'ed string which must be freed eventually. */ + * a malloc'ed string which should be freed eventually. */ char *core = 0; /* other command line options */ @@ -120,7 +126,11 @@ main(int argc, char *argv[], char *envp[]) lispobj initial_function; + /* 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 + * it must follow os_init(). -- WHN 2000-01-26 */ os_init(); + arch_init(); gc_init(); validate(); @@ -138,10 +148,10 @@ main(int argc, char *argv[], char *envp[]) lose("more than one core file specified"); } else { ++argi; - core = copied_string(argv[argi]); if (argi >= argc) { lose("missing filename for --core argument"); } + core = copied_string(argv[argi]); ++argi; } } else if (0 == strcmp(arg, "--end-runtime-options")) { @@ -185,13 +195,19 @@ main(int argc, char *argv[], char *envp[]) char *sbcl_home = getenv("SBCL_HOME"); if (sbcl_home) { char *lookhere; - asprintf(&lookhere, "%s/sbcl.core", sbcl_home); + char *stem = "/sbcl.core"; + lookhere = (char *) calloc(strlen(sbcl_home) + + strlen(stem) + + 1, + sizeof(char)); + sprintf(lookhere, "%s%s", sbcl_home, stem); core = copied_existing_filename_or_null(lookhere); free(lookhere); } else { core = copied_existing_filename_or_null("/usr/lib/sbcl.core"); if (!core) { - core = copied_existing_filename_or_null("/usr/local/lib/sbcl.core"); + core = + copied_existing_filename_or_null("/usr/local/lib/sbcl.core"); } } if (!core) { @@ -201,26 +217,25 @@ main(int argc, char *argv[], char *envp[]) if (!noinform) { printf( -"This is SBCL " SBCL_VERSION_STRING ", an implementation of ANSI Common Lisp. - -SBCL is derived from the CMU CL system created at Carnegie Mellon University. -Besides material created at Carnegie Mellon University, and material -contributed by volunteers since its release into the public domain, CMU CL -contained, and SBCL contains, material copyrighted by - Massachusetts Institute of Technology, 1986; - Symbolics, Inc., 1989, 1990, 1991, 1992; and - Xerox Corporation, 1985, 1986, 1987, 1988, 1989, 1990. -More information about the origin of SBCL is available in the CREDITS file -in the distribution. - -SBCL is a free software system, provided as is, with absolutely no warranty. -It is mostly public domain software, but also includes some software from -MIT, Symbolics, and Xerox, used under BSD-style licenses which allow copying -only under certain conditions. More information about copying SBCL is -available in the COPYING file in the distribution. - -More information on SBCL is available at . -"); +"This is SBCL %s, an implementation of ANSI Common Lisp.\n\ +\n\ +SBCL is derived from the CMU CL system created at Carnegie Mellon University.\n\ +Besides software and documentation originally created at Carnegie Mellon\n\ +University, SBCL contains some software originally from the Massachusetts\n\ +Institute of Technology, Symbolics Incorporated, and Xerox Corporation, and\n\ +material contributed by volunteers since the release of CMU CL into the\n\ +public domain. See the CREDITS file in the distribution for more information.\n\ +\n\ +SBCL is a free software system, provided as is, with absolutely no warranty.\n\ +It is mostly in the public domain, but also includes some software copyrighted\n\ + Massachusetts Institute of Technology, 1986;\n\ + Symbolics, Inc., 1989, 1990, 1991, 1992; and\n\ + Xerox Corporation, 1985, 1986, 1987, 1988, 1989, 1990\n\ +used under BSD-style licenses allowing copying only under certain conditions.\n\ +See the COPYING file in the distribution for more information.\n\ +\n\ +More information about SBCL is available at .\n\ +", SBCL_VERSION_STRING); fflush(stdout); } @@ -234,42 +249,22 @@ More information on SBCL is available at . define_var("nil", NIL, 1); define_var("t", T, 1); - set_lossage_handler(ldb_monitor); + set_lossage_handler(monitor_or_something); -#if 0 - os_init(); - gc_init(); - validate(); -#endif globals_init(); initial_function = load_core_file(core); if (initial_function == NIL) { lose("couldn't find initial function"); } + SHOW("freeing core"); free(core); -#if defined GENCGC - gencgc_pickup_dynamic(); -#else -#if defined WANT_CGC && defined X86_CGC_ACTIVE_P - { - extern int use_cgc_p; - lispobj x = SymbolValue(X86_CGC_ACTIVE_P); - if (x != type_UnboundMarker && x != NIL) { - /* Enable allocator. */ - use_cgc_p = 1; - } - } -#endif -#endif + gc_initialize_pointers(); #ifdef BINDING_STACK_POINTER SetSymbolValue(BINDING_STACK_POINTER, BINDING_STACK_START); #endif -#if defined INTERNAL_GC_TRIGGER && !defined __i386__ - SetSymbolValue(INTERNAL_GC_TRIGGER, make_fixnum(-1)); -#endif interrupt_init(); @@ -278,19 +273,24 @@ More information on SBCL is available at . #ifdef PSEUDO_ATOMIC_ATOMIC /* Turn on pseudo atomic for when we call into Lisp. */ + SHOW("turning on pseudo atomic"); SetSymbolValue(PSEUDO_ATOMIC_ATOMIC, make_fixnum(1)); SetSymbolValue(PSEUDO_ATOMIC_INTERRUPTED, make_fixnum(0)); #endif /* Convert remaining argv values to something that Lisp can grok. */ + SHOW("setting POSIX-ARGV symbol value"); SetSymbolValue(POSIX_ARGV, alloc_string_list(argv)); /* Install a handler to pick off SIGINT until the Lisp system gets * far enough along to install its own handler. */ sigint_init(); + FSHOW((stderr, "/funcalling initial_function=0x%lx\n", initial_function)); funcall0(initial_function); /* initial_function() is not supposed to return. */ lose("Lisp initial_function gave up control."); + return 0; /* dummy value: return something */ } +