From 91a2d22216b99a6c59c964766d431be1b877f742 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Wed, 27 May 1987 14:50:43 +0000 Subject: [PATCH] Interrupts that are out of range are now signalled through the last slot in the interrupt vector. --- v7/src/microcode/boot.c | 10 +++--- v7/src/microcode/utils.c | 69 ++++++++++++++++++++++---------------- v7/src/microcode/version.h | 4 +-- v8/src/microcode/version.h | 4 +-- 4 files changed, 50 insertions(+), 37 deletions(-) diff --git a/v7/src/microcode/boot.c b/v7/src/microcode/boot.c index 33a8ff7b7..9905858fe 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.31 1987/04/29 15:39:14 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/boot.c,v 9.32 1987/05/27 14:50:14 cph Exp $ Copyright (c) 1987 Massachusetts Institute of Technology @@ -235,10 +235,10 @@ main(argc, argv) The_Queue, *Dummy_Hist, The_Utilities; \ fast long i; \ /* Interrupt vector */ \ - Int_Vec = Make_Pointer(TC_VECTOR, Free); \ - *Free++ = Make_Non_Pointer(TC_MANIFEST_VECTOR, \ - MAX_INTERRUPT_NUMBER + 1); \ - for (i=0; i <= MAX_INTERRUPT_NUMBER; i++) *Free++ = NIL; \ + Int_Vec = (Make_Pointer (TC_VECTOR, Free)); \ + *Free++ = (Make_Non_Pointer (TC_MANIFEST_VECTOR, \ + (MAX_INTERRUPT_NUMBER + 2))); \ + for (i = 0; (i <= (MAX_INTERRUPT_NUMBER + 1)); i += 1) *Free++ = NIL; \ /* Error vector is not needed at boot time */ \ Error = NIL; \ /* Dummy History Structure */ \ diff --git a/v7/src/microcode/utils.c b/v7/src/microcode/utils.c index d50f59339..5dd130b1f 100644 --- a/v7/src/microcode/utils.c +++ b/v7/src/microcode/utils.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/utils.c,v 9.28 1987/05/14 13:50:45 cph Exp $ */ +/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/utils.c,v 9.29 1987/05/27 14:50:43 cph Exp $ */ /* This file contains utilities for interrupts, errors, etc. */ @@ -49,35 +49,48 @@ Setup_Interrupt (Masked_Interrupts) long Masked_Interrupts; { Pointer Int_Vector, Handler; - long i, Int_Number, The_Int_Code = IntCode, New_Int_Enb; + long i, Int_Number, The_Int_Code, New_Int_Enb; long Save_Space; - Int_Vector = Get_Fixed_Obj_Slot(System_Interrupt_Vector); - - for (Int_Number=0, i=1; - Int_Number < MAX_INTERRUPT_NUMBER; - i = i<<1, Int_Number++) - if ((Masked_Interrupts & i) != 0) - goto OK; - - fprintf(stderr, "\nInterrupts = 0x%x, Mask= 0x%x, Masked = 0x%x\n", - IntCode, IntEnb, Masked_Interrupts); - fprintf(stderr, "Int_Vector %x\n", Int_Vector); - Microcode_Termination(TERM_NO_INTERRUPT_HANDLER); - -OK: - New_Int_Enb = (1< Vector_Length(Int_Vector)) - { fprintf(stderr, - "\nInterrupt out of range: 0x%x (vector length = 0x%x)\n", - Int_Number, Vector_Length(Int_Vector)); - fprintf(stderr, - "Interrupts = 0x%x, Mask= 0x%x, Masked = 0x%x\n", - IntCode, IntEnb, Masked_Interrupts); - Microcode_Termination(TERM_NO_INTERRUPT_HANDLER); - } - else Handler = User_Vector_Ref(Int_Vector, Int_Number); + The_Int_Code = IntCode; + Int_Vector = (Get_Fixed_Obj_Slot (System_Interrupt_Vector)); + + /* The interrupt vector is normally of size (MAX_INTERRUPT_NUMBER + 1). + We signal all normal interrupts though the first MAX_INTERRUPT_NUMBER + slots, and any other (spurious) interrupts through the last slot. */ + + Int_Number = 0; + i = 1; + while (true) + { + if (Int_Number > MAX_INTERRUPT_NUMBER) + { + New_Int_Enb = IntEnb; + break; + } + if ((Masked_Interrupts & i) != 0) + { + New_Int_Enb = ((1 << Int_Number) - 1); + break; + } + Int_Number += 1; + i = (i << 1); + } + + /* Handle case where interrupt vector is too small. */ + if (Int_Number >= (Vector_Length (Int_Vector))) + { + fprintf (stderr, + "\nInterrupt out of range: 0x%x (vector length = 0x%x)\n", + Int_Number, (Vector_Length (Int_Vector))); + fprintf (stderr, + "Interrupts = 0x%x, Mask= 0x%x, Masked = 0x%x\n", + IntCode, IntEnb, Masked_Interrupts); + Microcode_Termination (TERM_NO_INTERRUPT_HANDLER); + } + + Global_Interrupt_Hook (); + Handler = (User_Vector_Ref (Int_Vector, Int_Number)); /* Setup_Interrupt continues on the next page */ diff --git a/v7/src/microcode/version.h b/v7/src/microcode/version.h index e54c1f357..12e7d0e07 100644 --- a/v7/src/microcode/version.h +++ b/v7/src/microcode/version.h @@ -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/version.h,v 9.53 1987/05/21 18:06:14 cph Exp $ +/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 9.54 1987/05/27 14:49:39 cph Exp $ This file contains version information for the microcode. */ @@ -46,7 +46,7 @@ This file contains version information for the microcode. */ #define VERSION 9 #endif #ifndef SUBVERSION -#define SUBVERSION 53 +#define SUBVERSION 54 #endif #ifndef UCODE_TABLES_FILENAME diff --git a/v8/src/microcode/version.h b/v8/src/microcode/version.h index 7b8f2b39c..381b9fba8 100644 --- a/v8/src/microcode/version.h +++ b/v8/src/microcode/version.h @@ -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/v8/src/microcode/version.h,v 9.53 1987/05/21 18:06:14 cph Exp $ +/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 9.54 1987/05/27 14:49:39 cph Exp $ This file contains version information for the microcode. */ @@ -46,7 +46,7 @@ This file contains version information for the microcode. */ #define VERSION 9 #endif #ifndef SUBVERSION -#define SUBVERSION 53 +#define SUBVERSION 54 #endif #ifndef UCODE_TABLES_FILENAME -- 2.25.1