From 0651b4cea0a723768c794b67beec55b111d90304 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Fri, 21 Oct 1988 00:13:07 +0000 Subject: [PATCH] Fix some problems with unix signals: (1) Emacs uses SIGHUP to kill a process when its buffer is killed, so treat SIGHUP differently if under Emacs -- also don't print messages in this case as the buffer is dead; (2) don't ask for core dump if signal received. Also define new primitive `clear-interrupts!'; change `get-next-interrupt-character' and `setup-timer-interrupt' so they don't clear the interrupt bit. It is now the responsibility of the runtime system to clear the bit when it gets the interrupt. --- v7/src/microcode/boot.c | 42 ++++++++++++++++++++++---------------- v7/src/microcode/dmpwrld.c | 4 ++-- v7/src/microcode/hooks.c | 27 ++++++++++++++---------- v7/src/microcode/sysprim.c | 4 +--- v7/src/microcode/version.h | 4 ++-- v8/src/microcode/version.h | 4 ++-- 6 files changed, 47 insertions(+), 38 deletions(-) diff --git a/v7/src/microcode/boot.c b/v7/src/microcode/boot.c index f98f382e8..7be71c857 100644 --- a/v7/src/microcode/boot.c +++ b/v7/src/microcode/boot.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/boot.c,v 9.51 1988/09/29 04:51:09 jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/boot.c,v 9.52 1988/10/21 00:12:26 cph Exp $ Copyright (c) 1988 Massachusetts Institute of Technology @@ -535,6 +535,9 @@ Enter_Interpreter() /*NOTREACHED*/ } +extern Boolean inhibit_termination_messages; +Boolean inhibit_termination_messages = false; + term_type Microcode_Termination(code) long code; @@ -576,15 +579,14 @@ Microcode_Termination(code) } } - putchar('\n'); - if ((code < 0) || (code > MAX_TERMINATION)) - { - printf("Unknown termination code 0x%x\n", code); - } - else - { - printf("%s.\n", Term_Messages[code]); - } + if (! inhibit_termination_messages) + { + putchar('\n'); + if ((code < 0) || (code > MAX_TERMINATION)) + printf ("Unknown termination code 0x%x\n", code); + else + printf("%s.\n", Term_Messages [code]); + } /* Microcode_Termination continues on the next page */ @@ -604,14 +606,18 @@ Microcode_Termination(code) abnormal_p = false; break; +#ifdef unix case TERM_SIGNAL: { - extern char *assassin_signal; + extern int assassin_signal; + extern char * find_signal_name (); - if (assassin_signal != ((char *) NULL)) - printf("Killed by %s.\n", assassin_signal); + if ((! inhibit_termination_messages) && + (assassin_signal != 0)) + printf("Killed by %s.\n", (find_signal_name (assassin_signal))); goto normal_termination; } +#endif case TERM_TRAP: /* This claims not to be abnormal so that the user will @@ -664,11 +670,11 @@ Microcode_Termination(code) } break; } - OS_Flush_Output_Buffer(); - OS_Quit(abnormal_p); - Reset_Memory(); - Exit_Hook(); - Exit_Scheme(value); + OS_Flush_Output_Buffer (); + OS_Quit (code, abnormal_p); + Reset_Memory (); + Exit_Hook (); + Exit_Scheme (value); /*NOTREACHED*/ } diff --git a/v7/src/microcode/dmpwrld.c b/v7/src/microcode/dmpwrld.c index e3e9c1bea..d9bcdbca1 100644 --- a/v7/src/microcode/dmpwrld.c +++ b/v7/src/microcode/dmpwrld.c @@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising, promotional, or sales literature without prior written consent from MIT in each case. */ -/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/dmpwrld.c,v 9.27 1988/08/15 20:45:01 cph Exp $ +/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/dmpwrld.c,v 9.28 1988/10/21 00:12:33 cph Exp $ * * This file contains a primitive to dump an executable version of Scheme. * It uses unexec.c from GNU Emacs. @@ -218,7 +218,7 @@ DEFINE_PRIMITIVE ("DUMP-WORLD", Prim_dump_world, 1, 1, 0) Was_Scheme_Dumped = true; Val = SHARP_T; - OS_Quit(); + OS_Quit (TERM_HALT, false); Pop_Primitive_Frame(1); /* Dump! */ diff --git a/v7/src/microcode/hooks.c b/v7/src/microcode/hooks.c index c715d7083..90ffa32d3 100644 --- a/v7/src/microcode/hooks.c +++ b/v7/src/microcode/hooks.c @@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising, promotional, or sales literature without prior written consent from MIT in each case. */ -/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/hooks.c,v 9.32 1988/08/15 20:49:05 cph Exp $ +/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/hooks.c,v 9.33 1988/10/21 00:12:37 cph Exp $ * * This file contains various hooks and handles which connect the * primitives with the main interpreter. @@ -535,22 +535,17 @@ DEFINE_PRIMITIVE ("SCODE-EVAL", Prim_scode_eval, 2, 2, 0) /*NOTREACHED*/ } -/* (GET-INTERRUPT-ENABLES) - Returns the current interrupt mask. */ - -DEFINE_PRIMITIVE ("GET-INTERRUPT-ENABLES", Prim_get_interrupt_enables, 0, 0, 0) +DEFINE_PRIMITIVE ("GET-INTERRUPT-ENABLES", Prim_get_interrupt_enables, 0, 0, + "Returns the current interrupt mask.") { PRIMITIVE_HEADER (0); PRIMITIVE_RETURN (MAKE_UNSIGNED_FIXNUM (FETCH_INTERRUPT_MASK ())); } -/* (SET-INTERRUPT-ENABLES! NEW-INT-ENABLES) - Changes the enabled interrupt bits to NEW-INT-ENABLES and - returns the previous value. See MASK_INTERRUPT_ENABLES for more - information on interrupts. */ - -DEFINE_PRIMITIVE ("SET-INTERRUPT-ENABLES!", Prim_set_interrupt_enables, 1, 1, 0) +DEFINE_PRIMITIVE ("SET-INTERRUPT-ENABLES!", Prim_set_interrupt_enables, 1, 1, + "Sets the interrupt mask to NEW-INT-ENABLES; returns previous mask value.\n\ +See `mask_interrupt_enables' for more information on interrupts.") { long previous; PRIMITIVE_HEADER (1); @@ -559,6 +554,16 @@ DEFINE_PRIMITIVE ("SET-INTERRUPT-ENABLES!", Prim_set_interrupt_enables, 1, 1, 0) SET_INTERRUPT_MASK ((FIXNUM_ARG (1)) & INT_Mask); PRIMITIVE_RETURN (MAKE_UNSIGNED_FIXNUM (previous)); } + +DEFINE_PRIMITIVE ("CLEAR-INTERRUPTS!", Prim_clear_interrupts, 1, 1, + "Clears the interrupt bits in the MASK argument. +The bits in MASK are interpreted as for `get-interrupt-enables'.") +{ + PRIMITIVE_HEADER (1); + + CLEAR_INTERRUPT ((FIXNUM_ARG (1)) & INT_Mask); + PRIMITIVE_RETURN (SHARP_F); +} /* (GET-FLUID-BINDINGS) Gets the microcode fluid-bindings variable. */ diff --git a/v7/src/microcode/sysprim.c b/v7/src/microcode/sysprim.c index b8351fa1c..613f372bf 100644 --- a/v7/src/microcode/sysprim.c +++ b/v7/src/microcode/sysprim.c @@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising, promotional, or sales literature without prior written consent from MIT in each case. */ -/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/sysprim.c,v 9.30 1988/08/15 20:56:21 cph Exp $ +/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/sysprim.c,v 9.31 1988/10/21 00:12:44 cph Exp $ * * Random system primitives. Most are implemented in terms of * utilities in os.c @@ -64,7 +64,6 @@ DEFINE_PRIMITIVE ("GET-NEXT-INTERRUPT-CHARACTER", Prim_get_next_interrupt_char, Primitive_Error (ERR_EXTERNAL_RETURN); /*NOTREACHED*/ } - CLEAR_INTERRUPT (INT_Character); PRIMITIVE_RETURN (MAKE_UNSIGNED_FIXNUM (result)); } @@ -101,7 +100,6 @@ DEFINE_PRIMITIVE ("SETUP-TIMER-INTERRUPT", Prim_setup_timer_interrupt, 2, 2, 0) Sign_Extend(Arg2, Centi_Seconds); Set_Int_Timer(Days, Centi_Seconds); } - CLEAR_INTERRUPT(INT_Timer); PRIMITIVE_RETURN(NIL); } diff --git a/v7/src/microcode/version.h b/v7/src/microcode/version.h index 04e4aa4f9..67e5653df 100644 --- a/v7/src/microcode/version.h +++ b/v7/src/microcode/version.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 10.54 1988/10/20 11:00:23 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 10.55 1988/10/21 00:13:07 cph Exp $ Copyright (c) 1988 Massachusetts Institute of Technology @@ -46,7 +46,7 @@ MIT in each case. */ #define VERSION 10 #endif #ifndef SUBVERSION -#define SUBVERSION 54 +#define SUBVERSION 55 #endif #ifndef UCODE_TABLES_FILENAME diff --git a/v8/src/microcode/version.h b/v8/src/microcode/version.h index da3b4d33d..c45f74970 100644 --- a/v8/src/microcode/version.h +++ b/v8/src/microcode/version.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 10.54 1988/10/20 11:00:23 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 10.55 1988/10/21 00:13:07 cph Exp $ Copyright (c) 1988 Massachusetts Institute of Technology @@ -46,7 +46,7 @@ MIT in each case. */ #define VERSION 10 #endif #ifndef SUBVERSION -#define SUBVERSION 54 +#define SUBVERSION 55 #endif #ifndef UCODE_TABLES_FILENAME -- 2.25.1