*M*      CSEHAND  CENTRAL SYSTEM ERROR (FAULT) HANDLER
*P*
*P*  NAME:  CSEHAND
*P*
*P*  PURPOSE:      HANDLER FOR CENTRAL SYSTEM ERRORS (HARDWARE FAULTS)
*P*
*P*  DESCRIPTION:  UPON ENTRY VIA TRAP 46,4C,4D, OR SIGMA 7-INTERRUPT 56
*P*                THE TRAP ENVIRONMENT IS SAVED AND THEN THE ROUTINE
*P*                CHECKS TO SEE IF IT HAS BEEN RE-ENTERED OR A TRAP
*P*                HAS OCCURED DURING A CRITICAL PATH LIKE POLLING
*P*                MEMORY FOR THE I/O SYSTEM.  IF EITHER OF THESE
*P*                SITUATIONS EXIST, THE BEST%END INDICATOR FLAG IS
*P*                APPROPRIATELY SET TO CAUSE SCREECH OR SYSTEM HALT
*P*                AFTER PROCESSING THE LATEST ERROR.
*P*
*P*                THE GENERAL HANDLING OF ALL HARDWARE TRAPS IS THE
*P*                SAME.  THE HANDLER POLLS MEMORY FOR PARITY ERRORS
*P*                AND THE TRAPPED INSTRUCTION IS ANALYZED.  ON SIGMA 9
*P*                AND X560 MACHINES, THE MEMORY BANK STATUS REGISTERS
*P*                ARE POLLED, AND ON THE 560 THE PROCESSOR FAULT STATUS
*P*                REGISTERS ARE POLLED.  THE DATA COLLECTED IS REPORTED
*P*                TO THE ERROR LOG SYSTEM WITH THESE ENTRIES:
*P*
*P*               TRAP 46 - ENTRY #2E
*P*               TRAP 4C - ENTRY #2D
*P*               TRAP 4D - ENTRY #2F
*P*               SIG 7 I56 - ENTRY #2D (PARTIAL)
*P*
*P*                     MEMORY BANK STATUS - ENTRY #43 (SIGMA 9)
*P*                     MEMORY BANK STATUS - ENTRY #42 (XEROX 560)
*P*
*P*                     PROCESSOR FAULT STATUS - ENTRY #32
*P*
*P*                     MEMORY PE LOCATIONS - ENTRY #49
*P*
*P*                IN ADDITION TO THIS INFORMATION GATHERING, EACH
*P*                FAULT HAS A SPECIFIC ROUTINE WHICH ANALYZES THE
*P*                PARTICULAR TYPE OF ERROR IN ORDER TO
*P*                DETERMINE THE BEST RECOVERY POSSIBLE.  THE INDIVIDUAL
*P*                ROUTINES ARE DESCRIBED BY F REPORTS FOR EACH
*P*                MODULE ROUTINE:
*P*
*P*                     CSE%T46%FIX
*P*                     CSE%T4C%FIX
*P*                     CSE%T4D%FIX
*P*                     CSE%I56%FIX
*P*
*P*                THE HANDLING OF A FAULT RESULTS IN EITHER A RETRY
*P*                OF THE TRAPPED INSTRUCTION, A SKIPPING OF THE
*P*                TRAPPED INSTRUCTION, ABORTING THE CURRENT USER,
*P*                CALLING SYSTEM RECOVERY OR HALTING THE
*P*                SYSTEM COMPLETELY.
*P*
*P*                IF THE HANDLER DECIDES TO HALT THE SYSTEM RATHER
*P*                THAN ATTEMPT SYSTEM RECOVERY OR USER ABORT, THE
*P*                STATUS INFORMATION COLLECTED IS AVAILABLE IN THREE
*P*                TABLES, RESIDENT IN CORE.  THE MAJOR TABLE IS CALLED
*P*                CSED%STOP%TABLE AND AT HALT, ITS ADDRESS IS IN
*P*                REGISTER 7. WITHIN THAT TABLE ON SIGMA 9 OR X560
*P*                MACHINES IS A POINTER TO ANOTHER TABLE C%MSTAT
*P*                WHICH CONTAINS THE MEMORY BANK FAULT STATUS
*P*                COLLECTED. ON X560 MACHINES, THERE IS ANOTHER
*P*                POINTER TO C%PSTAT, THE TABLE OF PROCESSOR
*P*                FAULT STATUS COLLECTED.
*P*
*P*  REFERENCE:  CP-V OPERATIONS REFERENCE MANUAL APPENDIX F
*P*                   (CONTAINS FORMAT FOR IN CORE TABLES)
*P*              CP-V SYSTEM PROGRAMMERS REFERENCE MANUAL APPENDIX E
*P*                   (CONTAINS ERROR LOG FORMATS)
*
         PCC      0
         TITLE    'CSEHAND  -  HARDWARE FAULT HANDLERS'
         DEF      CSEHAND:          MODULE NAME
CSEHAND: EQU      %
BITS     SET      1                 GET BT31TO0 AND MASKS
         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
         TITLE    'CSEHAND  -  CSE%ERR'
         REF      CSE%1             CSE BRANCH TABLE ENTRY #1
         REF      CSE%2             CSE BRANCH TABLE ENTRY #2
         REF      CSE%3             CSE BRANCH TABLE ENTRY #3
         REF      CSE%4             CSE BRANCH TABLE ENTRY #4
         REF      CSE%5             CSE BRANCH TABLE ENTRY #5
         REF      CSE%6             CSE BRANCH TABLE ENTRY #6
         REF      CSE%8             CSE BRANCH TABLE ENTRY #8
         REF      CSE%9             CSE BRANCH TABLE ENTRY #9
         REF      CSE%A             CSE BRANCH TABLE ENTRY #10
         REF      CSE%B             CSE BRANCH TABLE ENTRY #11
         SPACE
CSE%PPOLR         EQU CSE%1
CSE%MPOLR         EQU CSE%2
CSE%PLOG          EQU CSE%3
CSE%MLOG          EQU CSE%4
CSE%PDEL          EQU CSE%5
CSE%MDEL          EQU CSE%6
CSE%GET%CONTENTS  EQU CSE%8
CSE%T46%FIX       EQU CSE%9
CSE%T4C%FIX       EQU CSE%A
CSE%MDEL%IF%LOGGED EQU CSE%B
         SPACE
*   OTHER ITEMS, NOT DATA
         SPACE
         SREF     CSE%PFI           X560 PFI HANDLER
         SREF     CSE%I56%FIX       SIGMA 7 I56 HANDLER
         SREF     CSE%T4D%FIX       SIGMA9-X560 4D HANDLER
         SREF     MOSTAB            * MOS THRESHOLD TABLE
         SPACE
*   ITEMS IN TABLES,ETC.
         SPACE
         REF      CORED             MEMORY POLLING LIMIT (PE SEARCH)
         REF      X0                TABLE CONSTANT
         REF      Y6                TABLE CONSTANT
         REF      S:CUN             USED TO FIND MAP IMAGE IN JIT
         REF      JXCMAP            USED TO FIND MAP IMAGE IN JIT
         REF      JOVVP             USED IN FINDING REAL ADDRESS
         REF      UX:JIT            USED TO FIND MAP IMAGE IN JIT
         REF      ERRLOG            ROUTINE TO LOG ERRORS
         REF      DCT1              TO GET ADDRESS OF OC
         REF      MSROCTY           TO GET ADDRESS OF OC
         REF      OB:BOPTX          TO GET ADDRESS OF OC
         REF      CSEABRT           'MAPPED'CODE TO ABORT  USER IN ROOT
         REF      CSEPMFI           ARM/ENABLE ROUTINE IN ROOT
         REF      CSEANLZ           'MAPPED' CODE TO ANLZ INST IN ROOT
         REF      :BIG              USED IN CONVERTING VIRT-PHYS ADDR
         REF      S:ADR             CPU HARDWARE ADDRESS TABLE
         REF      MP:HPN            GET HARDWARE ADDRESS
         SREF     SLVWAIT           SLAVE CPU BAILOUT
OC       EQU       2
         SPACE
*   ITEMS IN CSE DATA BASE
         SPACE
         REF      CSED%BEST%END     EXIT DECISION - SC,ABORT,RETRY
         REF      F:BREG            X560 LAST BRANCH REGISTER
         REF      CSED%CF           TRAP CC AND FLOATING CONTROLS
         REF      CSED%PSD          TRAP PSD (MOVED TO HERE)
         REF      CSED%LOG%MFI      ERROR LOGGING FLAG FOR SIG9 MFI
         REF      CSED%ERR          TYPE OF TRAP (0-3)
         REF      3COUNT            COUNT OF MEMORY PE'S
         REF      3BUFCLR           MBS INST TO CLEAR 3STAT TABLE
         REF      3ANDADD           AND OF ADDRESSES OF BAD MEM CELLS
         REF      3ANDCONT          AND OF CONTENTS OF BAD MEM CELLS
         REF      3ORADD            OR OF ADDRESSES OF BAD MEM CELLS
         REF      3ORCONT           OR OF CONTENTS OF BAD MEM CELLS
         REF      3FIRST            LOWEST BAD MEM CELL
         REF      3FIRSTC           CONTENTS OF FIRST BAD MEM CELL
         REF      3LAST             HIGHEST BAD MEM CELL
         REF      3LASTC            CONTENTS OF HIGHEST BAD MEM CELL
*
*        REFS FOR ERROR LOG BUFFER IN TCATCH
*
         REF      F:ELOGB           ERROR LOG BUFFER
         REF      FD:EPSD           TRAP PSD IN ERROR LOG BUFFER
         REF      FH:IFLG           FLAG WORD DURING ANLZ PROCESS
         REF      F:IREAL           REAL ADDRESS OF INSTRUCTION
         REF      F:INST            TRAPPED INSTRUCTION
         REF      F:EVIRT           EFF VIRT ADDR OF TRAPPED INST
         REF      F:EREAL           EFF REAL ADDR OF TRAPPED INST
         REF      F:TEMP1           USED FOR MFIX FLAG
         SPACE
         REF      CSED%LINK         TEMP STORE FOR LINK REG
         REF      CSED%MAPPED       FLAG INDICATES MAPPED/UNMAPPED TRAP
         REF      CSED%MSG          OC MESSAGE BUFFER
         REF      CSED%STOP%TABLE   CSE DATA TABLE
         REF      CSED%PATH         REENTRANCY TRACK BITS
         REF      CSED%REGS         SAVE AREA FOR TRAP REGS
         REF      PSD%T46           FIRST OF ORDERED PSD'S 46,4C,4C,I56
         REF      PSD%IOFAIL        PSD FOR :SIO FAILURE (CC3)
         REF      CSED%SPDF         SOFTWARE DOUBLE FAULT FLAG
         REF      CSED%STOP         STOP SEQUENCE COUNTER
         REF      CSED%WHY          WHY CODE FOR STOPPING (MSG INDX)
         REF      CSEP%MSG%SIZE     TEXTC COUNT OF OC MSG BASE
         SPACE
         SREF     C%PSTAT           PROCESSOR STATUS TABLE FOR X560
         SPACE
         DEF      CSE%ERR           ENTRY POINT FOR CSE TRAPS
         DEF      CSE%END           ENTRY POINT FROM CSE%PFI,CSE%FMI
*,*                                 HANDLERS WHEN STOPPING
         DEF      CSE%I56           ENTRY POINT FOR I56 (SIG7 OR X560)
         DEF      CSE%BEST%END%ABORT%STEP ROUTINE FOR SETTING ABORT STEP
         DEF      CSE%BEST%END%SCREECH ROUTINE FOR SETTING SCREECH
         DEF      CSE%BEST%END%STOP ROUTINE FOR SETTING STOP
         DEF      CSE%STOP%IOFAIL   ROUTINE FOR STOPPING IF IO INST FAILS
         DEF      RMAPOLL           ENTRY POINT FROM HANDLERS FOR POLLING
         DEF      CSEARTN           ENTRY POINT TO FINISH ANLZ INST
*
         REF      RMARET            RETURN POINT IN HANDLERS
         REF      RMARET1           RETURN IN HANDLERS IF RETRY IS
*,*                                 IS NOT POSSIBLE
*
         DEF      CSE%MFIX          ROUTINE WHICH SEARCHES FOR MEMORY
*,*                                 PARITY ERRORS, & CLEARS THEM IF POSS
         DEF      CSE%MFIX%ENTRY2   ROUTINE WHICH SETS MPE WHY
*,*                                 CODE FOR BAD MEMORY BANK STATUS
         PAGE
*   THE FOLLOWING TABLE OF EQUATES IS A COMPLETE LIST
*   OF ALL THE BIT DEFINITIONS USED IN THE CSE DATA, ALTHOUGH
*   NOT ALL OF THESE ITEMS ARE USED IN THIS MODULE, THE COMPLETE LIST
*   IS PROVIDED HERE FOR EASE OF REFERENCE
         SPACE
CSEP%WHY%WD       EQU  1            WATCH DOG TIMER
CSEP%WHY%T4D      EQU  2            X'4D' TRAP
CSEP%WHY%T4C      EQU  3            X'4C' TRAP (MISC CAUSES)
CSEP%WHY%MAP      EQU  4            MAP PARITY ERROR
CSEP%WHY%BAD%RBLK EQU  5            REG BLCK PARITY ERROR
CSEP%WHY%MPE      EQU  6            MEMORY PARITY ERROR
CSEP%WHY%PFI      EQU  7            PROCESSOR FAULT INT
CSEP%WHY%PATH     EQU  8            TRAP OF CRITICAL CODE
CSEP%WHY%HARDMPE  EQU  9            HARD MEMORY PARITY ERROR
CSEP%WHY%REENTERED EQU 10           TRAP IN CSE TRAP HANDLER
CSEP%WHY%IOFAIL   EQU  11           IO INSTR FAILURE
CSEP%WHY%WLPE     EQU  12           WRITE LOCK P. E.
         SPACE
CSEP%BEST%END%ABORT%STEP  EQU  1    ABORT JOB STEP (SCREECH)
         SPACE
CSEP%BEST%END%SCREECH     EQU  3    SCREECH ALWAYS
CSEP%BEST%END%STOP        EQU  4    ENTER STOP SEQUENCE TO SHUTDOWN
         SPACE
CSEI%PATH%CSE%SCREECH  EQU  X'01'   CSE HANDLERS INITIATED SCREECH
CSEI%PATH%RECOV        EQU  X'02'   RECOVERY
CSEI%PATH%INIT         EQU  X'04'   INITIAL
CSEI%PATH%MPOL         EQU  X'08'   MEMORY POLLING ROUTINE
CSEI%PATH%PPOL         EQU  X'10'   PROCESSOR POLLING
CSEI%PATH%I56          EQU  X'20'   PFI HANDLER
CSEI%PATH%I57          EQU  X'40'   MFI HANDLER
CSEI%PATH%ERRLOG       EQU  X'80'   ERROR LOGGING ROUTINE
CSEI%PATH%IOPE         EQU  X'100'  I/O PARITY ERROR
         SPACE
CSEP%PFI%BIT  EQU  X'800'           WD BIT FOR PFI
CSEP%MFI%BIT  EQU  X'400'           WD BIT FOR MFI
         SPACE
CSEP%RBLK%PEBIT  EQU  X'4000'       PARITY ERROR IN REGS
FIP      EQU      1                 PARITY ERROR FETCHING INST
IAP      EQU      2                 PARITY ERROR INDIRECT ADDRESS
RBP      EQU      4                 PARITY ERROR REGISTER BLK (560)
RSIPATH  EQU      CSEI%PATH%RECOV+CSEI%PATH%CSE%SCREECH+CSEI%PATH%INIT
         PAGE
*F*  NAME:  CSE%ERR
*F*
*F*  PURPOSE:  PRIMARY ENTRY POINT TO HANDLE HARDWARE FAULTS:
*F*
*F*                TRAP 46 - WATCHDOG TIMER
*F*                TRAP 4C - MEMORY PARITY OR SYSTEM HARDWARE ERROR
*F*                TRAP 4D - INSTRUCTION EXCEPTION
*F*                INTR 56 - SIGMA 6/7 MEMORY PARITY INTERRUPT
*F*                                (VIA CSE%I56)
         SPACE
CSE%ERR  EQU      %
         STCF     CSED%CF           SAVE TCC AND TYPE
         MTW,0    CSED%STOP         TRAP DURING STO SEQ
         BGZ      CSE%STOP          YES, GO TO NEXT PHASE
         MTW,1    CSED%SPDF         HAVE WE BEEN REENTERED
         BGZ      CSE44               YES, ENTER STOP SEQ
         BIF,UNK  CSE%STOP%UNK      IF MONINIT HASN'T SET UP MACH TYPE
         BIF,S7   CSE2              BRANCH IF SIGMA 7
         STW,R1   CSED%REGS         SAVE A REGISTER
         LI,R1    -1                FOR SIGMA 9
         RD,R1    X'031D'           GET Q1D (BRANCH REG)
         STW,R1   F:BREG            SAVE BRANCH REGISTER
CSE1     EQU      %
         LI,R1    CSEP%PFI%BIT+CSEP%MFI%BIT  WD BITS FOR PFI,MFI
         :WD,R1   DISARM            DISARM PFI,MFI
         LW,R1    CSED%REGS         RESTORE R0
         LPSD,1   CSED%PSD%RSETPDF  (IA,CSE2B)
CSE2     EQU      %
         STW,1    CSED%REGS         * STUFF R1 FOR NOW
         LI,1     MOSTAB            * ANY MOS?
         BNEZ     CSE1              * YEP..USE SIGMA 9 PATH
         LW,1     CSED%REGS         * GET BACK R1
CSE2B    EQU      %
         LCI      0                 IN CASE SIGMA 7
         STM,R0   CSED%REGS         SAVE TRAP REGISTERS
         BAL,R11  MP:HPN            GET CPU HARDWARE ADDRESS
         CW,R8    S:ADR             AM I MASTER
         BE       CSE2A             YES,CONTINUE
         LI,R1    -1                RESET SPDF
         STW,R1   CSED%SPDF
         BAL,R11  SLVWAIT           SLAVE BAILOUT
CSE2A    EQU      %
         LB,R1    CSED%CF           GET TCC & FLC
         AND,R1   M2                ONLY WANT FLOATING C
         STW,R1   CSED%ERR          0=T46,1=T4C,2=T4D,3=I56(SIG7)
         CI,R1    3                 IS IT SIGMA 7 I56
         BNE      CSE3              B/ NO
         LPSD,X'3'  CSED%PSD%CLEARI56     YES, CLEAR & ARM I56
CSE3     EQU      %
         MI,R1    2                 CALC DW DISPLACEMENT TO PSD
         LD,R0    PSD%T46,R1        PICK UP TRAP PSD
         STD,R0   CSED%PSD          SAVE IT IN TABLE
         LI,R1    0
         STW,R1   CSED%MAPPED       ZERO OUT MAP FLAG
         AND,R0   Y004              CHECK MAP BIT
         BEZ      CSE4              B/ NOT MAPPED
         MTW,1    CSED%MAPPED       SET MAPPED FLAG
         B        CSE5              GO PROCESS TRAP (NO REENTRY CHECK NEEDED)
CSE4     EQU      %
         LW,R0    CSED%PSD          GET ADDRESS
         AND,R0   M17               GET RID OF JUNK
         CI,R0    CSE%FIN           ADDRESS REENTRANCY CHECK
         BG       CSE5              OK TO PROCESS
         CI,R0    CSE%ERR
         BL       CSE5              B/ OK TO PROCESS
CSE44    EQU      %
         LI,R0    CSEP%WHY%REENTERED
         STW,R0   CSED%WHY          SET WHY CODE
         B        CSE%STOP          ENTER STOP SEQUENCE
CSE5     EQU      %
         MTW,0    CSED%PATH         ARE WE IN CRITICAL PATH
         BEZ      CSE6              B/ NO,OK TO GO AHEAD
         LI,R0    CSEP%WHY%PATH     SET PATH WHY CODE
         STW,R0   CSED%WHY
         LI,R0    RSIPATH           CHECK RECOV,SCREECH INIT PATHS
         CW,R0    CSED%PATH         TRAP DURING REC OR INIT
         BANZ     CSE%STOP          B/ YES, QUIT
         LI,R0    CSEP%BEST%END%SCREECH  NO, SET SCREECH FLAG
         STW,R0   CSED%BEST%END
         B        CSE6A
CSE6     EQU      %                 COME HERE TO PROCESS TRAP
         LI,R0    0
         STW,R0   CSED%BEST%END
         STW,R0   CSED%WHY          ZERO OUT INDICATORS
CSE6A    EQU      %
         LW,R0    CSED%ERR
         CI,R0    2                 IS IT T4D
         BNE      CSE7              B/ NO
         LC       CSED%CF           IS IT ODD REGISTER DESIG
         BCR,X'1'  CSE7             B/ NO
         LI,R11   CSEP%WHY%T4D      SET TO ABORT STEP
         BAL,R12  CSE%BEST%END%ABORT%STEP  OR SCREECH (IF MASTER M.)
         B        CSE%END1          NO ERROR LOG ENTRY ENDPOINT
         PAGE
CSE7     EQU      %
         SPACE
*   NOW WE CAN PROCESS THIS HARDWARE FAULT
         SPACE
         LI,4     0
         BAL,R15  CSE%PPOLR         PROCESSOR POLLING
         BAL,R15  CSE%MPOLR         MEMORY POLLING
         BAL,R15  CSE%ANALYZE%INST  ANALYZE TRAPPED INST
         BAL,R15  CSE%MFIX          CHECK MEMORY FOR SOFT/HARD NESS
         BAL,R15  CSE%ERR%FIX       FIX FOR EACH TYPE OF ERROR
         BAL,R15  CSE%LOG%PRIMARY%ERR  LOG THE PRIMARY FOR THIS ERROR
         LI,4     0
         BAL,R15  CSE%PPOLR         IN CASE WE GENERATED ANY STATUS
         BAL,R15  CSE%PLOG          LOG PPOLR SECONDARIES
         BAL,R15  CSE%MLOG          LOG MPOLR SECONDARIES
         TITLE    'CSEHAND  -  CSE%ERR -  CSE%END'
CSE%END  EQU      %
         LW,R1    CSED%BEST%END
         CI,R1    4                 ARE WE GOING TO STOP
         BGE      CSE%STOP          B/ YES, ENTER STOP SEQ
         BAL,R15  CSE%PDEL          DELETE PPOLR TABLE
         BAL,R15  CSE%MDEL%IF%LOGGED  DELETE MPOLR ENTRIES (IF LOGGED)
CSE%END1 EQU      %
         LI,R0    -1
         STW,R0   CSED%SPDF         RESET DOUBLE FAULT FLAG
         LW,R1    CSED%BEST%END
         B        %+1,R1
         B        CSE%RETURN        0
         B        CSE%ABORT%STEP    1
         B        CSE%ABORT         2   (NOT USED)
CSE%ABORT B       CSE%SCREECH       3
         SPACE
CSE%RETURN  EQU   %
         BAL,R15  CSEPMFI           ARM PFI,MFI
         LCI      0
         LM,R0    CSED%REGS         RESTORE REGS AT TRAP
         LPSD,X'8'    CSED%PSD      RETURN TO USER
         SPACE
CSE%SCREECH  EQU  %
         LI,R1    CSEI%PATH%CSE%SCREECH  .  FLAG TO INDICATE
         STS,R1   CSED%PATH              .  RECOVERY CALLED FROM CSE
         LW,R1    CSED%WHY
         CI,R1    6                 MAX VALUE
         BLE      CSSC1             B/ OK TO USE
         LI,R1    0                 SET TO ZERO
CSSC1    EQU      %
         LW,R15   CSED%SCODE,R1     SET CODE,SUBCODE
         SCREECH  0                 SPECIAL SCREECH FOR MULTIPLE CODES
         SPACE
CSED%SCODE  EQU   %
         DATA     X'260000'         0 (OR >6) USUALLY TRAP DURING PFI
         DATA     X'250000'         1 T46 - WD TIMER
         DATA     X'240000'         2 T4D - INSTR EXCEPT
         DATA     X'290000'         3 T4C - BUS CHECK FAULT
         DATA     X'290001'         4 T4C - MAP PARITY ERROR
         DATA     X'290002'         5 T4C - REGISTER PARITY (X560 ONLY)
         DATA     X'280000'         6 MEMORY PARITY ERROR
         PAGE
**************************************************************
         SPACE
*S*   SCREECH CODE:  24-00
*S*
*S*   MESSAGE:  INSTRUCTION EXCEPTION TRAP IN MASTER MODE
*S*
*S*   REPORTED BY:  CSEHAND
*S*
*S*   TYPE:  SCREECH
*S*
*S*   REMARKS:  TRAP X'4D' WHILE IN MASTER MODE.  (SLAVE TRAPS
*S*             RESULT IN USER JOB STEP ABORT.
*S*
*S*   REGISTERS:  ALL RELEVANT INFORMATION IS IN IN-CORE
*S*               ERROR LOG BUFFERS.
         SPACE
***************************************************************
         SPACE
*S*   SCREECH CODE:  25-00
*S*
*S*
*S*   MESSAGE:  UNRECOVERABLE WATCHDOG TIMER TRAP
*S*
*S*   REPORTED BY:  CSEHAND
*S*
*S*   TYPE:  SCREECH
*S*
*S*   REMARKS:  WATCHDOG TIMER ROUTINE ATTEMPTS TO RECOVER FROM SOME
*S*             TRAPS - EITHER RETRY COUNTER WAS EXHAUSTED OR THIS
*S*             TYPE TRAP NOT RECOVERABLE (NOT I/O INSTRUCTION)
*S*
*S*   REGISTERS:  ALL RELEVANT INFORMATION IS IN IN-CORE
*S*               ERROR LOG BUFFERS.
         SPACE
***************************************************************
         PAGE
*S*   SCREECH CODE:  26-00
*S*
*S*   MESSAGE:  CSE TRAP DURING MFI,PFI HANDLING
*S*
*S*   REPORTED BY:  CSEHAND
*S*
*S*   TYPE:  SCREECH
*S*
*S*   REMARKS:  ON SIGMA 9 DURING MFI HANDLING, OR ON XEROX
*S*             560 DURING MFI OR PFI HANDLING, A CSE TRAP
*S*             (X'46',X'4C',X'4D') OCCURED.
*S*
*S*   REGISTERS:  ALL RELEVANT INFORMATION IS IN IN-CORE
*S*               ERROR LOG BUFFERS.
         SPACE
***************************************************************
         SPACE
*S*   SCREECH CODE:  27-00
*S*
*S*   MESSAGE:  PROCESSOR FAULT INTERRUPT
*S*
*S*   REPORTED BY: CSEHAND
*S*
*S*   TYPE:  SCREECH
*S*
*S*   REMARKS:  FOR XEROX 560 SYSTEMS ONLY, A PROCESSOR FAULT
*S*             INTERRUPT OCCURRED FOR WHICH CONTINUED OPERATION
*S*             IS UNLIKELY.
*S*
*S*   REGISTERS:  ALL RELEVANT INFORMATION IS IN IN-CORE
*S*               ERROR LOG BUFFERS.
         SPACE
***************************************************************
         PAGE
*S*   SCREECH CODE:  28-00
*S*
*S*   MESSAGE:  MEMORY PARITY ERROR - MEMORY ALTERED
*S*
*S*   REPORTED BY:  CSEHAND
*S*
*S*   TYPE:  SCREECH
*S*
*S*   REMARKS:  MEMORY PARITY ERROR CORRECTION CAUSED MEMORY TO BE
*S*             ALTERED, CONTINUATION WITHOUT RECOVERY NOT POSSIBLE.
*S*             CAUSED BY I56 (SIGMA 6/7) OR T4C (SIGMA 9, XEROX 560)
*S*             OR I57 (SIGMA 9, XEROX 560) OR I/O STATUS BITS FOR
*S*             MEMORY DATA ERROR, BCF, AND CCF.
*S*
*S*   REGISTERS:  ALL RELEVANT INFORMATION IS IN IN-CORE
*S*               ERROR LOG BUFFERS.
         SPACE
***************************************************************
         SPACE
*S*   SCREECH CODE:  29-00
*S*
*S*   MESSAGE:  TRAP 4C - BUS CHECK FAULT
*S*
*S*   REPORTED BY:  CSEHAND
*S*
*S*   TYPE:  SCREECH
*S*
*S*   REMARKS:  SIGMA 9 BUS CHECK FAULT, OR XEROX 560 MISCELLANEOUS
*S*             X'4C' TRAP WHILE IN MASTER MODE.
*S*
*S*   REGISTERS:  ALL RELEVANT INFORMATION IS IN IN-CORE
*S*               ERROR LOG BUFFERS.
         SPACE
***************************************************************
         PAGE
*S*   SCREECH CODE:  29-01
*S*
*S*   MESSAGE:  TRAP 4C - MAP PARITY ERROR
*S*
*S*   REPORTED BY:  CSEHAND
*S*
*S*   TYPE:  SCREECH
*S*
*S*   REMARKS:  MAP REGISTER PARITY ERROR ON SIGMA 9 OR XEROX 560
*S*             WHILE IN MASTER MODE.
*S*
*S*   REGISTERS:  ALL RELEVANT INFORMATION IS IN IN-CORE
*S*               ERROR LOG BUFFERS.
         SPACE
***************************************************************
         SPACE
*S*   SCREECH CODE:  29-02
*S*
*S*   MESSAGE:  TRAP 4C - REGISTER BLOCK PARITY ERROR
*S*
*S*   REPORTED BY:  CSEHAND
*S*
*S*   TYPE:  SCREECH
*S*
*S*   REMARKS:  REGISTER BLOCK PARITY ERROR ON XEROX 560 WHILE
*S*             IN MASTER MODE.
*S*
*S*   REGISTERS:  ALL RELEVANT INFORMATION IS IN IN-CORE
*S*               ERROR LOG BUFFERS.
         PAGE
         SPACE
CSE%ABORT%STEP  EQU  %
         LW,R1    Y008              MASTER/SLAVE BIT
         CW,R1    CSED%PSD          CHECK MODE OF TRAP
         BAZ      CSE%SCREECH       B/ SCREECH- MASTER TRAP
         LPSD,0   PSDABRT           GO TO THE ROOT
         PAGE
CSE%STOP%IOFAIL  EQU  %             ENTER FROM INITIAL ETC OF IO INST FAIL
         STCF     CSED%CF           SAVE CC
         LCI      0
         STM,R0   CSED%REGS
         LI,R0    CSEP%WHY%IOFAIL
         STW,R0   CSED%WHY          SET STOP REASON
         LI,R0    0
         STW,R0   CSED%SPDF
         LD,R0    PSD%IOFAIL        GET HIS PSD
         STD,R0   CSED%PSD          PUT IT IN TABLE
         SPACE
CSE%STOP EQU      %
         MTW,1    CSED%STOP         INCR PHASE INDEX
         LW,R1    CSED%STOP
         CI,R1    5
         BGE      CSED%WAIT%LOOP    B/ QUIT
         LPSD,1   CSED%PSD%STOP     RESET PDF, (IA,CSST1)
CSST1    EQU      %
CSED%STOP%BTABLE  B  CSED%STOP%BTABLE,R1     0
         B        CSE%STOP%PPOLR    1
         B        CSE%STOP%MPOLR    2
         B        CSE%STOP%MSG      3
         B        CSE%STOP%WAIT%IN%REGS  4
         SPACE
CSE%STOP%WAIT%IN%REGS  EQU  %
         LI,R7    WA(CSED%STOP%TABLE)  ADDRESS OF TABLE OF INFO
         LW,R5    CSED%WAIT%LOOP    WAIT INSTR
         LW,R6    CSED%REG%WAIT     B   R5
         WD,0     X'41'             TURN ON ALARM
CSED%REG%WAIT  B  R5                GO TO WAIT LOOP
CSED%WAIT%LOOP WAIT
         B        %-1
         SPACE
         SPACE
CSE%STOP%PPOLR  EQU  %
         LI,4     0
         BAL,R15  CSE%PPOLR
         B        CSE%STOP
         SPACE
CSE%STOP%MPOLR  EQU  %
         BAL,R15  CSE%MPOLR
         B        CSE%STOP
         SPACE
CSE%STOP%MSG  EQU  %
         LI,R3    CSEP%MSG%SIZE     SIZE OF FIXED PORTION OF MESSAGE
         AI,R3    BA(CSED%MSG)      ADD START ADDRESS TO DISPLACEMENT
         LW,R2    CSED%WHY          WHY CODE
         LB,R2    CSED%MSG%WHY,R2   MSG DISPL FRM BASE
         AI,R2    BA(CSED%MSG%BASE) ADD BASE ADDRESS
         LB,R1    0,R2              PICK UP BYTE COUNT
         STB,R1   R3                COUNT FOR MBS
         LI,R4    CSEP%MSG%SIZE     SIZE OF FIXED PART
         AW,R4    R1                ADD ADDITIONAL COUNT
         MBS,R2   1                 SKIP TEXTC BYTE IN SOURCE
         AWM,R4   CSED%IOCD+1       PUT BYTE COUNT INTO IOCD
         LI,R0    DA(CSED%IOCD)     ADDRESS OF IOCD TO R0
         LI,R1    X'7FFFF'
         BDR,R1   %                 SPIN AWHILE
         LI,R2    OC                OC OP LABEL INDEX
         LB,R2    OB:BOPTX,R2       DCTX OF OC
         LH,R2    DCT1,R2           ADDRESS OF OC DEVICE
         RIO,0    0,R2              RIO TO OC  (HIO ON SIG7)
         LI,R1    X'7FFFF'
         BDR,R1   %                 WAIT FOR OC TO SETTLE
         SIO,R1   *R2               GIVE MSG
         B        CSE%STOP          IGNORE ERRORS
         PAGE
CSE%STOP%UNK  EQU  %                COME HERE IS TRAP IN UNKNOWN MACHINE
         LI,R1    3                 CODE TO SKIP ALL STEPS
         STW,R1   CSED%STOP         EXCEPT WAIT LOOP
         B        CSE%STOP
         SPACE
*   ENTER WITH CSEP%WHY%CODE IN R11
         SPACE
CSE%BEST%END%ABORT%STEP  EQU  %
         LI,R10   CSEP%BEST%END%ABORT%STEP
         B        CSE%BEST%END
         SPACE
CSE%BEST%END%SCREECH  EQU  %
         LI,R10   CSEP%BEST%END%SCREECH
         B        CSE%BEST%END
         SPACE
CSE%BEST%END%STOP  EQU  %
         LI,R10   CSEP%BEST%END%STOP
         SPACE
CSE%BEST%END  EQU  %                ENTER HERE WITH BEST%END IN R10
         CW,R10   CSED%BEST%END     COMPARE W/ PREV CODE
         BL       *R12              EXCEEDED, RETURN
         BG       CSBE1             B/ REPLACE W/ NEW BE CODES
         CW,R11   CSED%WHY          CHECK WHY CODE
         BGE      CSBE2             NO NEED TO CHANGE
CSBE1    EQU      %
         STW,R11  CSED%WHY
         STW,R10  CSED%BEST%END
CSBE2    EQU      %
         B        *R12              GO BACK
         TITLE    'CSEHAND  -  CSE%I56'
*F*  NAME:  CSE%I56
*F*
*F*  PURPOSE:  TARGET OF INTERRUPT 56 XPSD, TRANSFERS CONTROL TO
*F*            CSE%ERR IF SIGMA 6/7, OR TO CSE%PFI IF ON XEROX 560
     SPACE
CSE%I56  EQU      %
         STCF     CSED%CF           SAVE TRAP CC AND FC
         BIF,S7   S7MFI             B/ SIGMA 7
         LCF      CSED%CF           GET CC
         B        CSE%PFI           X560 PFI HANDLER
S7MFI    LCF      CSED%CF           GET CC BACK
         B        CSE%ERR           GO PROCESS AS MEMORY ERROR
         TITLE    'CSEHAND - RMAPOLL'
*F*  NAME:  RMAPOLL
*F*
*F*  PURPOSE:  TO PROVIDE MEMORY AND PROCESSOR POLLING AND
*F*            LOGGING ROUTINES TO THE I/O HANDLERS
*F*
*F*  DESCRIPTION:  RMAPOLL IS CALLED FROM I/O ERROR HANDLING ROUTINE
*F*                WHEN IT DETECTS A MEMORY PARITY ERROR, BUS
*F*                CHECK FAULT, OR CONTROL CHECK FAULT IN THE
*F*               TIO/TDV STATUS IT USUALLY GENERATES ERROR LOG ENTRIES
*F*               #42, #43, AND #49. IF AN UNRECOVERABLE MEMORY PROBLEM
*F*                IS FOUND THE HALT FLAG IS SET AND THE ROUTINE EXITS
*F*                TO THE END OF THE STANDARD TRAP ROUTINE FOR
*F*                HARDWARE FAULTS AT CSE%END
*F*
*F*                IF NO MEMORY PROBLEMS ARE FOUND, RETURN IS TO
*F*                RMARET FOR I/O RETRY, IF MEMORY PROBLEMS ARE FOUND
*F*                RETURN IS TO RMARET1, TO INDICATE THAT RETRY
*F*                IS NOT POSSIBLE BECAUSE MEMORY HAS BEEN ALTERED.
         SPACE
RMAPOLL  EQU      %
         DISABLE                    ** DISABLE **
         PUSH     16,R0             SAVE ALL REGS
         LI,4     0
         CW,10    Y6                CHECK STATUS WORD FOR BUS CHECK
         BAZ      %+2               OR CONTROL CHECK. SET R4 WITH
         LH,4     DCT1,1            PROCESSOR NR. IN CASE ITS A SIG9.
         LI,R1    CSEP%PFI%BIT+CSEP%MFI%BIT
         :WD,R1   DISARM            DISARM PFI,MFI
         LI,R1    CSEI%PATH%IOPE    IO PARITY ERROR FLAG
         STW,R1   CSED%PATH         PATH BIT FOR REENTRY CHECK
         BAL,R15  CSE%PPOLR         PROCESSOR POLLING
         BAL,R15  CSE%MPOLR         MEMORY POLLING
         BAL,R15  CSE%MFIX          LOOK AT MPOLL ENTRIES
         BAL,R15  CSE%PLOG          LOG PPOLL SECONDARIES
         BAL,R15  CSE%MLOG          LOG MEMORY SECONDARIES
         LI,R1    4                 BSET END FLAG FOR STOP
         CW,R1    CSED%BEST%END     CHECK RESULTS
         BE       CSE%STOP
         BAL,R15  CSE%PDEL          GO DELETE PPOLR ENTRIES
         BAL,R15  CSE%MDEL          GO DELETE MPOLR ENTRIES
         LI,R1    0
         STW,R1   CSED%PATH         RESET PATH BITS
         BAL,R15  CSEPMFI           ARM PFI MFI
         PULL     16,R0             GET REGS BACK
         ENABLE
         MTW,0    CSED%BEST%END     IF NON-ZERO...
         BNEZ     RMARET1           WE PROBABLY CLOBBERED MEMORY
         B        RMARET            GO BACK TO HANDLERS
         TITLE    'CSEHAND - CSE%ANALYZE%INST'
CSE%ANALYZE%INST  EQU  %
         LI,R0    0
         LI,R4    -11               ZERO OUT BUFFER AREA
         STW,R0   F:ELOGB+11,R4
         BIR,R4   %-1
         LI,0     MOSTAB            * ANY MOS
         BNEZ     CSEAIO            * YEP...SKIP THIS TEST
         LI,R0    3                 IS THIS...
         CW,R0    CSED%ERR          SIGMA 7 - I56
         BE       CSIA11            B/ YES, SET (FIP) AND RETURN
CSEAIO   EQU      %
         LW,R0    CSED%PSD          GET TRAPPED ADDRESS
         AND,R0   M17               STRIP OFF JUNK
         MTW,0    CSED%ERR
         BNEZ     CSIA0             NOT WD TIMER TRAP
         BIF,S7X560  CSIA0          WD, BUT NOT SIGMA 9
         LC       CSED%CF
          BCR,X'8'  CSIA0                NOT PHASE ONE TIMEOUT
         AI,R0    -1                ADJUST ADDR TO POINT TO INST
CSIA0    EQU      %
         BAL,R13  CSE%GET%REAL%ADR  CONVERT TO REAL ADDR
         STW,R0   F:IREAL           SAVE REAL ADDR OF INST
CSIA1    BAL,R13  CSE%GET%CONTENTS  REAL ADDRESS IN R0
         STW,R0   F:INST            R0=INSTRUCTION
         BCR,1    CSIA2             NO PARITY ERROR, OK
CSIA11   MTH,FIP  FH:IFLG           PARITY ERROR FETCHING INST
         B        *R15              SET FLAG, RETURN
CSIA2    AI,R0    0                 INDIRECT SET ?
         BGEZ     CSEANLZ           ANLZ INST IN ROOT
         AND,R0   M17               YES, CHECK FURTHER
         BAL,R13  CSE%GET%REAL%ADR  FIND REAL ADDDR OF IND FETCH
         BAL,R13  CSE%GET%CONTENTS  R0 CONTAINS ADDR OF OPERAND
         BCR,1    CSEANLZ           ANLZ INST IN ROOT
         MTH,IAP  FH:IFLG           SET INDIRECT PARITY
         B        *R15              AND RETURN
*
*                 INSTRUCTION ANALYSIS IN PFSR MODULE
*
CSEARTN  EQU      %                 RETURN FROM ANLZ OF INST
         LCF      R0                GET CCS
         BCS,1    *CSED%LINK        IMMED INST, QUIT
         BAL,R13  CSE%GET%REAL%ADR1 GET REAL EFF ADDR (USES ANLZ CC)
         STW,R0   F:EREAL
         LB,R0    F:INST
         AND,R0   M7                GET RID OF IND BIT
         CI,R0    X'67'             EXU ?
         BNE      *CSED%LINK        B/ NO, RETURN
         LW,R0    F:EVIRT           GET OBJECT INST
         LW,R15   CSED%LINK         RESTORE LINK REGISTER
         B        CSIA0             AND RECYCLE
         SPACE
         SPACE
CSE%GET%REAL%ADR   EQU  %
         LCI      8                 SET WORD ADDRESSING
CSE%GET%REAL%ADR1  EQU  %
         STCF     R5                SAVE  CC
         STCF     R6                SAVE IT AGAIN
         MTW,0    CSED%MAPPED       WERE WE MAPPED
         BEZ      CSGET2            NO, GO BACK
         SLD,R0   -8                JUST RIGHT FOR DW ADDR
         LI,R4    0
         SLD,R4   2                 GET CC1,CC2
*                                   B=0, HW=1, W=2, DW=3
         AI,R4    -3                SUBT 3, GIVING
*                                   B=-3, HW=-2, W=-1, DW=0
         SLD,R0   0,R4              SHIFT R0 TO GET PAGE ADDR
         AND,R0   M8                GET RID OF ANY ANLZ FLGS
         CI,R0    JOVVP             ARE WE BELOW MAP IMAGE (I.E. 1-1 MAP)
         BL       CSGET1            YES, 1 - 1 MAPPING
         LW,R2    S:CUN             GET CURRENT USER #
         LOAD,R2  UX:JIT,R2         GET REAL PAGE # OF HIS JIT
         SLS,R2   9                 MAKE INTO WORD ADDR
         LI,R3    JXCMAP            BYTE DISP TO JXCMAP
         SLS,R3   -:BIG             BIG MAP NEEDS HW DISP
         AW,R3    R0                ADD VIRTUAL PAGE NUMBER
         LOAD,R0  *R2,R3            GET REAL PAGE IN R0
CSGET1   LCF      R6                GET CC
         STCF     R5
         LI,R4    0
         SLD,R4   2                 GET CC1,CC2
         LI,R5    3
         SW,R5    R4                SBTR CC1 CC2 FROM 3
         SLD,R0   0,R5              PUT BACK SOME ADDRESS BITS
         SLD,R0   8                 PUT BACK THE REST
CSGET2   EQU      %
         B        *R13              RETURN
         TITLE    'CSEHAND  -  CSE%ERR%FIX'
CSE%ERR%FIX  EQU  %
         LW,R1    CSED%ERR          FROM TRAP FLOATING CONTROLS
         B        %+1,R1
         B        CSE%T46%FIX       0 - SIG7,SIG9,X560
         B        CSE%T4C%FIX       1 - SIG9,X560
         B        CSE%T4D%FIX       2 - SIG9,X560
         LI,11    MOSTAB            * IF A MOS SIGMA 7....
         BNEZ     CSE%T4C%FIX       * -> 3 (ACTUALLY 1)
         B        CSE%I56%FIX       * -> 3 (CORE SIGMA 7)
         TITLE    'CSEHAND  -  CSE%LOG%PRIMARY%ERR'
CSE%LOG%PRIMARY%ERR  EQU  %
         SPACE
*                 CAUSE             CSED%ERR
*  COMMON TO #2D   T4C                 1
*            #2D   I56 (SIG 7 ONLY)    3
*            #2E   T46                 0
*            #2F   T4D                 2
         SPACE
*        LINK IS R15, ALL REGS VOLATILE
         LD,R0    CSED%PSD          GET PSD
         STD,R0   FD:EPSD           IN ERROR LOG BUFFER
         LW,R1    CSED%ERR          ERROR CODE
         LH,R3    CSED%ERR%TYPE,R1  GET ERROR CODE,COUNT
         SLS,R3   16
         OR,R3    S:ADR             MERGE IN CPU ADDRESS
         STW,R3   F:ELOGB
         LB,R3    CSED%CF           MERGE CCS
         STB,R3   FH:IFLG           IN FLAG WORD IN BUFFER
         LI,R6    F:ELOGB           ADDRESS OF MESSAGE
         OR,R6    Y1                BIT TO TELL ERRLOGGER NOT TO ENABLE
         BAL,R5   ERRLOG            GO LOG IT
         B        *R15              GO BACK
         SPACE
CSED%ERR%TYPE  EQU  %
         DATA,2   X'2E0B'           T46
         DATA,2   X'2D0B'           T4C
         DATA,2   X'2F0B'           T4D
         DATA,2   X'2D0B'           I56 (SIGMA 7)
         TITLE    'CSEHAND  -  CSE%MFIX'
         SPACE
*F*  NAME:  CSE%MFIX
*F*
*F*  PURPOSE:  TO CHECK EVERY WORD OF MEMORY FOR PARITY ERRORS
*F*            AND IF ANY ARE FOUND TO GENERATE DATA IN
*F*            CSED%3STAT FOR THE TYPE #49 ERROR LOG ENTRY.
*F*
*F*  DESCRIPTION:  CHECKS EACH LOCATION FOR A PRITY ERROR
*F*                USING THE MACHINE DEPENDANT ROUTINE
*F*                CSE%GET%CONTENTS.  DATA COLLECTED INCLUDES THE
*F*                NUMBER OF BAD LOCATIONS, ADDRESS AND CONTENTS
*F*                OF THE LOWEST AND HIGHEST BAD LOCATIONS,
*F*                THE LOGICAL OR AND THE LOGICAL AND OF THE BAD
*F*                ADDRESSES AND LOCICAL OR AND THE LOGICAL AND OF
*F*                THE CONTENTS OF THE BAD LOCATIONS
         SPACE
*   ENTER WITH BAL,R15  ALL REGISTERS VOLATILE
         SPACE
CSE%MFIX  EQU     %
         LI,R0    0                 ZERO OUT MFIX FLAG
         XW,R0    F:TEMP1
         BEZ      *R15              NOT SET, RETURN
         MTW,0    3COUNT            HAVE WE ALREADY COME THRU HERE
         BNEZ     CSE%MFIX1         B/ YES, DONT INITIALIZE
         LI,R4    -1                SET UP FOR ANDS
         LI,R5    -1                SET UP FOR ANDS
         B        CSE%MFIX2
CSE%MFIX1  EQU    %
         LW,R4    3ANDADD           PICK UP PREVIOUS VALUES
         LW,R5    3ANDCONT
CSE%MFIX2  EQU    %
         LI,R1    16                STARTING MEMORY ADDRESS
LOOPCHEK LW,R0    R1                R0 IS USED/DESTROYED BY ROUTINE
         BAL,R13  CSE%GET%CONTENTS  GET DATA
         STW,R0   R3                SAVE CONTENTS
         BCS,1    CHECKPAR          B/ PARITY ERROR ON THIS LOCATION
LOOPER   EQU      %
         AI,R1    1                 INCR ADDRESS
         CW,R1    CORED             COMPARE WITH MAX MEMORY ADDRESS+1
         BL       LOOPCHEK          B/ NOT DONE YET
         STW,R4   3ANDADD           SAVE LOGICAL AND OF ADDRESSES
         STW,R5   3ANDCONT          SAVE LOGICAL AND OF CONTENTS
         B        *R15              RETURN
CHECKPAR EQU      %
         MTW,0    3COUNT            IS THIS FIRST ENTRY ?
         BNEZ     CHECKPAR1         B/ NO
         STW,R1   3FIRST            SAVE FIRST BAD ADDRESS
         STW,R0   3FIRSTC           SAVE FIRST BAD CONTENTS
         BIF,S7   CHECKPAR1         B/ IF SIGMA 6/7
         LC       R2                GET LAST LMS STATUS
         STCF     3FIRST            SAVE IT
CHECKPAR1  EQU    %
         STW,R1   3LAST             SAVE AS LAST BAD ADDRESS
         STW,R0   3LASTC            SAVE AS LAST BAD CONTENTS
         MTW,1    3COUNT            INCR COUNT OF BAD LOCATIONS
         STS,R1   3ORADD            LOGICAL OR OF BAD ADDRESSES
         STS,R3   3ORCONT           LOGICAL OR OF BAD CONTENTS
         AND,R4   R1                AND OF BAD ADDRESSES
         AND,R5   R0                AND OF BAD CONTENTS
         LI,R2    0                 TRY ZEROS
         STW,R2   *R1               CLEAR BAD LOCATION
         LW,R0    R1                GET ADDRESS BACK INTO R0
         BAL,R13  CSE%GET%CONTENTS
         BCS,1    BADBAD            B/ CELL IS REALLY BAD
         LI,R2    -1                TRY ALL ONES
         LW,R0    R1                GET ADDRESS BACK
         STW,R2   *R1
         BAL,R13  CSE%GET%CONTENTS
         BCS,1    BADBAD            B/ BAD MEMORY CELL
         STW,R3   *R1               PUT ORIGINAL CONTENTS BACK
         B        LOOPER            GO DO NEXT LOCATION
BADBAD   EQU      %
         LW,R2    =X'0BAD0BAD'      MARK THIS CELL
         STW,R2   *R1
         BAL,R13  CSE%MFIX%ENTRY2
         B        LOOPER
         SPACE
*F*  NAME:  CSE%MFIX%ENTRY2
*F*
*F*  PURPOSE:  SETS MEMORY PARITY ERROR WHY CODE AND HALT FLAG;
*F*            USED BY MEMORY POLLING ROUTINES WHEN UNRECOVERABLE
*F*            ERRORS ARE FOUND.
         SPACE
CSE%MFIX%ENTRY2  EQU  %
         SPACE
         MTW,1    CSED%LOG%MFI      SET TO LOG ALL ENTRIES
         LI,R11   CSEP%WHY%HARDMPE  SET WHY CODE
         BAL,R12  CSE%BEST%END%STOP
         B        *R13              RETURN -> WILL ENTER STOP SEQ
         SPACE
         PAGE
CSED%MSG%BASE  EQU  %
CSED%MSG%T46  TEXTC  'WD TRAP'        ABORT JOB STEP
*        NO MSG NEED FOR T4D
CSED%MSG%T4C  TEXTC  '4C TRAP'        ABORT JOB STEP
CSED%MSG%MAP  TEXTC  'MAP PE'            ABORT JOB STEP
CSED%MSG%RBLK  TEXTC  'REG PE'    ABORT JOB STEP
*        NO MSG FOR MPE
*        NO MSG FOR PFI
CSED%MSG%PATH  TEXTC  'FLT DURING INIT'
CSED%MSG%HARDMPE  TEXTC  'MEM PE'
CSED%MSG%REENTERED  TEXTC  'DBL FLT'
CSED%MSG%IOFAIL  TEXTC  'I/0 INST FAIL'
CSED%MSG%WHY  EQU  %                INDEX BY WHY CODE TO GET MSG
         DATA,1   X'FF'             DONT USE INDEX OF 0
         DATA,1   BA(CSED%MSG%T46)-BA(CSED%MSG%BASE)
         DATA,1   X'FF'             NO SUCH MSG
         DATA,1   BA(CSED%MSG%T4C)-BA(CSED%MSG%BASE)
         DATA,1   BA(CSED%MSG%MAP)-BA(CSED%MSG%BASE)
         DATA,1   BA(CSED%MSG%RBLK)-BA(CSED%MSG%BASE)
         DATA,1   X'FF'
         DATA,1   X'FF'
         DATA,1   BA(CSED%MSG%PATH)-BA(CSED%MSG%BASE)
         DATA,1   BA(CSED%MSG%HARDMPE)-BA(CSED%MSG%BASE)
         DATA,1   BA(CSED%MSG%REENTERED)-BA(CSED%MSG%BASE)
         DATA,1   BA(CSED%MSG%IOFAIL)-BA(CSED%MSG%BASE)
         PAGE
*   PSD'S USED THROUGHOUT ROUTINE
         SPACE
CSED%PSD%CLEARI56  :PSD  (IA,CSE3),(INH)
CSED%PSD%RSETPDF  :PSD     (IA,CSE2B),(INH)
CSED%PSD%STOP      :PSD  (IA,CSST1),(INH)
PSDABRT  :PSD     (IA,CSEABRT),(MAP),(INH)
CSED%IOCD  GEN,8,24,32  5,BA(CSED%MSG),0    IOCD FOR STOP MSG
         SPACE
CSE%FIN  EQU      %                 LABEL FOR REENTRANCY CHECKS
         SPACE
         END

