*M*      CSES7    SIGMA 7 SPECIFIC CODE FOR CENTRAL SYSTEM ERRORS
*P*  NAME:  CSES7
*P*
*P*  PURPOSE:  PROVIDE MACHINE SPECIFIC CODE FOR HANDLING
*P*            HARDWARE FAULTS ON SIGMA 7.  USED IN CONJUNCTION
*P*            WITH THE CSEHAND MODULE.
*P*
*P*  DESCRIPTION:  SEE CSEHAND MODULE FOR OVERVIEW OF FAULT HANDLING
         PCC      0
         TITLE    'CSES7  -  SIGMA 7 SPECIFIC CODE'
         DEF      CSES7:            MODULE NAME
CSES7:   EQU      %
BITS     SET      1                 GET BT31TO0 BITS
         SYSTEM   UTS
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
R5       EQU      5
R6       EQU      6
R7       EQU      7
R8       EQU      8
R9       EQU      9
R10      EQU      10
R11      EQU      11
R12      EQU      12
R13      EQU      13
R14      EQU      14
R15      EQU      15
         PAGE
*   REFS AND DEFS
         SPACE
         REF      CSE%BEST%END%ABORT%STEP ROUTINE TO SET ABORT FLAG
         REF      CSE%BEST%END%SCREECH  ROUTINE TO SET SCREECH FLAG
         REF      ERRLOG            ERROR LOGGING ROUTINE
         SPACE
         REF      CSED%3STAT        MEMORY PE STATUS TABLE
         REF      3COUNT            COUNT OF MEMORY ERRORS
         REF      3BUFCLR           MBS WORD TO CLEAR CSED%3STAT
         REF      CSED%PSD          TRAP PSD
         REF      F:INST            TRAPPED INSTRUCTION
         REF      F:EVIRT           EFF VIRTUAL ADDR OF INST
         REF      F:TEMP1           USED AS MFIX FLAG
         SPACE
         DEF      CSE%I56%FIX       HANDLER FOR I56 ON SIGMA 7
         SPACE
         DEF      CSE%1:7           CSE BRANCH TARGET #1
         DEF      CSE%2:7           CSE BRANCH TARGET #2
         DEF      CSE%3:7           CSE BRANCH TARGET #3
         DEF      CSE%4:7           CSE BRANCH TARGET #4
         DEF      CSE%5:7           CSE BRANCH TARGET #5
         DEF      CSE%6:7           CSE BRANCH TARGET #6
         DEF      CSE%7:7           CSE BRANCH TARGET #7
         DEF      CSE%8:7           CSE BRANCH TARGET #8
         DEF      CSE%9:7           CSE BRANCH TARGET #9
         DEF      CSE%A:7           CSE BRANCH TARGET #A
         DEF      CSE%B:7           CSE BRANCH TARGET #B
         DEF      CSE%C:7           CSE BRANCH TARGET #C
         DEF      CSE%D:7           CSE BRANCH TARGET #D
         DEF      CSE%E:7           CSE BRANCH TARGET #E
         DEF      CSE%F:7           CSE BRANCH TARGET #F
         SPACE
CSE%1:7  EQ       CSE%PPOLR         DUMMY RETURN
CSE%2:7  EQ       CSE%MPOLR         DUMMY RETURN
CSE%3:7  EQ       CSE%PLOG          DUMMY RETURN
CSE%4:7  EQ       CSE%MLOG          LOG CSED%3STAT ENTRY
CSE%5:7  EQ       CSE%PDEL          DUMMY RETURN
CSE%6:7  EQ       CSE%MDEL          DELETE 3STAT ENTRY
CSE%7:7  EQ       DUMMY             ENTRY NOT USED
CSE%8:7  EQ       CSE%GET%CONTENTS  READ AND INHIBIT PE
CSE%9:7  EQ       CSE%T46%FIX       HANDLER FOR WATCHDOG TIMER TRAP
CSE%A:7  EQ       DUMMY             ENTRY NOT USED
CSE%B:7  EQ       CSE%MDEL%IF%LOGGED SAME AS CSE%MDEL
CSE%C:7  EQ       DUMMY             ENTRY NOT USED
CSE%D:7  EQ       DUMMY             ENTRY NOT USED
CSE%E:7  EQ       DUMMY             ENTRY NOT USED
CSE%F:7  EQ       DUMMY             ENTRY NOT USED
         SPACE
CSEP%WHY%MPE  EQU  6                MEMORY PARITY ERROR
CSEP%WHY%WD   EQU  1                WATCHDOG TIMER
CSEP%I56%BIT  EQU  X'800'           B20 WD BIT FOR I56
         SPACE
         BOUND    8
6C6D     DATA     X'6C',X'6D'       RD/WD CHECK ON 46 TRAP
         PAGE
CSE%MPOLR  EQU    %
         MTW,1    F:TEMP1           SET FLAG FOR MEMORY POLLING (MFIX)
CSE%PPOLR  EQU    %                 PROCESSOR POLLING
CSE%PLOG  EQU     %
CSE%PDEL  EQU     %
         B        *R15              NO POLLING ON SIGMA 7
         SPACE
CSE%MLOG EQU      %
         MTW,0    3COUNT            ANYTHING TO LOG ?
         BEZ      *R15              B/ NO, RETURN
         LI,R6    CSED%3STAT        ADDRESS OF ERROR LOG ENTRY
         OR,R6    Y1                SET DONT ENABLE FLAG FOR ERRLOG
         BAL,R5   ERRLOG            GO LOG IT
         LW,R5    Y8
         STS,R5   3COUNT            SET LOGGED FLAG
         B        *R15              RETURN
         SPACE
CSE%MDEL%IF%LOGGED  EQU  %
CSE%MDEL EQU      %
         MTW,0    3COUNT            HAS IT BEEN LOGGED ?
         BGEZ     *R15              B/ NO, DONT DELETE IT
         LW,R1    3BUFCLR           MBS SETUP TO CLEAR CSED%3STAT
         MBS,R0   0                 DO IT
         B        *R15              RETURN
         PAGE
*F*  NAME:  CSE%I56%FIX
*F*
*F*  PURPOSE:  HANDLER FOR SIGMA 7 INTERRUPT 56 (MEMORY PARITY ERROR)
*F*
*F*  DESCRIPTION:  BESIDES POLLING MEMORY FOR PARITY LOCATIONS
*F*                (PART OF NORMAL FAULT HANDLING) THE ONLY
*F*                ADDITIONAL ACTION TAKEN BY THIS HANDLER IS
*F*                TO SET THE SCREECH FLAG
         SPACE
CSE%I56%FIX  EQU  %
         LI,R11   CSEP%WHY%MPE
         BAL,R12  CSE%BEST%END%SCREECH ALWAYS SCREECH ON S7 P.E.
         B        *R15
         PAGE
*F*  NAME:  CSE%T46%FIX
*F*
*F*  PURPOSE:  HANDLER FOR WATCHDOG TIMER TRAPS ON SIGMA 7
*F*
*F*  DESCRIPTION:  IF THE TRAPPED INSTRUCTION WAS A READ DIRECT
*F*                OR A WRITE DIRECT, AND THE MODE IS TWO OR GREATER,
*F*                THE TRAP IS LOGGED AND EXECUTION CONTINUES
*F*                WITH THE FOLLOWING INSTRUCTION.
*F*
*F*                ALL OTHER INSTRUCTIONS CAUSE JOB STEP ABORT IF
*F*                IN SLAVE MODE OR SCREECH IF IN MASTER MODE.
         SPACE
CSE%T46%FIX  EQU  %
         LB,R1    F:INST            GET OP
         AND,R1   M7                STRIP OFF INDIRECT BIT
         CLM,R1   6C6D              RD OR WD
         BCS,9    NOTRDWD           B/ NO
         LW,R1    F:EVIRT           GET EFFECTIVE ADDR
         AND,R1   M17               GET ONLY ADDRESS BITS
         CI,R1    X'2000'           IS MODE >=2
         BL       NOTRDWD           B/ NO
         MTW,1    CSED%PSD          INCR USERS ADDRESS
         B        *R15              AND RETURN
NOTRDWD  EQU      %
         LI,R11   CSEP%WHY%WD       WHY CODE
         BAL,R12  CSE%BEST%END%ABORT%STEP  SET ABORT STEP
         B        *R15
         PAGE
CSE%GET%CONTENTS  EQU  %
*
*   ENTER WITH REAL WORD ADDRESS IN R0, LINK IN R13
*   RETURNS WITH CONTENTS IN R0, CC=1 IF PARITY ERROR, CC=0 NO PE
*
         LI,R10   CSEP%I56%BIT      WD BIT FOR I56
         WD,R10   X'1100'           DISARM I56
         RD,R11   X'0010'           CLEAR MEM FAULT INDICS
         LW,R0    *R0               PICK UP CONTENTS
         RD,R11   X'0010'           TEST AND RESET INDICS
         WD,R10   X'1200'           ARM I56
         CI,R11   0                 CSE CC/ R2
         BEZ      *R13              CC4=0
         LCI      X'1'              SET PARITY ERROR INDIC
         B        *R13
         PAGE
*
*   BAD ENTRY INTO BRANCH TABLE
*
DUMMY    EQU      %
         SCREECH  X'23'             .23
*S*   SCREECH CODE:  23-00
*S*
*S*   MESSAGE:  INVALID ENTRY TO CSE HANDLERS
*S*
*S*   REPORTED BY:  CSES7
*S*
*S*   TYPE:  SCREEECH
*S*
*S*   REMARKS:  ENTRY WAS MADE TO AN UNUSED SLOT OF THE CSE
*S*             BRANCH VECTOR FOR THE RUNNING MACHINE TYPE
*S*
*S*   REGISTERS:  NONE
         END

