         PCC      0
         SYSTEM   UTS
         TITLE    'S C H E D U L E R     S U B R O U T I N E S'
*P*************************************************************
*P*                                                           *
*P*           SCHDSUB - SCHEDULER SUBROUTINES                 *
*P*                                                           *
*P*      THIS MODULE CONTAINS SUBROUTINES FOR SCHED           *
*P*      WHICH DIFFER IN A MULTIPROCESSING SYSTEM             *
*P*      THE ASSEMBLY SWITCH, MP, SELECTS WHICH VERSION       *
*P*      IS CREATED.  MP=1 YIELDS THE MULTIPROCESSING         *
*P*      VERSION.                                             *
*P*                                                           *
*P*************************************************************
         SPACE    2
MP       SET      0
         SPACE    2
SCHDSUB  RES      0
         DEF      SCHDSUB
         PAGE
***************************************************************
*                       DEFS                                  *
***************************************************************
         SPACE    2
         DEF      T:MASTER          CHECK PSD FOR MASTER MODE
         DEF      T:SMPFLG          SET SLAVE ONLY FLAG
         PAGE
***************************************************************
*                          REFS                               *
***************************************************************
         SPACE    2
         REF      T:PULLE           PULL EXIT
         REF      J:JIT
         REF      S:CLOCK4
         REF      J:DELTAT
         REF      XN2
         REF      Y004
         REF      Y008
         REF      M17
         SREF     UB:MPFLG
         REF      M7
NMASTERO EQU      M7
MASTERO  EQU      X80
         PAGE
***************************************************************
*                      REGISTER DEFINITIONS                   *
***************************************************************
         SPACE    2
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
R5       EQU      5
R6       EQU      6
R7       EQU      7
R8       EQU      8
R9       EQU      9
R10      EQU      10
R11      EQU      11
R12      EQU      12
R13      EQU      13
R14      EQU      14
R15      EQU      15
         PAGE
*D*************************************************************
*D*                                                           *
*D*                       T:MASTER                            *
*D*                                                           *
*D*      PURPOSE: TO CHECK PSD OF TOPMOST ENVIRONMENT IN      *
*D*               TSTACK FOR MONITOR MODE, MASTER AND         *
*D*               BELOW JIT.  IF SO, AN IMMEDIATE EXIT IS     *
*D*               TAKEN VIA T:PULLE.  OTHERWISE S:CLOCK4      *
*D*               IS SET TO J:DELTAT TO ACCOUNT USER EXEC     *
*D*               AND A NORMAL RETURN IS MADE VIA THE LINK    *
*D*               REGISTER.  IN MULTIPROCESSING SYSTEMS,      *
*D*               THE MASTER-ONLY FLAG IN UB:MPFLG IS         *
*D*               ALSO RESET IN THIS CASE.                    *
*D*                                                           *
*D*      R0,R1 - VOLATILE                                     *
*D*      R2 - LINK                                            *
*D*      R4 - USER NUMBER - INPUT,UNCHANGED                   *
*D*                                                           *
*D*************************************************************
         SPACE    2
T:MASTER RES      0
         LI,R1    -17               POINT TO PSD OF TOP
         AW,R1    TSTACK            ENVIRONMENT IN TSTACK
         AND,R1   XN2               ON DOUBLEWORD BOUND
         LW,R0    0,R1              GET PSW1
         CW,R0    Y008              CHECK FOR SLAVE
         BANZ     MASTER1           YES
         CW,R0    Y004              CHECK FOR MAPPED
         BAZ      T:PULLE           NO, EXIT
         AND,R0   M17               SCRUB ADDRESS
         CI,R0    J:JIT             CHECK FOR EXECUTION BELOW JIT
*                                   EG, IN MONITOR OR OVERLAY
         BL       T:PULLE           YES, EXIT
MASTER1  RES      0
         LI,R0    J:DELTAT          SET CLOCK TO ACCOUNT FOR
         STW,R0   S:CLOCK4          USER EXECUTION
         DO       MP                MULTIPROCESSING
         LB,R1    UB:MPFLG,R4       GET MPFLAGS
         AND,R1   NMASTERO          RESET MASTERONLY FLAG
         STB,R1   UB:MPFLG,R4       AND SAVE NEW FLAG VALUE
         FIN      MP                MULTIPROCESSING
         B        0,R2              NORMAL RETURN IF USER
         PAGE
*D*************************************************************
*D*                                                           *
*D*                       T:SMPFLG                            *
*D*                                                           *
*D*      PURPOSE: TO SET MASTER-ONLY FLAG IN UB:MPFLG         *
*D*               FOR MULTIPROCESSING SYSTEMS.  THIS          *
*D*               FLAG  PREVENTS A USER FROM BEING            *
*D*               SCHEDULED FOR EXECUTION BY A SLAVE          *
*D*               CPU.                                        *
*D*                                                           *
*D*      R0 - VOLATILE                                        *
*D*      R1 - LINK                                            *
*D*      R4 - USER NUMBER - INPUT,UNCHANGED                   *
*D*                                                           *
*D*************************************************************
         SPACE    2
T:SMPFLG RES      0
         DO       MP                MULTIPROCESSING
         LB,R0    UB:MPFLG,R4       GET MPFLGS
         OR,R0    MASTERO           SET MASTER-ONLY BIT
         STB,R0   UB:MPFLG,R4       AND SAVE NEW FLAG SETTING
         FIN      MP                MULTPROCESSING
         B        0,R2              RETURN
         PAGE
*D*************************************************************
*D*                   DUMMY T:SES                             *
*D*                                                           *
*D*      PURPOSE: DUMMY REPLACEMENT ROUTINE FOR T:SES         *
*D*               IN NON-MULTIPROCESSING SYSTEMS              *
*D*                                                           *
*D*      R11 - LINK                                           *
*D*      ALL REGISTERS VOLATILE                               *
*D*                                                           *
*D*************************************************************
         SPACE    2
         DO       MP=0              MULTIPROCESSING
T:SES    RES      0
         DEF      T:SES
         B        *R11              RETURN
         FIN      MP
         END

