diff --git a/lisp/lisp.c b/lisp/lisp.c index 0fe17da76a382d56c0e57e0b5b3dd218996b580d..4b5aaf9bd498b8088ccebdb61bc38ff0f4b21842 100644 --- a/lisp/lisp.c +++ b/lisp/lisp.c @@ -1,7 +1,7 @@ /* * main() entry point for a stand alone lisp image. * - * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.54 2007/07/07 17:25:10 fgilham Exp $ + * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.55 2007/07/08 06:58:34 fgilham Exp $ * */ @@ -437,7 +437,8 @@ main(int argc, char *argv[], char *envp[]) if (strcmp(arg, "-core") == 0) { #ifdef FEATURE_EXECUTABLE if (builtin_image_flag) { - fprintf(stderr, "Cannot specify alternate core file with executable image.\n"); + fprintf(stderr, + "Cannot specify core file in executable image --- sorry about that.\n"); exit(1); } #endif @@ -447,13 +448,15 @@ main(int argc, char *argv[], char *envp[]) } core = *++argptr; if (core == NULL) { - fprintf(stderr, "-core must be followed by the name of the core file to use.\n"); + fprintf(stderr, + "-core must be followed by the name of the core file to use.\n"); exit(1); } } else if (strcmp(arg, "-lib") == 0) { lib = *++argptr; if (lib == NULL) { - fprintf(stderr, "-lib must be followed by a string denoting the CMUCL library path.\n"); + fprintf(stderr, + "-lib must be followed by a string denoting the CMUCL library path.\n"); exit(1); } } else if (strcmp(arg, "-dynamic-space-size") == 0) { @@ -494,7 +497,8 @@ main(int argc, char *argv[], char *envp[]) } #endif if (dynamic_space_size > DYNAMIC_SPACE_SIZE) { - fprintf(stderr, "-dynamic-space-size must be no greater than %d MBytes.\n", + fprintf(stderr, + "-dynamic-space-size must be no greater than %d MBytes.\n", DYNAMIC_SPACE_SIZE / (1024 * 1024)); exit(1); } @@ -623,12 +627,14 @@ main(int argc, char *argv[], char *envp[]) core = argv[0]; } #endif + globals_init(); #ifdef FEATURE_EXECUTABLE if (builtin_image_flag != 0) { extern int image_dynamic_space_size; long allocation_pointer = + (long) dynamic_0_space + (int) &image_dynamic_space_size; #if defined(i386) || defined(__x86_64) SetSymbolValue(ALLOCATION_POINTER, (lispobj) allocation_pointer); diff --git a/lisp/save.c b/lisp/save.c index a97ff1ee92ff75af095d4a88b1ef0da6a5a99f29..5ed89b5f9bcca60920ea65e2c8b6bf97c6d8277b 100644 --- a/lisp/save.c +++ b/lisp/save.c @@ -1,6 +1,6 @@ /* - $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/save.c,v 1.16 2007/07/07 17:25:10 fgilham Exp $ + $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/save.c,v 1.17 2007/07/08 06:58:39 fgilham Exp $ This code was written as part of the CMU Common Lisp project at Carnegie Mellon University, and has been placed in the public domain. @@ -35,29 +35,29 @@ extern int version; static long write_bytes(FILE * file, char *addr, long bytes) { - long count, here, data; - - bytes = (bytes + CORE_PAGESIZE - 1) & ~(CORE_PAGESIZE - 1); - - fflush(file); - here = ftell(file); - fseek(file, 0, 2); - data = (ftell(file) + CORE_PAGESIZE - 1) & ~(CORE_PAGESIZE - 1); - fseek(file, data, 0); - - while (bytes > 0) { - count = fwrite(addr, 1, bytes, file); - if (count > 0) { - bytes -= count; - addr += count; - } else { - perror("Error writing to save file"); - bytes = 0; - } - } - fflush(file); - fseek(file, here, 0); - return data / CORE_PAGESIZE - 1; + long count, here, data; + + bytes = (bytes + CORE_PAGESIZE - 1) & ~(CORE_PAGESIZE - 1); + + fflush(file); + here = ftell(file); + fseek(file, 0, 2); + data = (ftell(file) + CORE_PAGESIZE - 1) & ~(CORE_PAGESIZE - 1); + fseek(file, data, 0); + + while (bytes > 0) { + count = fwrite(addr, 1, bytes, file); + if (count > 0) { + bytes -= count; + addr += count; + } else { + perror("Error writing to save file"); + bytes = 0; + } + } + fflush(file); + fseek(file, here, 0); + return data / CORE_PAGESIZE - 1; } static void @@ -171,6 +171,7 @@ save(char *filename, lispobj init_function) print_ptr((lispobj*) 0x2805a184); #endif + #ifdef DEBUG_BAD_HEAP /* * For some reason x86 has a heap corruption problem. I (rtoy) @@ -228,6 +229,7 @@ save(char *filename, lispobj init_function) exit(0); } + #ifdef FEATURE_EXECUTABLE boolean save_executable(char *filename, lispobj init_function)