         PCC      0
*M*      ENTRY   COMMON INITIAL TRAP HANDLING
         SYSTEM   UTS
*
*        DEFS
*
         DEF      CAL1P             ENTRY FOR CAL1 PROCESSING
         DEF      T:CTRAPM          COMMON TRAP PROCESSING
*
*        THESE DEFS ARE ACTUALLY DONE IN THE PROCS AND INCLUDED
*        HERE FOR COMMENT ONLY
*        DO N O T REMOVE THE ASTERISKS
*
*        DEF      NOPPGM            NAO ENTRY X'40'
*        DEF      UNIMP             UNIMP INST ENTRY X'41'
*        DEF      STKOVF            STACK OVERFLOW ENTRY X'42'
*        DEF      FIXOVF            FIXED PT OVERFLOW ENTRY X'43'
*        DEF      FLTFLT            FL PT FAULT ENTRY X'44'
*        DEF      DECFLT            DEC FAULT ENTRY X'45'
*        DEF      CAL2XXX           CAL2 ENTRY X'49'
*        DEF      CAL3XXX           CAL3 ENTRY X'4A'
*        DEF      CAL4XXX           CAL4 ENTRY X'4B'
*        DEF      CAL1PA            CAL1 NOT CAL1,1 ENTRY X'48'
         PAGE
*                 SYMBOLIC REGISTER DEFINITIONS.
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
SR1      EQU      8
SR2      EQU      9
SR3      EQU      10
SR4      EQU      11
D1       EQU      12
D2       EQU      13
D3       EQU      14
D4       EQU      15
R5       EQU      5
R6       EQU      6
R7       EQU      7
R8       EQU      8
R9       EQU      9
R10      EQU      10
R11      EQU      11
R12      EQU      12
R13      EQU      13
R14      EQU      14
R15      EQU      15
         PAGE
*
*        REFS
*
         REF      TSTACK            TSTACK
         REF      J:JIT             THE JIT
         REF      MPPO              IN JIT BITS 16-31 OUTPUT TRAPCC'S
*,*                                 AND TRAP#.
         REF      TEMP              TEMP CELL FOR STORAGE USES TEMP1 TOO
         REF      TEMP2             ANOTHER TEMP CELL
         REF      TPSDBASE          BASE OF PSD 4 WORD BLOCK
         REF      NOPPSD            PSD BLOCK FOR TRAP X'40'
         REF      UNIMPPSD          PSD BLOCK FOR TRAP X'41'
         REF      STKLPSD           PSD BLOCK FOR TRAP X'42'
         REF      FIXOVPSD          PSD BLOCK FOR TRAP X'43'
         REF      FLTFPSD           PSD BLOCK FOR TRAP X'44'
         REF      DECFPSD           PSD BLOCK FOR TRAP X'45'
         REF      CAL1PSD           PSD BLOCK FOR CAL1 X'48'
         REF      CAL2PSD           PSD BLOCK FOR CAL2 X'49'
         REF      CAL3PSD           PSD BLOCK FOR CAL3 X'4A'
         REF      CAL4PSD           PSD BLOCK FOR CAL4 X'4B'
         REF      NAOMASK           MASK FOR NAO
         REF      PSMASK            MASK FOR STACK OVERFLOW
         REF      FXMASK            MASK  FOR FIXED PT
         REF      FLTMASK           MASK FOR  FL  PT
         REF      DECMASK           MASK FOR DEC FT
         REF      CALBAD            EXIT TO PROCESS A BAD CAL
*,*                                 MEANINGFUL IN 560 ONLY
         REF      TEMP%BREG         CONTENTS OF BRANCH REG TEMPORARILY
         REF      CTRAPSD           PSD BLOCK TO ENTER COMMON
*,*                                 TRAP PROCESSING
         REF      CAL1P11           EXIT FOR STD CAL1 ANALYSIS
         REF      J:BASE            SCRATCH STORAGE FOR REGS
         REF      CAL11N3           EXIT FOR FAST CAL1,1 ANALYSIS
         REF      CAL11NB           EXIT FOR FAST CAL1,1 ANALYSIS
*,*                                 WHEN DCB INDIRECTLY ADDRESSED
         REF      J:CALCNT          COUNT OF CAL1 EXECUTED FOR USER
         REF      T:SAVE            SAVE ENVIRONMENT
         REF      40TRAP            EXIT FOR ADDITIONAL X'40' PROCESSING
         REF      TRAPPSD           RECOVERY VERSION OF TRAP PSD
         REF      M17               MASK
         REF      Y004              MASK
         REF      YFF               MASK
         REF      PULLE1            USED AS TEMP CELL
         REF      S:PNO             CPU PROCESSOR #
         REF      S:CUN             CURRENT USER
         REF      S:CLOCK4          CLOCK4 DIRECTOR
         REF      J:OVHTIM          OVERHEAD TIME COUNTER
*
         PAGE
*P*      NAME:    ENTRY
         SPACE    1
*P*      PURPOSE:
*P*               TO PERFORM THE INITIAL PROCESSING OF TRAPS
         SPACE    1
*P*      DESCRIPTION:
*P*               EACH TRAP (X'40'-X'45' AND X'49'-X'4B')
*P*               HAS A SEPARATE BUT IDENTICAL  4 WORD
*P*               ROUTINE THAT SAVES THE CONDITION CODES AND CONTENTS
*P*               OF THE BRANCH REGISTER (MEANINGFUL ONLY IN 560)
*P*               AND VIA AN XPSD ENTERS THE COMMON TRAP HANDLING
*P*               ROUTINE WHICH PERFORMS THE INITIAL DECODING AND
*P*               EXITS AS APPROPRIATE.THE 2ND XPSD SAVES AN INSTRUCTION
*P*               ADDRESS VALUE THAT IS CONVERTED TO AN INDEX VALUE
*P*               IDENTIFYING THE SPECIFIC TRAP BEING PROCESSED.
         SPACE    1
*P*               TRAP X'48' - CAL1 PROCESSING IS HANDLED DIFFERENTLY.
*P*               ENTRY IS MADE TO A ROUTINE (CAL1P) THAT IMMEDIATELY
*P*               SELECTS THE CAL1,1 TYPE FOR FAST PROCESSING OF THE
*P*               SERVICE CALL.  ALL OTHER CAL1 S ARE FUNNELED
*P*               THROUGH CAL1PA PROCESSING IN  THE SAME MANNER AS THE
*P*               OTHER TRAP TYPES.
*P*               THIS IS DONE TO EXPEDITE A VERY HIGH FREQUENCY
*P*               PATH.
         SPACE    1
*P*      REFERENCE:
*P*               SEE REPORTS F AND D
         PAGE
*F*      NAME:    ENTRY
         SPACE    1
*F*      PURPOSE:
*F*               TO PERFORM THE SEPARATE BUT IDENTICAL
*F*               PROCESSING OF THE INITIAL ENTRY FROM A TRAP
         SPACE    1
*F*      REFERENCE:
*F*               SEE REPORT D
         SPACE    3
*D*      NAME:    NOPPGM
         SPACE    1
*D*      ENTRY:   UNIMP,STKOVF,FIXOVF,FLTFLT,DECFLT,CAL2XXX
*D*      ENTRY:   CAL3XXX,CAL4XXX,CAL1PA
         SPACE    1
*D*      REGISTERS:
*D*               SAVES R1 IN TEMP%BREG
*D*               NO OTHERS USED
         SPACE    1
*D*      CALL:
*D*               THE EXECUTION OF THE XPSDS IN THE TRAP
*D*               LOCATIONS X'40'-X'45' AND X'49'-X'4B'
*D*               CAUSE ENTRY TO THE APPROPRIATE ROUTINE
         SPACE    1
*D*      ENVIRONMENT:
*D*               MAPPED,MASTER MODE,WRITE KEY 1, INHIBITS ON
         SPACE    1
*D*      DESCRIPTION:
*D*               AT EACH OF THE SEPARATE BUT IDENTICAL
*D*               ENTRIES, THE CONDITION CODES ARE SAVED
*D*               TEMPORARILY AT PULLE+1, R1 IS
*D*               SAVED IN TEMP%BREG, THE CONTENTS OF THE
*D*               BRANCH REGISTER OBTAINED (MEANINGFUL  ONLY
*D*               IN 560) AND CONTROL IS TRANSFERRED
*d*               to t:ctrapm  for common trap processing
         PAGE
         PAGE
         DEF      ENTRY:            PATCHING DF
ENTRY:   RES
         SPACE    1
*
*        PSD TO GO UNMAPPED
*
CTRP2U   :PSD     (IA,CTRP2),INH,(WK,1)
*
*        PROC TO GENERATE TRAP RECEIVING SEQUENCE
*
RTRAP    CNAME    0
         PROC
LF(1)    EQU      %
         DEF      LF(1)
         STCF     PULLE1+1          SAVE TRAP CONDITION CODES
         XW,R1    TEMP%BREG         SAVE R1
         RD,R1    X'31D'            READ LAST BRANCH REG (Q29)
         XPSD,10  CTRAPSD           MERGE WITH COMMON HANDLER
AF(1)    EQU      %                 FOR BASE VALUE
         PEND
         PAGE
         PAGE
***************************************************************
*              TRAP HANDLER TRANSFER VECTOR                   *
***************************************************************
         SPACE    2
NOPPGM   RTRAP    XPSDV             NON-ALLOWED OPERATION TRAP
UNIMP    RTRAP                      UNIMPLEMENTED INSTRUCTION
STKOVF   RTRAP                      STACK OVERFLOW/UNDERFLOW
FIXOVF   RTRAP                      FIXED POINT ARITHMETIC
FLTFLT   RTRAP                      FLOATING POINT ARITHMETIC
DECFLT   RTRAP                      DECIMAL ARITHMETIC FAULT
CAL2XXX  RTRAP                      CAL2
CAL3XXX  RTRAP                      CAL3
CAL4XXX  RTRAP                      CAL4
CAL1PA   RTRAP                      CAL1 NOT CAL1,1
************************************************************
*                                                          *
*        ANY CHANGES MADE TO THIS VECTOR MUST ALSO BE      *
*                 MADE TO THE OTHER PARALLEL TABLES        *
*                                                          *
*        THE TABLES INVOLVE INCLUDE:                       *
*                 TRAP HANDLER TRANSFER VECTOR,            *
*                 TPSDV,TMSK,TADR,TRPTV                    *
*                                                          *
************************************************************
         PAGE
***************************************************************
*             LOCATOR VECTOR FOR USER PSD                     *
***************************************************************
         SPACE    2
:TPSD    COM,8    DA(AF(1))-DA(TPSDBASE)
*
TPSDV    :TPSD    NOPPSD            TRAP 40
         :TPSD    UNIMPPSD          TRAP 41
         :TPSD    STKLPSD           TRAP 42
         :TPSD    FIXOVPSD          TRAP 43
         :TPSD    FLTFPSD           TRAP 44
         :TPSD    DECFPSD           TRAP 45
         :TPSD    CAL2PSD           TRAP 49
         :TPSD    CAL3PSD           TRAP 4A
         :TPSD    CAL4PSD           TRAP 4B
         :TPSD    CAL1PSD           TRAP 48
         BOUND    4
************************************************************
*                                                          *
*        ANY CHANGES MADE TO THIS VECTOR MUST ALSO BE      *
*                 MADE TO THE OTHER PARALLEL TABLES        *
*                                                          *
*        THE TABLES INVOLVE INCLUDE:                       *
*                 TRAP HANDLER TRANSFER VECTOR,            *
*                 TPSDV,TMSK,TADR,TRPTV                    *
*                                                          *
************************************************************
         PAGE
         PAGE
***************************************************************
*                        TRAP MASKS                           *
***************************************************************
         SPACE    2
TMSK     RES      0
         DATA,1   NAOMASK           TRAP 40 - NAO
         DATA,1   0                 TRAP 41 - UNIMP
         DATA,1   PSMASK            TRAP 42 - STACK
         DATA,1   FXMASK            TRAP 43 - FIXED POINT
         DATA,1   FLTMASK           TRAP 44 - FLOATING POINT
         DATA,1   DECMASK           TRAP 45 - DECIMAL ARITH
*        DATA,1   0                 TRAP 49 - CAL2
*        DATA,1   0                 TRAP 4A - CAL3
*        DATA,1   0                 TRAP 4B - CAL4
*        DATA,1   0                 TRAP 48 - CAL1
         BOUND    4
************************************************************
*                                                          *
*        ANY CHANGES MADE TO THIS VECTOR MUST ALSO BE      *
*                 MADE TO THE OTHER PARALLEL TABLES        *
*                                                          *
*        THE TABLES INVOLVE INCLUDE:                       *
*                 TRAP HANDLER TRANSFER VECTOR,            *
*                 TPSDV,TMSK,TADR,TRPTV                    *
*                                                          *
************************************************************
         PAGE
***************************************************************
*                       TRAP ADDRESS                          *
***************************************************************
         SPACE    2
TADR     RES      0
         DATA,1   X'40'             TRAP 40
         DATA,1   X'41'             TRAP 41
         DATA,1   X'42'             TRAP 42
         DATA,1   X'43'             TRAP 43
         DATA,1   X'44'             TRAP 44
         DATA,1   X'45'             TRAP 45
         DATA,1   X'49'             TRAP 49
         DATA,1   X'4A'             TRAP 4A
         DATA,1   X'4B'             TRAP 4B
         DATA,1   X'48'             TRAP 48
         BOUND    4
************************************************************
*                                                          *
*        ANY CHANGES MADE TO THIS VECTOR MUST ALSO BE      *
*                 MADE TO THE OTHER PARALLEL TABLES        *
*                                                          *
*        THE TABLES INVOLVE INCLUDE:                       *
*                 TRAP HANDLER TRANSFER VECTOR,            *
*                 TPSDV,TMSK,TADR,TRPTV                    *
*                                                          *
************************************************************
         PAGE
***************************************************************
*                    TRAP TRANSFER VECTOR                     *
***************************************************************
         SPACE    2
:TRP     COM,8    AF(1)-TRAPBASE
         SPACE    2
TRPTV    RES      0
         :TRP     TRAPS             TRAP 40
         :TRP     TRAPS             TRAP 41
         :TRP     TRAPS             TRAP 42
         :TRP     TRAPS             TRAP 43
         :TRP     TRAPS             TRAP 44
         :TRP     TRAPS             TRAP 45
         :TRP     CAL234            TRAP 49 - CAL2
         :TRP     CAL234            TRAP 4A - CAL3
         :TRP     CAL234            TRAP 4B - CAL4
         :TRP     CAL1PP            TRAP 48 - CAL1
         BOUND    4
************************************************************
*                                                          *
*        ANY CHANGES MADE TO THIS VECTOR MUST ALSO BE      *
*                 MADE TO THE OTHER PARALLEL TABLES        *
*                                                          *
*        THE TABLES INVOLVE INCLUDE:                       *
*                 TRAP HANDLER TRANSFER VECTOR,            *
*                 TPSDV,TMSK,TADR,TRPTV                    *
*                                                          *
************************************************************
         PAGE
*D*      NAME:    T:CTRAPM
         SPACE    1
*D*      REGISTERS:
*D*               ALL REGISTERS ARE SAVED
         SPACE    1
*D*      CALL:
*D*               ENTRY IS FROM THE SEPARATE BUT IDENTICAL
*D*               INITIAL TRAP ROUTINES WITH R1 CONTAINING THE
*D*               CONTENTS OF THE BRANCH REGISTER (MEANINGFUL
*D*               ONLY IN A 560)
*D*               SEE REPORT D FOR NOPPGM
         SPACE    1
*D*      INTERFACE:
*D*               T:SAVE - TO SAVE A STANDARD ENVIRONMENT
         SPACE    1
*D*      ENVIRONMENT:
*D*               MASTER MODE, WRITE KEY 1,
*D*               ALL INHIBITS ON BUT IF NORMAL EXIT THEN
*D*                    ENABLES AT END
*D*               INITIALLY MAPPED - IF SECONDARY CPU REMAINS SO
*D*                    IF MASTER AND AT TIME  OF TRAP WAS UNMAPPED
*D*                    THEN WILL GO UNMAPPED
         SPACE    1
*D*      OUTPUT:
*D*               R0 = FIRST WORD OF PSD
*D*               R1 = INDEX OF PARTICULAR TRAP
*D*               R3 = TRAP CONDITION CODES
*D*               R5 = JIT ADDRESS
*D*               R6 = BYTE 0 TRAP CC AND FLOAT CONTROLS
*D*                    BYTE 3 TRAP ADDRESS
         SPACE    1
*D*      DESCRIPTION:
*D*               UPON ENTRY R1 HAS THE CONTENTS OF THE BRANCH REGISTER
*D*               (MEANINGFUL ONLY ON 560) WHICH IS
*D*               SAVED IN TEMP%BREG AND THE ORIGINAL CONTENTS OF
*D*               R1 RESTORED
         SPACE    1
*D*               THE INDEX FOR THE REAL PSD IS COMPUTED AND THE
*D*               SPECIFIC PSD FOR THIS PROCESSING IS FETCHED AND SAVED
*D*               FOR RECOVERY IN TRAPPSD.
         SPACE    1
*D*               IF THE PROCESSOR CURRENTLY EXECUTING THIS CODE
*D*               IS THE MASTER A CHECK IS MADE TO SEE IF UNMAPPED
*D*               AT THE TIME OF THE TRAP AND IF SO GOES UNMAPPED
         SPACE    1
*D*               THEN FOR ALL CPUS  A CHECK IS MADE TO SEE IF
*D*               ENOUGH ROOM IN THE STACK IF NOT SUA X'79'
         SPACE    1
*D*               IF A SECONDARY CPU IS EXECUTING THIS CODE, THEN
*D*               A CHECK IS MADE TO SEE IF IT HAS A USER, A NECESSARY
*D*               CONDITION TO BE EXECUTING THIS ROUTINE.
*D*               IF NOT THEN A SLAVE CRASH X'78-01' IS INVOKED
         SPACE    1
*D*               A STANDARD ENVIRONMENT IS THEN SET UP THROUGH
*D*               A CALL TO T:SAVE.  THE CLOCK IS SET TO OVERHEAD TIME
*D*               (J:OVHTIM),  THE BRANCH REGISTER IS SET IN J:ALB
*D*               ALONG WITH THE PROCESSOR NUMBER ON WHICH THE USER WAS
*D*               EXECUTING (FROM S:PNO)
         SPACE    1
*D*               THE SPECIFIC TRAP ADDRESS IS LOADED INTO R6,
*D*               THE TRAP CCS ARE MERGED WITH IT AND ALSO PUT IN R3
         SPACE    1
*D*               THE INTERRUPTS ARE ENABLED  AND EXIT IS MADE TO THE
*D*               PROPER ROUTINE FOR ADDITIONAL SPECIFIC PROCESSING
         PAGE
***************************************************************
*             COMMON TRAP PROCESSING                          *
***************************************************************
         SPACE    2
T:CTRAPM RES      0
         AI,R1    -1                BACK IT UP TO BRANCH
         XW,R1    TEMP%BREG         AND STORE IT AWAY
         STD,R6   TEMP              SAVE R6,R7
         LI,R6    -XPSDV            FORM INDEX
         AW,R6    CTRAPSD           TO GET REAL PSD
         AND,R6   M17               SCRUB
         SLS,R6   -2                DIVIDE BY 4
*                                   NUMBER OF INST IN RTRAP
         LB,R7    TPSDV,R6          GET INDEX TO REAL PSD
         STW,R6   PULLE1            SAVE INDEX
         LD,R6    TPSDBASE,R7       GET PSD
         MTW,0    S:PNO             CHECK FOR SLAVE
         BNEZ     CTRP2             YES,SLAVE CPU
         CW,R6    Y004              CHECK FOR MAP
         BANZ     CTRP2             YES, WE ARE MAPPED
         LPSD,8   CTRP2U            UNMAP
CTRP2    STW,R0   TEMP2             SAVE R0
         LH,R0    TSTACK+1
         CI,R0    19                CHECK FOR STACK SPACE
         BGE      CTRP3             ALL OK
         LW,R0    TEMP2             RESTORE 0
         STD,6    TRAPPSD              <SAVE USER PSD FOR RECOVER>
         LD,R6    TEMP               AND R6,R7
SCR79    SUA      X'79'             SUA 79
*                 ***
*                 ***
*                 ***
*                 ***
*                 ***
         PAGE
*S*      SCREECH CODE:  79
         SPACE    1
*S*      REPORTED BY: ENTRY
         SPACE    1
*S*      MESSAGE: MONITOR COMMITTED A STACK TRAP
         SPACE    1
*S*      TYPE:    SUA
         SPACE    1
*S*      REGISTERS:
*S*               REGISTERS AT TIME OF TRAP
         SPACE    1
*S*      REMARKS:
*S*               NOT ENOUGH ROOM IN TSTACK TO STORE AN ENVIRONMENT
         PAGE
CTRP3    LW,R0    TEMP2             RESTORE 0
         MTW,0    S:CUN             SLAVE UN=0 IF NO CURRENT USER
*                                   MASTER S:CUN IS ALWAYS NONZERO
         BNEZ     CTRP3A            OK, EITHER MASTER OR SLAVE HAS USER
         MTW,0    S:PNO             CHECK FOR BAD TRAP IN SLAVE
         BEZ      CTRP3A            NO, MASTER
         SCREECH  X'78',1           SLAVE TRAP WITHOUT USER
CTRP3A   RES      0
         PUSH     6,R13             SAVE REGS
         LD,R0    R6                GET PSD
         LD,R6    TEMP              RESTORE REGS
         BAL,R2   T:SAVE            SAVE STANDARD ENV
*                              NOTE: R4=>PSD IN STAK; USED BY 40TRAP.
         LW,R1    PULLE1            RESTORE INDEX
         LB,R2    TRPTV,R1          GET ADDRESS OF PROCESSING ROUTINE
         LI,R14   J:OVHTIM          SET CLOCK TO OVERHEAD
         STW,R14  S:CLOCK4          ACCOUNTING
         LI,R3    0                 MOVE BREG
         XW,R3    TEMP%BREG         AND ZAP
         LI,R5    J:JIT             SET JIT ADDRESS
         LW,R3    S:PNO             CHECK FOR MASTER CPU
CTRP4    LB,R6    TADR,R1           GET TRAP ADDRESS
         LW,R7    YFF               MASK
         LS,R6    PULLE1+1          GET TRAP CC
         LB,R3    PULLE1+1          GET TRAP COND CODE
*
*                 'ENABLE' MOVED FURTHER DOWNSTREAM BECAUSE OF
*                 M:INTRTN'S (REAL-TIME) NEED TO BE ENTERED INHIBITED
*
         B        TRAPBASE,R2       GO TO PROPER ROUTINE
         PAGE
*D*      NAME:    CAL234
         SPACE    1
*D*      REGISTERS:
*D*               AS DESCRIBED IN REPORT D FOR T:CTRAPM
*D*               PLUS R14 HAS A X'B2' IN IT
         SPACE    1
*D*      ENVIRONMENT:
*D*               MAPPED/UNMAPPED AS DEFINED BY PSD AT TIME OF TRAP
*D*               ENABLED,WRITE KEY 1, EXECUTED BY MASTER CPU ONLY
         SPACE    1
*D*      OUTPUT:
*D*               R14 = X'B2'
         SPACE    1
*D*      DESCRIPTION:
*D*               AN ATTEMPT WAS MADE TO EXECUTE A CAL2,CAL3,CAL4 WHICH
*D*               CAUSES AN EXIT TO CALBAD IN ALTCP WITH AN ERROR CODE
*D*               OF X'B2' IN R14
*D*               IF A SLAVE CPU HAS BEEN EXECUTING THIS CODE ITS USER
*D*               WILL BE PARKED PRIOR TO EXITING TO CALBAD.
         SPACE    3
*E*      ERROR:   B2 00
         SPACE    1
*E*      MESSAGE: DONT USE CAL2,CAL3,CAL4 INSTRUCTION
         SPACE    3
*D*      NAME:    TRAPS
         SPACE    1
*D*      REGISTERS:
*D*               ENVIRONMENT HAS BEEN SAVED PREVIOUSLY
*D*               USES R1
         SPACE    1
*D*      INPUT:
*D*               R0 = FIRST WORD OF PSD
*D*               R1 = TRAP INDEX FROM T:CTRAPM
*D*               R6 = BYTE 0 TRAP CC
*D*                    BYTE 3 TRAP ADDRESS
         SPACE    1
*D*      OUTPUT:
*D*               R0 = FIRST WORD OF PSD
*D*               R1 = TRAP CC AND TRAP ADDRESS IN RIGHT HALFWORD
*D*               R3 = TRAP MASK AS APPROPRIATE FOR PARTICULAR TRAP
         SPACE    1
*D*      DESCRIPTION:
*D*               THIS ROUTINE IS ENTERED FROM T:CTRAPM FOR
*D*               TRAPS X'40' TO X'45' ONLY
*D*               IT FORMS THE PARTICULAR TRAP ADDRESS AND CONDITION
*D*               CODES INTO THE RIGHT HALFWORD OF R1 AND EXITS TO
*D*               40TRAP IN ALTCP FOR FURTHER PROCESSING
         PAGE
***************************************************************
*                   TRAP PROCESSING ROUTINES                  *
***************************************************************
         SPACE    2
TRAPBASE RES      0
CAL234   RES      0
         LI,R14   X'B2'             ERROR CODE
************************************************************
         BLOCK                      WILL PARK SLAVE USER
************************************************************
         B        CALBAD            BAD CAL
         SPACE    2
TRAPS    LB,R3    TMSK,R1           GET TRAP MASK
         LB,R8    R6                GET TRAPCC
         SLS,R8   4                 ALIGN
         OR,R8    R6                MERGE WITH TRAP ADDRESS
         LI,R9    X'FFFF'
         STS,R8   J:JIT+MPPO        PUT CC'S AND TRAP# IN JIT
********************************************************
         BLOCK                      WILL PARK SLAVE USER
********************************************************
         LD,R0    *R4               RECLAIM USER'S PSD @ TRAP
         STD,R0   TRAPPSD           AND PUT IN TRAPPSD FOR RECOVERY.
         B        40TRAP            AND GO
*                    R0/R1          USER'S PSD @ TRAP
*                    R2             ---
*                    R3             THIS TRAP'S BIT IN J:USENT
*                    R4             => USER'S PSD IN TSTACK
*                    R5             =>JIT
*                    R6             (0-3)TRAPCC  (24-31)TRAP#
         PAGE
*F*      NAME:    CAL1P
         SPACE    1
*F*      PURPOSE:
*F*               TO PERFORM THE INITIAL CHECK FOR A CAL1,1
         SPACE    1
*F*      DESCRIPTION:
*F*               THIS 3 INSTRUCTION ROUTINE CHECKS
*F*               CONDITIONS CODES AND IF A CAL1,1 HAS BEEN EXECUTED
*F*               IMMEDIATELY ENTERS THE CAL11N ROUTINE FOR FAST CAL
*F*               PROCESSING
*F*               OTHERWISE, A STANDARD TRAP TYPE ENTRY IS MADE TO
*F*               T:CTRAPM THROUGH A CAL1PA SPECIFIC ENTRY
*F*               AT CAL1PP THE SLAVE CPU USER IS PARKED
         SPACE    1
*F*      REFERENCE:
*F*               SEE REPORTS F AND D FOR NOPPGM AND T:CTRAPM
         PAGE
***************************************************************
*                      CAL1 PROCESSOR                         *
***************************************************************
         SPACE    2
CAL1P    BCR,14   CAL11N            SELECT CAL1,1
         B        CAL1PA            OTHER CAL1
CAL1PP   EQU      %
************************************************************
         BLOCK                      WILL PARK SLAVE USER
************************************************************
         B        CAL1P11           NORMAL CAL1 PROCESSING
         PAGE
*D*      NAME:    CAL11N
         SPACE    1
*D*      REGISTERS:
*D*               ALL REGISTERS ARE SAVED
         SPACE    1
*D*      CALL:
*D*               FROM  CAL1P WHEN DETERMINE A CAL1,1 IS BEING PROCESSED
         SPACE    1
*D*      ENVIRONMENT:
*D*               MAPPED,MASTER MODE, WRITE KEY 1
*D*               ENTERS WITH ALL INHIBITS ON BUT
*D*               ENABLES AS SOON AS REGISTERS AND PSD ARE STASHED
         SPACE    1
*D*      OUTPUT:
*D*               R5 = JIT ADDRESS
*D*               R6 = DCB ADDRESS
*D*               R7 = FPT ADDRESS
*D*               R8 = FUNCTION CODE IF DCB INDIRECTLY ADDRESSED
         SPACE    1
*D*      DESCRIPTION:
*D*               THIS ROUTINE IS USED FOR FAST CAL1,1 PROCESSING
*D*               FIRST A CHECK IS MADE TO INSURE THAT A
*D*               CAL1,1 IS INDEED BEING PROCESSED AND THAT IT
*D*               IS NOT BEING EXU ED
*D*               EITHER CONDITION WOULD CAUSE A NORMAL CAL PROCESSING
*D*               AS DESCRIBED IN THE F REPORT FOR CAL1P
         SPACE    1
*D*               WHILE STILL DISABLED THE REGISTERS ARE PUSHED
*D*               AS A STANDARD ENVIRONMENT AND A PUSHALL BLOCK
*D*               IS CREATED IN THE STACK
*D*               AND THE ADDRESS OF THE FPT PLACED IN R7
*D*               TO WHICH THE DISPLACEMENT INTO THE STACK IS ADDED
*D*               IF THE FPT WAS IN THE REGISTERS
         SPACE    1
*D*               AFTER ENABLING THE CLOCK IS SET TO OVERHEAD
*D*               THE COUNT OF CALS INCREMENTED IN J:CALCNT
*D*               AND THE JIT ADDRESS PLACED IN R5
         SPACE    1
*D*               THE DCB ADDRESS IS LOADED INTO R6 AND IF NOT
*D*               INDIRECTLY ADDRESSED AN IMMEDIATE EXIT IS MADE TO
*D*               CAL11N3 IN CALPROC FOR FURTHER FAST PROCESSING
         SPACE    1
*D*               IF THE DCB WAS INDIRECTLY ADDRESSED THEN THE FUNCTION
*D*               CODE IN WORD 0 OF THE FPT IS LOADED INTO R8 AND
*D*               THE ADDRESS ITSELF IS TESTED TO SEE IF IT IS IN THE
*D*               REGISTERS IF SO THEN THE REAL DCB ADDRESS IS FETCHED
*D*               FROM ITS LOCATION IN THE STACK AND EXIT IS MADE
*D*               TO CAL11NB   ( SINCE THE FUNCTION CODE IS ALREADY
*D*               IN R8)
         PAGE
CAL11N   BCS,1    CAL11N1           SELECT CAL1,1
         B        CAL1P+1           NOT CAL1,1
CAL11N1  LC      *CAL1PSD           CHK FOR EXU
         BCR,6    CAL11N2           BRANCH IF NOT
         LCI      1                 RESTORE ORIGINAL CC
         B        CAL1P+1           USE OLD PATH
CAL11N2  STW,1    J:BASE            SAVE
         LI,1     19+8              OPEN UP
         MSP,1    TSTACK             THE STACK
         LI,1     -15-8             REGISTER 0
         AW,1     TSTACK             STORAGE LOC
         XW,1     J:BASE            RESTORE REG 1
         LCI      0                 STASH
         STM,0   *J:BASE             THE REGISTERS
         ANLZ,7  *CAL1PSD           ADDRESS OF FPT
         CI,7     15                CHK 4 REGISTER
         BG       %+2               SKIP IF NOT
         AW,7     J:BASE            STACK STRGE FOR REGISTERS
         LD,0     CAL1PSD           STASH
         LI,3     X'1FFFF'           THE
         STD,0   *J:BASE,3            PSD
         ENABLE                     LET 'EM COME
         LI,R11   J:OVHTIM          SET CLOCK TO ACCOUNT FOR
         STW,R11  S:CLOCK4          MONITOR SERVICE TIME
         MTW,1    J:CALCNT          BUMP COUNT OF CALS
         LI,5     J:JIT             INITIALIZE
         LW,6     0,7               GET DCB ADDRESS
         BGEZ     CAL11N3           BRANCH IF NOT INDIRECTLY ADDRESSED
         LB,8     6                 GET
         AI,8     -X'80'             FUNCTION CODE
         CI,6     X'1FFF0'          CHK
         BANZ     %+2                NOT REG
         AW,6     J:BASE            STACK ADDRESS OF REGISTER
         LW,6     0,6               DCB ADDR
         B        CAL11NB
         END

