         PCC      0
         TITLE    'CSEHAND  -  HARDWARE FAULT HANDLERS'
         DEF      CSEHAND:
CSEHAND: EQU      %
         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'
*        ITEMS IN CSEBRANCH TABLE
         SPACE
         REF      CSE%1,CSE%2,CSE%3,CSE%4,CSE%5,CSE%8
CSE%MLOG          EQU  CSE%4
         REF      CSE%9,CSE%A
         SPACE
CSE%PPOLR         EQU CSE%1
CSE%MPOLR         EQU CSE%2
CSE%PLOG          EQU CSE%3
CSE%PDEL          EQU CSE%5
CSE%GET%CONTENTS  EQU CSE%8
CSE%T46%FIX       EQU CSE%9
CSE%T4C%FIX       EQU CSE%A
         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
         REF      CSE%MDEL%IF%LOGGED
         SPACE
*   DATA BASE IN M:CPU
         SPACE
         SREF     CSEP%MSTAT%SZE
         SREF     CSED%MSTAT
         SREF
         SPACE
*   ITEMS IN TABLES,ETC.
         SPACE
         REF      Y8,M7,CORED
         REF      M16
         REF      M17
         REF      M2
         REF      M8
         REF      Y004
         REF      Y008
         REF      Y01
         REF      Y1
         REF      X0
         REF      S:CUN
         REF      ERRLOG
         REF      JXCMAP
         REF      JOVVP
         REF      DCT1,MSROCTY,OB:BOPTX,UX:JIT,T:ABORTM
         REF      :BIG
OC       EQU       2
         SPACE
*   ITEMS IN CSE DATA BASE
         SPACE
         REF      CSED%BEST%END,CSED%BREG,CSED%CF
         REF      CSED%PSD,CSED%EA%REAL,CSED%EA%VIRT
         REF      CSED%LOG%MFI
         REF      3COUNT,CSED%3STAT,3BUFCLR
         REF      3ANDADD,3ANDCONT
         REF      3ORADD,3ORCONT
         REF      3FIRST,3FIRSTC
         REF      3LAST,3LASTC
         REF      CSED%EL%PSD,CSED%ERR,CSED%ERRLOG%BUF
         REF      CSED%FI%REAL,CSED%INST
         REF      CSED%IA%FLAGS
CSEI%FI%PAR  EQU  1                 .  USED VIA
CSEI%IND%PAR EQU  2                 .  MTW,CSEI%....  CSED%IA%FLAGS
CSEI%BAD%RBLK EQU 4                 .
         SPACE
         REF      CSED%LINK,CSED%MAPPED,CSED%MSG
         REF      CSED%STOP%TABLE
         REF      CSED%PATH,CSED%PMFI%DISARMED
         REF      CSED%PSD%T46,CSED%REGS
         REF      CSED%PSD%IOFAIL
         REF      CSED%SPDF,CSED%STOP,CSED%WHY
         REF      CSEP%MSG%SIZE
         SPACE
*   DEFS AND EQUATES FOR ITEMS
         SPACE
         DEF      CSEP%WHY%WD,CSEP%WHY%T4D,CSEP%WHY%T4C
         DEF      CSEP%WHY%MAP,CSEP%WHY%BAD%RBLK,CSEP%WHY%MPE
         DEF      CSEP%WHY%PFI,CSEP%WHY%PATH,CSEP%WHY%HARDMPE
         DEF      CSEP%WHY%REENTERED,CSEP%WHY%IOFAIL,CSEP%WHY%WLPE
         DEF      CSEI%PATH%CSE%SCREECH,CSEI%PATH%RECOV,CSEI%PATH%INIT
         DEF      CSEI%PATH%MPOL,CSEI%PATH%PPOL,CSEI%PATH%I56
         DEF      CSEI%PATH%I57
         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
*   ITEMS FOR XEROX 560
         SREF     CSED%BP%STATUS
CSEP%RBLK%PEBIT  EQU  X'4000'       PARITY ERROR IN REGS
         SPACE
         DEF      CSE%ERR           ENTRY POINT
         DEF      CSE%END           ENTRY FROM CSE%PFI,CSE%MFI HANDLERS
         DEF      CSE%I56           ENTRY POINT FOR I56
         DEF      CSE%BEST%END%ABORT%STEP
         DEF      CSE%BEST%END%SCREECH
         DEF      CSE%BEST%END%STOP
         DEF      CSE%STOP%IOFAIL
         DEF      RMAPOLL           ENTRY FROM HANDLERS
         REF      RMARET            RETURN POINT IN HANDLERS
         REF      RMARET1
         DEF      CSE%MFIX
         DEF      CSE%MPOLR
         PAGE
*        ENTRY POINT FOR T46,T4C,T4D, AND TRANSFERED TO
*        FROM SIG7 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   CSED%BREG         PUT IT AWAY
CSE1     EQU      %
         LI,R1    CSEP%PFI%BIT+CSEP%MFI%BIT  WD BITS FOR PFI,MFI
         WD,R1    X'1100'           DISARM PFI,MFI
         MTW,1    CSED%PMFI%DISARMED  INCR NESTING CONTROL
         LW,R1    CSED%REGS         RESTORE R0
         LPSD,1   CSED%PSD%RSETPDF  RESET HARDWARE PDF (IA,CSE2)
CSE2     EQU      %
         LCI      0                 IN CASE SIGMA 7
         STM,R0   CSED%REGS         SAVE TRAP REGISTERS
         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    CSED%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
         MTW,0    CSED%ERR          IS IT WD TRAP (T46=0)
         BNEZ     CSE51             B/ NOT WD
         BIF,S7X560  CSE51          B/ NOT SIGMA 9
         LC       CSED%CF           GET TCC
         BCS,X'8'  CSE%RETURN       IGNORE SIG9 PHASE 1 TIMEOUT
CSE51    EQU      %
         LI,R0    CSEP%WHY%PATH     SET PATH WHY CODE
         STW,R0   CSED%WHY
         LI,R0    CSEI%PATH%RECOV+CSEI%PATH%CSE%SCREECH
         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
         SPACE
CSE7     EQU      %
         SPACE
*   NOW WE CAN PROCESS THIS HARDWARE FAULT
         SPACE
         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
         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  CSE%ARM%PMFI%UNLESS%NESTED  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 INVALID
         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
         SPACE
CSED%ABORT%CODE  EQU  %
         DATA,2   X'0000'           NOT USED
         DATA,2   X'A40A'           WD TIMER -T46
         DATA,2   X'A40D'           INSTR EXCEP -T4D
         DATA,2   X'A40C'           BUS CHECK FAULT -T4C
         DATA,2   X'A40E'           MAP PARITY ERROR -T4C
         DATA,2   X'A40F'           REGISTER PARITY ERROR -T4C
         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
         BAL,1    CSE%MAP           GO MAPPED
         LCI      0
         LM,R0    CSED%REGS         PICK UP USERS REGS
         PUSH     7,R13             PUT INTO ENVIRONMENT IN HIS JIT
         LD,R0    CSED%PSD
         PUSH     12,R4
         LI,R4    -17
         AW,R4    TSTACK
         STD,R0   *R4
         LI,R1    -1                RESET CONDITION
         STW,R1   CSED%SPDF         FOR REENTRANCY CHECK
         BAL,R15  CSE%ARM%PMFI%UNLESS%NESTED  ARM PFI,MFI
         LW,R1    CSED%WHY          WHY CODE IS INDEX TO ABORT CODE
         LH,R14   CSED%ABORT%CODE,R1 GET ABORT CODE
         AND,R14  M16               GET RID OF SIGN EXTENSION BITS
         SCS,R14  -8                SET UP FOR T:ABORTM
         B        T:ABORTM
         SPACE
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%MAPPED
         STW,R0   CSED%SPDF
         LD,R0    CSED%PSD%IOFAIL   GET HIS PSD
         STD,R0   CSED%PSD          PUT IT IN TABLE
         CW,R0    Y004              CHECK MAPPED BIT
         BAZ      CSE%STOP          ENTER STOP SEQ
         MTW,1    CSED%MAPPED       SET MAPPED FLAG
         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  %
         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
         SPACE
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'
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  -  CSE%ANALYZE%INST'
         TITLE    'CSEHAND  -  RMAPOLL'
RMAPOLL  EQU      %
         PUSH     16,R0             SAVE ALL REGS
         BAL,R15  CSE%DISARM%PMFI
         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
         LI,R1    0
         STW,R1   CSED%PATH         RESET PATH BITS
         BAL,R15  CSE%ARM%PMFI%UNLESS%NESTED
         PULL     16,R0             GET REGS BACK
         MTW,0    CSED%BEST%END     IF NON-ZERO...
         BNEZ     RMARET1           WE PROBABLY CLOBBERED MEMORY
         B        RMARET            GO BACK TO HANDLERS
CSE%ANALYZE%INST  EQU  %
         LI,R0    0
         STW,R0   CSED%INST         TRAPPED INST
         STW,R0   CSED%FI%REAL      REAL ADDR OF INST
         STW,R0   CSED%EA%VIRT      VIRT ADDR OF INST
         STW,R0   CSED%IA%FLAGS     MAP AND PARITY ERROR BITS
         LI,R0    4                 IS THIS...
         CW,R0    CSED%ERR          SIGMA 7 - I56
         BE       CSIA11            B/ YES, SET (FIP) AND RETURN
         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
         BCS,X'7' 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   CSED%FI%REAL      SAVE REAL ADDR OF INST
CSIA1    BAL,R13  CSE%GET%CONTENTS  REAL ADDRESS IN R0
         STW,R0   CSED%INST         R0  = INSTRUCTION
         BCR,1    CSIA2             NO PARITY ERROR, OK
CSIA11   MTW,CSEI%FI%PAR  CSED%IA%FLAGS  PARITY ERROR FETCHING INST
         B        *R15              SET FLAG, RETURN
CSIA2    MTW,0    CSED%INST         INDIRECT SET
         BGEZ     CSIA4             B/ NO OK TO ANLZ NOW
         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    CSIA4             B/ OK TO CONTINUE
         MTW,CSEI%IND%PAR  CSED%IA%FLAGS  SET INDIRECT PARITY FLAG
         B        *R15              AND RETURN
CSIA4    LW,R1    Y004              MAP BIT IN
         CW,R1    CSED%PSD          TRAPPED PSD
         BAZ      CSIA44            B/ NOT MAPPED
         BAL,R1   CSE%MAP           GO MAPPED
CSIA44   EQU      %
         STW,R15  CSED%LINK         SAVE RETURN LINK
CSIA6    LCI      0
         LM,R0    CSED%REGS         GET HIS REGS
CSIA7    ANLZ,R1  CSED%INST         ANLZ INST
         STCF     CSED%LINK         TEMP SAVE OF CC
         STW,R1   CSED%EA%VIRT      SAVE EFF ADDR
         LPSD,0   CSED%PSD%RB0NMAP   R BLK 0, NO MAP, (IA,CSIA8)
CSIA8    EQU      %
         LW,R0    CSED%EA%VIRT      GET EFF ADDRESS
         LCF      CSED%LINK         GET CC
         STCF     CSED%EA%VIRT      SAVE ANLZ CC
         BCS,1    *CSED%LINK        IMMED INST, QUIT
         BAL,R13  CSE%GET%REAL%ADR1 GET REAL EFF ADDR (USES ANLZ CC)
         STW,R0   CSED%EA%REAL
         LB,R0    CSED%INST         GET OP CODE
         AND,R0   M7                GET RID OF IND BIT
         CI,R0    X'67'             EXU ?
         BNE      *CSED%LINK        B/ NO, RETURN
         LW,R0    CSED%EA%VIRT      GET OBJECT INST
         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
         B        CSE%I56%FIX       3 - SIG7
         TITLE    'CSEHAND  -  CSE%LOG%PRIMARY%ERR'
CSE%LOG%PRIMARY%ERR  EQU  %
         SPACE
*                 CAUSE             CSED%ERR
*  COMMON TO #17   T4C                 1
*            #17   I56 (SIG7 ONLY)     3
*            #19   T46                 0
*            #1D   T4D                 2
         SPACE
*        LINK IS R15, ALL REGS VOLATILE
         LD,R0    CSED%PSD          GET PSD
         STD,R0   CSED%EL%PSD       ERROR LOG BUFFER
         LW,R1    CSED%ERR          ERROR CODE
         LH,R3    CSED%ERR%TYPE,R1  GET ERROR CODE,COUNT
         LW,R0    CSED%IA%FLAGS     GET FLAGS
         LC       CSED%CF           GET TCC
         STCF     R1
         SLD,R0   4                 MOVE IN TCC
         STH,R3   R0                PUT IN CODE,COUNT
         STW,R0   CSED%ERRLOG%BUF   PUT IT ALL IN BUFFER
         LI,R6    WA(CSED%ERRLOG%BUF) 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'190A'           T46
         DATA,2   X'170A'           T4C
         DATA,2   X'1D0A'           T4D
         DATA,2   X'170A'           I56 (SIG7)
         TITLE    'CSEHAND  -  CSE%MFIX'
         SPACE
*   ENTER WITH BAL,R15  ALL REGISTERS VOLATILE
         SPACE
CSE%MFIX  EQU     %
         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,R0   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
CSE%MFIX%ENTRY2  EQU  %
         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
         B        *R15
         SPACE
         SPACE
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'
         SPACE
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)
         SPACE
*   PSD'S USED THROUGHOUT ROUTINE
         SPACE
CSED%PSD%CLEARI56  :PSD  (IA,CSE3),(INH)
CSED%PSD%RSETPDF   :PSD  (IA,CSE2),(INH)
CSED%PSD%STOP      :PSD  (IA,CSST1),(INH)
CSED%PSD%RB0NMAP   :PSD  (IA,CSIA8),(INH),(RP,0)
CSED%PSD%MAP       :PSD  (IA,CSM1),(MAP),(INH)
CSED%IOCD  GEN,8,24,32  5,BA(CSED%MSG),0    IOCD FOR STOP MSG
CSE%DISARM%PMFI   EQU  %
         LI,R1    CSEP%PFI%BIT+CSEP%MFI%BIT  WD BITS FOR PFI,MFI
         WD,R1    X'1100'           DISARM PFI,MFI
         MTW,1    CSED%PMFI%DISARMED  BUMP UP COUNTER
         B        *R15
         SPACE
CSE%ARM%PMFI%UNLESS%NESTED  EQU  %
         MTW,-1   CSED%PMFI%DISARMED  DECREMENT COUNTER
         BGZ      CSARM2            B/ DONT ARM
         LI,R1    CSEP%MFI%BIT      WD BIT FOR MFI
         BIF,S7S9 CSARM1            B/ DONT ARM PFI ON SIG 9
         AI,R1    CSEP%PFI%BIT      WD BIT FOR PFI
CSARM1   WD,R1    X'1200'           ARM MFI(&PFI ON X560)
CSARM2   B        *R15              RETURN
         SPACE
CSE%MAP  LPSD,0   CSED%PSD%MAP      (IA,CSM1)
CSM1     B        0,R1              RETURN
         SPACE
CSE%FIN  EQU      %                 LABEL FOR REENTRANCY CHECKS
         SPACE
         END

