*M*      PFSR     POWER FAIL SAVE/RESTORE ROUTINE
         PCC      0
*
PFSR:    EQU      %
BITS     SET      1                 GET BT31TO0 BITS
         SYSTEM   UTS
         PAGE
*P*   NAME: PFSR
*P*
*P*   PURPOSE: SAVES VOLATILE MACHINE ENVIRONMENT AT TIME OF
*P*         POWER FAILURE, AND RESTORES THIS ENVIRONMENT AND
*P*         RESTARTS SYSTEM WHEN POWER IS RESTORED.
         SPACE    1
*P*      DESCRIPTION:
*P*               POWER OFF FOR MASTER CPU
*P*      ENTERED BY HARDWARE INTERRUPT/TRAP TO
*P*         LOCATION X'50' FOR POWER ON, LOCATION X'51' FOR
*P*         POWER OFF.  AT POWER OFF TIME THE REGISTERS
*P*         AND SENSE SWITCH SETTINGS ARE SAVED, ALL I/O
*P*         DEVICES ARE HALTED, SETTING TRANSMISSION DATA
*P*         ERROR IN DCT13, AND FOR OTHER THAN SIGMA 7, THE
*P*         CURRENT INTERRUPT STATE IS SAVED.  THE MACHINE THEN
*P*         GOES INTO A WAIT UNTIL POWER ON OCCURS.
*P*               POWER OFF FOR SLAVE CPUS
*P*      ENTERED MAPPED AND SAVES REGISTERS.
*P*      THEN BRANCHES TO THE WAIT LOOP IN SFAULT MODULE
*P*      UNTIL POWER ON OCCURS.
         SPACE    1
*P*               POWER ON
*P*      ALL CPUS ENTER UNMAPPED AND READ THEIR ADDRESSES
*P*      THE SLAVE CPUS EXIT TO THEIR POWERON ROUTINE IN SFAULT.
*P*      FOR THE MASTER CPU I/O INTERRUPTS ARE ACKNOWLEDGED
*P*         THEN AFTER WAITING FOR ALL ROTATING DEVICES TO
*P*         COME BACK ONLINE, THE CURRENT USER'S MAP,
*P*         ACCESS CODES AND WRITE LOCKS ARE LOADED, THE
*P*         REGISTERS ARE RELOADED AND THE CONTROL TASK TO
*P*         RESTART THE BUSY I/O DEVICES -PFSRIO- IS
*P*         TRIGGERED.
*P*      MODULE CONTAINS HARDWARE FAULT RTNS TO
*P*               ABORT USER AND ANLZ INSTRUCTION REQUIRED IN ROOT
         PAGE
************************************************************
*                                                          *
*        MODULE DEFINITIONS                                *
*                                                          *
************************************************************
         DEF      PFSR:             MODULE BIAS
         DEF      BEGINOFF          ENTRY POINT FROM X'51'
         DEF      BEGINON           ENTRY POINT FROM X'50'
         DEF      PFSRIO            ENTRY POINT FOR CONTROL TASK
         DEF      WAIT              ENTRY POINT FOR X'51' AFTER
*,*                                 FIRST ENTRY, IN CASE OF MULTIPLE
*,*                                 POWER OFF INTERRUPTS
         DEF      PFSR46            ENTRY POINT FOR X'46' TRAP
*,*                                 USED DURING POWERON SEQUENCE
         DEF      PFSCR             SCREECH ENTRY FOR SLAVE
*
         DEF      CSEABRT           ENTRY PT TO ABORT USER HARDWARE FLT
         DEF      CSEPMFI           ENTRY PT TO ARM/ENABLE MFI,PFI
         DEF      CSEANLZ           ENTRY PT TO ANLZ INST HARDWARE FLT
         PAGE
************************************************************
*                                                          *
*        MODULE REFERENCES                                 *
*                                                          *
************************************************************
         SREF     PFSRARM           TABLE TO STORE 1100 INT STATES
         SREF     PFSRTRIG          TABLE TO STORE 1200 INT STATES
         SREF     PFSRENAB          TABLE TO STORE 1400 INT STATES
         SREF     MONORG            USED TO FIND INT GROUPS
*
         REF      POWROFF           INITIAL POWER OFF PSD
         REF      DCTSIZ            USED TO START/STOP I/O DEVS
         REF      DCT1              USED TO START/STOP I/O DEVS
         REF      DCT3              USED TO SKIP DOWN DEVS
         REF      DCT4              USED TO FIND ROTATING DEVS
         REF      DCT13             STORE TDV W/ TDE AT POWEROFF
*,*                                 FOR ALL DEVICES
         REF      DCT24             CHK FOR ALL RECONFIG'D
*,*                                 DEVS AT POWRON
         REF      HGP               FIND START OF ROTATING DEVS
         REF      TB:FLGS           DEVICE FLAGS (ROTATING ?)
         REF      TINC              INIT'D BEFORE STARTING CLKS
         REF      J:DELTAT          INIT'D BEFORE STARTING CLKS
         REF      ONCNTER           COUNTER OF ON INTRS
         REF      OFFCNTER          COUNTER OF OFF INTRS
         REF      BALANCE           SET TO ONE TO INDICATE THAT
*,*                                 WE HAVE OFF ENVIRONMENT, IF
*,*                                 ZERO AT TIME OF POWRON - SC30
         REF      XPSD46            XPSD FOR 46 CONTROL
         REF      SREGS             SAVE AREA FOR REG BLK 0
         REF      SREGS1            SAVE AREA FOR REG BLK 1
         REF      PFSRSW            SAVE AREA FOR SENSE SWICHES
         REF      S:CUN             CURRENT USER TO RELOAD MAP
*
         REF      LMA               TO RELOAD MAP,ACC AND WR LCKS
         REF      T:XMMC            TO RELOAD CU MAP AND ACC
         REF      RT:PWON           REAL TIME POWRON ROUTINE
         REF      RT:PWOFF          REAL TIME POWROFF ROUTINE
         SREF     COCGFLG           CALL COCINIT AFTER PFSR
         REF      RESTRTIO          TO RESTART I/O AFTER POWRON
         REF      FORCEIO           TO RESTART I/O AFTER POWRON
         REF      CTRIG             TO TRIGGER RESTART I/O
*,*                                 CONTROL TASK
         REF      IOCTQ             TO TRIGGER RESTART I/O
*,*                                 CONTROL TASK
         REF      ERRLOG            CREATE ERRLOG ENTRY POWER ON
         REF      Y05               TABLE CONSTANT
         REF      S:ADR             CPU HARDWARE ADD TABLE
         REF      MP:HPN            RTN TO GET CPU HARDWARE ADD
         SREF     SLVWAIT           SLAVE BAILOUT POINT
         REF      NSCPU             NUMBER OF SLAVE CPUS
         SREF     BEGSOFF           SLAVE RTN FOR POWEROFF
         SREF     BEGSON            SLAVE RTN FOR POWERON
         REF      NFRST             FLAG FOR MULTI POWER OFFS
         REF      X0                TABLE CONSTANT
*
         REF      T:SAVE            SAVE ENVIRONMENT RTN
         REF      T:ABORTM          ABORT USER
         REF      CSEARTN           RETURN TO ANLZ INST HARDWARE FLT
         REF      CSED%SPDF         SOFTWARE DOUBLE FAULT FLAG
         REF      CSED%WHY          WHY CODE ABORTING USER
         REF      CSED%LINK         TEMP STORAGE OF LINK REGISTER
         REF      CSED%PSD          TRAPPED PSD HARDWARE FAULT
         REF      F:INST            TRAPPED INST
         REF      F:EVIRT           EFF VIRT ADDR OF TRAPPED INST
         REF      CSED%REGS         REGS AT TIME OF HARDWARE FAULT
         PAGE
*
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
R5       EQU      5
R6       EQU      6
R7       EQU      7
SR1      EQU      8
SR2      EQU      9
SR3      EQU      10
SR4      EQU      11
R8       EQU      8
R9       EQU      9
R10      EQU      10
R11      EQU      11
R12      EQU      12
R13      EQU      13
R14      EQU      14
R15      EQU      15
TY       EQU      1
*
RP0      EQU      X0
RP1      EQU      X10
*
MFIBIT   EQU      X'400'            WD BIT FOR MFI
PFIBIT   EQU      X'800'            WD BIT FOR PFI
         PAGE
************************************************************
*                                                          *
*        MODULE START                                      *
*                                                          *
************************************************************
TIOPSD   :PSD     (IA,P46),INH
DELAYPSD :PSD     (IA,DELAY),INH
*
CSMAP    :PSD     (IA,CSI4),(INH),(MAP)
CRTNPSD  :PSD     (IA,CSEARTN),(INH)
*
ELOGNTRY DATA     X'20020000'       ERROR LOG ENTRY FOR POWER ON
PFSR46   LPSD,1   TIOPSD            CLEAR PDF
P46      EQU      %
         BAL,R11  MP:HPN            GET CPU HARDWARE ADDR
         CW,R8    S:ADR             AM I MASTER
         BE       TIOLOOP           YES
         BAL,R11  SLVWAIT           NO,SLAVE BAILOUT
         PAGE
BEGINOFF EQU      %                 SAVE REGS
         MTW,-1   NFRST             POWEROFF REENTERED
         BNEZ     WAIT              YEP
         LCI      0
         STM,R0   SREGS1            SAVE REGISTER BLOCK ONE
* JUST SAVED RP=1, NOW SAVE RP=0
         LRP      RP0
         STM,R0   SREGS             SAVE REGISTER BLOCK ZERO
         MTW,1    BALANCE           ENVIRONMENT FLAG
         BAL,R11  MP:HPN            GET CPU ADDRESS
         CW,R8    S:ADR             MASTER
         BNE      BEGSOFF           NO, GO TO SLAVE PROCESSING
         RD,0     0                 READ THE SENSE SWITCHES
         STCF     PFSRSW            SAVE SENSE SWITCH SETTINGS
*
*
         BIF,S7   SIG7A             DO NOT SAVE INTERRUPTS ON SIG7
         LI,R2    MONORG-X'52'+X'F' NUMBER OF INTERRUPT CELLS
         SLS,R2   -4                BOUND UP TO A FULL GROUP OF INTERRUPTS
         CI,R2    1                 ONLY GROUP ZERO
         BE       KRD4              YES
KRD1     RD,R1    X'1100',R2        READ ARMED FLIP-FLOP
         STH,R1   PFSRARM,R2        SAVE IN HALF WORD TABLE
         RD,R1    X'1200',R2        READ TRIGGER FLIP-FLOP
         STH,R1   PFSRTRIG,R2       SAVE
         RD,R1    X'1400',R2        READ ENABLE/DISABLE FLIP-FLOP
         STH,R1   PFSRENAB,R2       SAVE
         CI,R2    2                 SAVED GROUP TWO
         BNE      %+3               NO
KRD4     LI,R2    0                 YES-THERE IS NO GROUP ONE
         B        KRD1              SAVE GROUP ZERO
         BDR,R2   KRD1              SAVE ALL GROUPS BELOW MONORG
SIG7A    EQU      %
*
*
         LI,R7    X'FFF0'
         WD,R7    X'1100'           DISARM,DISABLE GROUP 0 INTS.
         LI,R7    DCTSIZ            HALT ALL I/O
MORE     EQU      %
         LC       DCT3,R7           DEVICE DOWN
         BCS,2    NOTBUSY           YES
         LB,R2    DCT24,R7          DEVICE CONFIG OUT
         CI,R2    2                 ?
         BANZ     NOTBUSY           YES
         LH,R2    DCT1,R7
         HIO,0    *R2
         TDV,R4   *R2               GET TDV STATUS
         STCF     R4                SAVE CC FROM TDV
         OR,R5    Y004              SET DATA TRANSMISION ERROR
         STD,R4   DCT13,R7          INTO DCT13
NOTBUSY  BDR,R7   MORE
         BAL,11   RT:PWOFF          USER-SUPPLIED REAL-TIME ROUTINE
WAIT     MTW,1    OFFCNTER          COUNT THIS OFF INTERRUPT
         WAIT                       WAIT HERE FOR POWER ON INT.
         B        %-1
*
         PAGE
BEGINON  EQU      %
         BAL,R11  MP:HPN            GET CPU HARDWARE ADDRESS
         CW,R8    S:ADR             MASTER
         BNE      BEGSON            NO,GO DO SLAVE PROCESSING
         MTW,1    ONCNTER           COUNT THIS ON INTERRUPT
         MTW,0    BALANCE           OFF ENVIR. PRESENT
         BNEZ     BEGINON5          YES
PFSCR    EQU      %
         LW,R1    OFFCNTER          NO-PUT COUNTERS IN REGS
         LW,R2    ONCNTER
         LW,R3    NFRST             MULTIPOWEROFF OCCURRING
         SCREECH  X'30'             UNBLNCD POWON AND POWOFF
*                 *****
*                 *****
*                 *****
         PAGE
*S*   SCREECH CODE:  30-00
*S*
*S*   MESSAGE:  UNBALANCED POWER ON/POWER OFF INTERRUPT PAIRS
*S*
*S*   REPORTED BY:  PFSR
*S*
*S*   TYPE:  SCREECH
*S*
*S*   REMARKS:  UNBALANCED POWER ON / POWER OFF INTERRUPT PAIRS,
*S*             MORE OF ONE THAN ANOTHER (USUALLY POWER ON W/ NO
*S*             POWER OFF, SINCE OTHERWISE SYSTEM WOULD HANG IN
*S*             WAIT - B %-1).
*S*
*S*   REGISTERS:  R1 - COUNT OF OFF INTERRUPTS (OFFCNTER)
*S*               R2 - COUNT OF ON INTERRUPTS (ONCNTER)
*S*               R3 - MULTIPLE POWEROFF FLAG (NFRST)
         PAGE
BEGINON5 EQU      %
         LI,R1    100
         BDR,R1   %                 DELAY ABOUT 100 MICRO SEC
*
*
         LI,R1    X'38F0'           GROUP ZERO MASK FOR SIG7
         BIF,S7   SIG7B             DO RESTORE INTERRUPTS ON SIG7
         LI,R6    MONORG-X'52'      NUMBER OF INTERRUPT CELL
         LI,R7    0
         SLD,R6   -4                NUMBER OF GROUPS
         SCS,R7   4                 IS THERE A PARTIAL GROUP
         BNOV     %+2               NO
         AI,R6    1                 YES-BOUND UP NUMBER OF GROUPS
         CI,R6    1                 ONLY GROUP ZERO
         BE       KRD5              YES
         LI,R1    X'FFFF'           MASK FOR INTERRUPT CELLS IN A GROUP
         LCW,R7   R7
         SLS,R1   16,R7             SHIFT MASK FOR SYSGENED CELLS
KRD2     WD,R1    X'1100',R6        DISARM EVERY CELL
         WD,R1    X'1400',R6        ENABLE EVERY CELL
         LH,R2    PFSRARM,R6
         AND,R2   R1                ARM FLIP-FLOP
         LH,R3    PFSRTRIG,R6
         AND,R3   R1                TRIGGER FLIP-FLOP
         OR,R2    R3                CELLS THAT MUST BE AEMED
         WD,R2    X'1200',R6        ARM AND ENABLE
         WD,R3    X'1700',R6        TRIGGER
         LH,R2    PFSRARM,R6        ARM FLIP-FLOP
         EOR,R2   R1                FLIP THE BIT
         AND,R2   R3                ADVANCE TO ACTIVE ONLY THESE CELLS
         WD,R2    X'1000',R6        SET ACTIVE
         LH,R4    PFSRENAB,R6       ENABLE/DISABLE FLIP-FLOP
         AND,R4   R1
         WD,R4    X'1600',R6        ENABLE/DISABLE
         LI,R1    X'FFFF'           MASK FOR ALL CELLS IN AGROUP
         CI,R6    2                 JUST SET GROUP TWO
         BNE      KRD3              NO
KRD5     LI,R6    0                 NO GROUP ONE
         LI,R1    X'FFF0'           MASK FOR GROUP ZERO
         B        KRD2              RESTORE GROUP ZERO
KRD3     BDR,R6   KRD2              RESTORE ALL GROUPS
         B        %+2
SIG7B    EQU      %
         WD,R1    X'1200'           ARM AND ENABLE GROPU ZERO
         LI,R0    100
         STW,R0   TINC
         STW,R0   J:DELTAT          PUT INITIAL VALUE INTO CLOCKS
*                                   WHILE POWER ON INT HIGH
         LPSD,3   DELAYPSD          CLEAR POWER ON INT
DELAY    LW,R1    Y02               GET DELAY VALUE
         BDR,R1   %                 DELAY FOR THINGS TO QUIET DOWN
         LI,R1    0
         STW,R1   BALANCE           CLEAR
         STW,R1   OFFCNTER                ALL
         STW,R1   ONCNTER                     COUNTERS
*
         LW,R1    XPSD46
         XW,R1    X'46'             INTERCEPT TRAP 46
         STW,R1   XPSD46
*
TIOLOOP  AIO,0    0
         BCR,8    %-1               ACKNOWLEDGE ALL INTERRUPTS
         LI,R6    HGP               START OF ROTATING DEVICES
PFSR1    LW,R5    1,R6
         CI,R5    X'4000'           PRIVATE ROTATING DEVICE
         BANZ     PFSR2             YES-MAY NOT BE THERE
         LH,R5    R5                DCTX OF PUBLIC ROTATING DEVICE
         LC       DCT3,R5           DEVICE DOWN
         BCS,2    PFSR2             YES
         LB,R1    DCT24,R5
         CI,R1    2                 DEVICE RECONFIG OUT
         BANZ     PFSR2             YES
         LH,R5    DCT1,R5           ADDRESS OF PUBLIC ROTATING DEVICE
         LI,R1    75
         BDR,R1   %                 DELAY
         TIO,0    *R5
         BCS,X'C' %-3
PFSR2    LW,R6    *R6
         BNEZ     PFSR1             FLINK TO NEXT ROTAING DEVICE
*
*
         LW,R1    XPSD46
         XW,R1    X'46'
         STW,R1   XPSD46            RESTORE TRAP 46
         LW,R1    PFSRSW            SENSE SWITCH SETTINGS FOR 560
         WD,R1    0                 SET SENSE SWITCHES ON 560
         BAL,11   RT:PWON           USER-SUPPLIED REAL-TIME ROUTINE
         BAL,11   LMA               LOAD LOCKS MAP AND ACCESS
         LW,4     S:CUN             CURRENT USER #
         BAL,11   T:XMMC            LOAD MAP ACCESS FOR USER
*
*
         LW,SR1   Y05               TRIGGER CONTROL TASK NUMBER 5
         LH,R1    IOCTQ+1           SPACE COUNT CONTROL TASK STACK
         CI,R1    X'7FFF'           ANY SPACE
         BANZ     %+2               YES-CTRIG CAN PUSH TASK NO.
         PLW,R0   IOCTQ             MAKE ROOM FOR PFSR ENTRY
         BAL,SR4  CTRIG             RESTART DEVICES AFTER PFSR
*
*
         LCI      0
         LM,R0    SREGS             RESTORE REGISTER BLOCK ZERO
*JUST PULLED RP=0 FOR SYS OR USR, NOW GET RP=1 FOR COC
         LRP      RP1
         LCI      0
         LM,R0    SREGS1            RESTORE REGISTER BLOCK ONE
         LI,R0    1
         STW,R0   NFRST             RESET POWER OFF COUNT
         LW,R0    SREGS1
         LPSD,8   POWROFF           RETURN
         PAGE
*                                   CONTROL TASK FOR PFSR
*                                   TO RESTART I/O
PFSRIO   EQU      %
         PUSH     SR4
         LI,R1    DCTSIZ
PFSR3    CI,R1    TY                TY DCTX
         BE       PFSR4             YES-RESTART IT
         LB,R2    DCT4,R1           TYPE CODE
         LB,R2    TB:FLGS,R2        FLAGS FOR DEVICE TYPE
         CI,R2    X'C0'             ROTATING DEVICE
         BL       PFSR5             NO
PFSR4    PUSH     R1
         BAL,SR4  RESTRTIO          YES-GO SEE IF BUSY
         BAL,R2   FORCEIO           IF BUSY RE-START IO
         PULL     R1
PFSR5    BDR,R1   PFSR3             CYCLE THROUGH DCTS
         LI,R11   X'100'            L/PFSR COC INIT REQUEST FLAG
         STS,R11  COCGFLG           S/FLAG INTO PIGEON/COCG FLAGS; CLOCK3
*                                   .. WILL CALL T:COCHC, WHO WILL CALL GHOST
         LI,R6    R7
         LW,R7    ELOGNTRY          CREATE ERRLOG ENTRY FOR POWER ON
         OR,R7    S:ADR             GET MASTER'S ADDRESS
         BAL,R5   ERRLOG
         PULL     SR4
         B        *SR4              RETURN
         PAGE
*F*      NAME:    CSEABRT
         SPACE    1
*F*      PURPOSE:
*F*               MAPPED SUBROUTINE FOR MASTER CPU HARDWARE
*F*               FAULT ROUTINE TO ABORT USER
         SPACE    2
*D*      NAME:    CSEABRT
         SPACE    1
*D*      CALL:
*D*               FROM CSEHAND MODULE
         SPACE    1
*D*      ENVIRONMENT:
*D*               MAPPED,MASTERMODE, INHIBITS ON
         SPACE    1
*D*      INPUT:
*D*               CSED%REGS - REGS AT TIME OF HARDWARE FAULT
*D*               CSED%PSD - PSD AT TIME OF TRAP
*D*               CSED%SPDF - SOFTWARE DOUBLE FAULT FLAG
*D*               CSED%WHY - WHY CODE FOR ABORT
         SPACE    1
*D*      OUTPUT:
*D*               CSED%SPDF - SET TO -1
*D*               R14 = ABORT CODE AND SUBCODE
         SPACE    1
*D*      INTERFACE:
*D*               T:SAVE - TO SAVE ENVIRONMENT
*D*               T:ABORTM - EXIT TO ABORT USER
         SPACE    1
*D*      DESCRIPTION:
*D*               THE REGISTERS AT THE TIME OF THE HARDWARE FAULT ARE
*D*               RESTORED AND THE ENVIRONMENT SAVED THE SOFTWARE DOUBLE
*D*               FAULT FLAG IS RESET (-1) AND MFI AND/OR PFI ARE
*D*               ARMED AND ENABLED. THE VALUE IN CSED%WHY IS USED TO
*D*               TRANSLATE THE REASON INTO AN ABORT CODE IN R14
*D*               EXIT IS MADE TO T:ABORTM
         PAGE
CSEABRT  EQU      %
         LCI      0
         LM,R0    CSED%REGS         RESTORE REGS
         PUSH     6,R13
         LD,R0    CSED%PSD
         BAL,R2   T:SAVE            SAVE ENVIRONMENT
         LI,R1    -1
         STW,R1   CSED%SPDF         RESET DOUBLE FAULT FLAG
         BAL,R15  CSEPMFI           ARM/ENABLE MFI/PFI
         LW,R1    CSED%WHY          GET ABORT REASON
         LH,R14   ABCODE,R1         GET ABORT CODE
         AND,R14  M16               MASK
         SCS,R14  -8                POSITION
         B        T:ABORTM          ABORT THE USER
*
ABCODE   EQU      %
         DATA,2   X'0000'           NOT USED
         DATA,2   X'A40A'           WD TIMER- T46
         DATA,2   X'A40D'           INST EXCEPT - T4D
         DATA,2   X'A40C'           BUS CHECK FAULT - T4C
         DATA,2   X'A40E'           MAP PARITY ERROR - T4C
         DATA,2   X'A40F'           REG PARITY ERROR - T4C
         BOUND    4
         PAGE
*F*      NAME:    CSEPMFI
         SPACE    1
*F*      PURPOSE:
*F*               TO ARM/ENABLE MFI AND/OR PFI INTERRUPTS
         SPACE    2
*D*      NAME:    CSEPMFI
         SPACE    1
*D*      REGISTERS:
*D*               R15 = LINK REGISTER
*D*               R1 IS USED
         SPACE    1
*D*      CALL:
*D*               FROM CSEHAND MODULE
         SPACE    1
*D*      DESCRIPTION:
*D*               FOR SIGMA 7 SYSTEMS ARMS/ENABLES I56
*D*               FOR SIGMA 9 SYSTEMS ARMS/ENABLES MFI (I57)
*D*               FOR X560 SYSTEMS ARMS/ENABLES MFI (I57) AND PFI (I56)
         SPACE    2
CSEPMFI  EQU      %
         LI,R1    0
         BIF,S7   ARM0              ARM ONLY I56 FOR SIG 7
         LI,R1    MFIBIT
         BIF,S9   ARM1              ONLY MFI ON  SIGMA 9
ARM0     AI,R1    PFIBIT
ARM1     WD,R1    X'1200'
         B        *R15              RETURN
         PAGE
*F*      NAME:    CSEANLZ
         SPACE    1
*F*      PURPOSE:
*F*               ANALYSIS OF INSTRUCTION CAUSING HARDWARE FAULT
         SPACE    1
*D*      NAME:    CSEANLZ
         SPACE    1
*D*      CALL:
*D*               FROM CSEHAND MODULE
         SPACE    1
*D*      ENVIRONMENT:
*D*               MASTER MODE, INHIBITS ON
*D*               GOES MAPPED IF MAPPED AT TIME OF HARDWARE FAULT
         SPACE    1
*D*      INPUT:
*D*               CSED%PSD - PSD AT TIME OF TRAP
*D*               CSED%REGS - REGS AT TIME OF TRAP
*D*               F:INST - TRAPPED INSTRUCTION
         SPACE    1
*D*      OUTPUT:
*D*               F:EVIRT - EFFECT VIRTUAL ADDRESS OF TRAPPED INST & CCS
         SPACE    1
*D*      REGISTERS:
*D*               SAVES R15 IN CSED%LINK
*D*               R0 CONTAINS EFFECT VIRTUAL ADDR AND CCS FROM ANLZ
         SPACE    1
*D*      DESCRIPTION:
*D*               IF MAPPED AT TIME OF HARDWARE FAULT TRAP THEN GOES
*D*               MAPPED AND SAVES THE CONTENTS OF R15 IN CSED%LINK
*D*               REGISTERS AT TIME OF FAULT ARE RESTORED AND
*D*               AND THE INST IS ANLZ'ED AND THE CCS ARE CONCATENATED
*D*               IN R0 AND STORED IN F:EVIRT. RETURN IS MADE
*D*               TO CSEARTN UNMAPPED AND INHIBITS ON
         PAGE
CSEANLZ  EQU      %
         LW,R1    Y004
         CW,R1    CSED%PSD          MAPPED
         BAZ      CSI4              NO
         LPSD,0   CSMAP             YES,GO MAPPED
CSI4     STW,R15  CSED%LINK         SAVE LINK
         LCI      0
         LM,R0    CSED%REGS         GETS REGS
         ANLZ,R0  F:INST            ANLZ THE INST
         STCF     R0                SAVE CCS
         STW,R0   F:EVIRT
         LPSD,0   CRTNPSD           RETURN
         END

