EXCP provides a SVC interface to schedule I/O requests.  The IOB is the parameter list for the SVC.

000000                                6 S000EXCP CSECT ,
000000 18CF                           7          LR    R12,R15            SET BASE
                            00000     8          USING S000EXCP,R12               REGISTER
                                      9 *
000002 18A1                          10          LR    R10,R1             COPY IOB POINTER
                            00000    11          USING @IOB,R10
                                     12 *
000004 9180 A014      00014          13          TM    IOBFLG4,IOBFUCBP   NO DCB, IOBDCBPT PTS TO UCB
000008 47E0 C0FC      000FC          14          BNO   EXCP990              NO - CAN'T DEAL WITH IT NOW
                                     15 * 
00000C 1F44                          16          SLR   R4,R4
00000E BF47 A015      00015          17          ICM   R4,B'0111',IOBDCBPT   GET UCB ADDRESS
                            00000    18          USING @UCB,R4

The IOB address is saved into Register 10.  For now since we haven’t defined the Data Control Block (DCB) we only accept requests passing the UCB address instead of the DCB address.

000012 5810 0010      00010          20          L     R1,16              CVT
000016 5810 1008      00008          21          L     R1,CVTUCB-@CVT(,R1)   UCB TABLE
00001A                               22 EXCP010  DS    0H 
00001A D501 C15C 4004 0015C 00004    23          CLC   =X'FFFF',UCBCUA    END OF THE LINE 
000020 4780 C0DC      000DC          24          BE    EXCP900            BAD UCB ADDRESS
                                     25 * 
000024 1914                          26          CR    R1,R4              UCB WE ARE LOOKING FOR
000026 4780 C032      00032          27          BE    EXCP020              YES - WE FOUND IT
                                     28 *
00002A 5810 1000      00000          29          L     R1,0(,R1)          NEXT UCB
00002E 47F0 C01A      0001A          30          B     EXCP010              LOOP BACK

The UCB address is validated.

000032                               33 EXCP020  DS    0H
000032 9180 4007      00007          34          TM    UCBSTAT,UCBSONLN   IS UCB ONLINE
000036 47E0 C0E4      000E4          35          BNO   EXCP910              NO - CAN'T DO I/O
                                     36 *
00003A 4110 006C      0006C          37          LA    R1,IORBLEN         LENGTH OF IORB
00003E BF18 C15E      0015E          38          ICM   R1,B'1000',=AL1(128)  SP ID
                                     39          @CALL GETMAIN
000042 58F0 0014      00014          40+         L     R15,20             MVT ADDRESS
000046 58F0 F018      00018          41+         L     R15,MVTGMAIN-@MVT(,R15) ROUTINE ADDRESS
00004A 05EF                          42+         BALR  R14,R15
00004C 12FF                          43          LTR   R15,R15            CHECK FOR STORAGE RETURNED
00004E 4770 C0EC      000EC          44          BNZ   EXCP920
                                     45 * 
000052 18B1                          46          LR    R11,R1             IORB ADDRESS
                            00000    47          USING @IORB,R11
                                     48 *
000054 4110 0060      00060          49          LA    R1,TCBLEN          LENGTH OF TCB
000058 BF18 C15E      0015E          50          ICM   R1,B'1000',=AL1(128)   SP ID
                                     51          @CALL GETMAIN
00005C 58F0 0014      00014          52+         L     R15,20             MVT ADDRESS
000060 58F0 F018      00018          53+         L     R15,MVTGMAIN-@MVT(,R15) ROUTINE ADDRESS
000064 05EF                          54+         BALR  R14,R15
000066 12FF                          55          LTR   R15,R15
000068 4770 C0EC      000EC          56          BNZ   EXCP920
                                     57 *
00006C 1891                          58          LR    R9,R1               TCB ADDRESS
                            00000    59          USING @TCB,R9

If the UCB is offline the request is rejected.  Now we allocate storage for a IORB that will be passed to the Schedule I/O routine.  We also allocate storage for a TCB that will be added to the dispatch queue when the I/O request has been completed by the device.

00006E D76B B000 B000 00000 00000    61          XC    0(IORBLEN,R11),0(R11)   CLEAR IORB STORAGE
000074 5040 B004      00004          62          ST    R4,IORBUCB          UCB ADDRESS
000078 50A0 B008      00008          63          ST    R10,IORBIOB         IOB ADDRESS
00007C 1F11                          64          SLR   R1,R1
00007E BF17 A011      00011          65          ICM   R1,B'0111',IOBSTART GET CCW ADDRESS
000082 5010 B00C      0000C          66          ST    R1,IORBCCW          CCW ADDRESS
000086 5090 B010      00010          67          ST    R9,IORBTCB          TCB ADDRESS
00008A 4110 C0CE      000CE          68          LA    R1,EXCPDIE          DIE ROUTINE
00008E 5010 B014      00014          69          ST    R1,IORBDIE         DIE ROUTINE ADDRESS

Now we set up the IORB with the necessary pointers.  The UCB, CCW and IOB addresses come from the IOB.

000092 D75F 9000 9000 00000 00000    71          XC    0(TCBLEN,R9),0(R9) CLEAR TCB
000098 D207 9018 C158 00018 00158    72          MVC   TCBPSW,=X'FF000000'
00009E 4110 C10E      0010E          73          LA    R1,BACKEND         BACK END EXCP ROUTINE
0000A2 5010 901C      0001C          74          ST    R1,TCBPSW+4
0000A6 5010 905C      0005C          75          ST    R1,TCBREG15        SET EP IN R15
0000AA 50B0 9024      00024          76          ST    R11,TCBREG1        SAVE IORB ADDRESS IN R1
0000AE 4110 C0D0      000D0          77          LA    R1,EXCPRET         RETURN SVC
0000B2 5010 9058      00058          78          ST    R1,TCBREG14        SAVE AS R14

Now we set up the TCB to be ready for dispatch.  We build a PSW with interrupts enabled.  The instruction address in the PSW points to our EXCP back end processing routine.  We also place that address into the Register 15 area and we place the IORB address in the Register 1 area.  When the TCB is dispatched execution will begin at our EXCP back end routine, R15 will contain the address of the routine and R1 will contain the address of the IORB.  The TCB storage will be freed when the back end routine exits via SVC 3.

0000B6 4110 B000      00000          80          LA    R1,@IORB
                                     81          @CALL STARTIO
0000BA 58F0 0014      00014          82+         L     R15,20             MVT ADDRESS
0000BE 58F0 F030      00030          83+         L     R15,MVTSIO-@MVT(,R15) ROUTINE ADDRESS
0000C2 05EF                          84+         BALR  R14,R15
                                     85 *
                                     86          @CALL EXIT
0000C4 58F0 0014      00014          87+         L     R15,20             MVT ADDRESS
0000C8 58F0 F024      00024          88+         L     R15,MVTEXIT-@MVT(,R15) ROUTINE ADDRESS
0000CC 05EF                          89+         BALR  R14,R15

Now we call the Schedule I/O routine passing it the address of our IORB.  Once the I/O is scheduled we can exit the SVC routine.

0000CE                               92 EXCPDIE  DS    0H
0000CE 07FE                          93          BR    R14

Our Disabled Interrupt Exit simply returns back to the caller.

0000D0                               96 EXCPRET  DS    0H
                                     97          @CALL EXIT
0000D0 58F0 0014      00014          98+         L     R15,20             MVT ADDRESS
0000D4 58F0 F024      00024          99+         L     R15,MVTEXIT-@MVT(,R15) ROUTINE ADDRESS
0000D8 05EF                         100+         BALR  R14,R15
0000DA 0A03                         101          SVC   3

Here we exit via the Exit routine.

0000DC                              104 EXCP900  DS    0H
0000DC 4110 0100      00100         105          LA    R1,X'100'          ABEND CODE
0000E0 47F0 C104      00104         106          B     EXCP999
                                    107 *
0000E4                              108 EXCP910  DS    0H
0000E4 4110 0200      00200         109          LA    R1,X'200'
0000E8 47F0 C104      00104         110          B     EXCP999
                                    111 *
0000EC                              112 EXCP920  DS    0H
0000EC 4110 0300      00300         113          LA    R1,X'300'
0000F0 47F0 C104      00104         114          B     EXCP999 
                                    115 *
0000F4                              116 EXCP930  DS    0H
0000F4 4110 0900      00900         117          LA    R1,X'900' 
0000F8 47F0 C104      00104         118          B     EXCP999
                                    119 *
0000FC                              120 EXCP990  DS    0H
0000FC 4110 0F00      00F00         121          LA    R1,X'F00'
000100 47F0 C104      00104         122          B     EXCP999
                                    123 *
000104                              124 EXCP999  DS    0H 
                                    125          @CALL ABEND 
000104 58F0 0014      00014         126+         L     R15,20             MVT ADDRESS
000108 58F0 F020      00020         127+         L     R15,MVTABEND-@MVT(,R15) ROUTINE ADDRESS 
00010C 05EF                         128+         BALR  R14,R15

These are the various Abend exit points.  An Abend code is placed into Register 1 and the Abend routine is called.  The Abend routine does not return back to the caller.

                                    131          DROP   R4,R9,R10,R11,R12 
                                    133 *
00010E                              134 BACKEND  DS    0H 
00010E 18CF                         135          LR    R12,R15            ESTABLISH BASE
                            0010E   136          USING BACKEND,R12                      REGISTER
                                    137 *
000110 18B1                         138          LR    R11,R1             IORB ADDRESS 
                            00000   139          USING @IORB,R11
                                    140 *
000112 58A0 B008      00008         141          L     R10,IORBIOB        IOB ADDRESS 
                            00000   142          USING @IOB,R10

The EXCP BACKEND routine is executed when the TCB we passed to the Schedule I/O routine is dispatched after the I/O is completed by the device.  The I/O Interruption routine places the TCB on the Dispatcher queue.

000116 D200 A002 B022 00002 00022   144          MVC   IOBSENS0,IORBSEN0  COPY 
00011C D200 A003 B023 00003 00023   145          MVC   IOBSENS1,IORBSEN1      SENSE BYTES
000122 D206 A009 B025 00009 00025   146          MVC   IOBCSW,IORBCSW+1   COPY CSW
000128 D200 A004 B021 00004 00021   147          MVC   IOBECBCC,IORBECBC  COPY I/O COMPLETION CODE

We start by copying status information from the IORB into the IOB.

00012E 1F11                         149          SLR   R1,R1
000130 BF17 A005      00005         150          ICM   R1,B'0111',IOBECBPT  GET ECB ADDRESS
                                    151          @CALL POST 
000134 58F0 0014      00014         152+         L     R15,20             MVT ADDRESS
000138 58F0 F028      00028         153+         L     R15,MVTPOST-@MVT(,R15) ROUTINE ADDRESS
00013C 05EF                         154+         BALR  R14,R15
                                    155 *
00013E 4100 B000      00000         156          LA    R0,@IORB           POINT TO IORB
000142 BF18 C050      0015E         157          ICM   R1,B'1000',=AL1(128)   SP ID 
                                    158          @CALL FREEMAIN
000146 58F0 0014      00014         159+         L     R15,20             MVT ADDRESS 
00014A 58F0 F01C      0001C         160+         L     R15,MVTFMAIN-@MVT(,R15) ROUTINE ADDRESS
00014E 05EF                         161+         BALR  R14,R15 
                                    162 * 
000150 0A03                         163          SVC   3                  EXIT

We Post the ECB pointed to by the IOB before we free the IORB storage and exit via SVC 3.

[Next – ]