{"id":417,"date":"2012-01-16T22:16:00","date_gmt":"2012-01-17T04:16:00","guid":{"rendered":"http:\/\/tommysprinkle.com\/txxos\/?p=417"},"modified":"2021-04-17T18:20:13","modified_gmt":"2021-04-17T23:20:13","slug":"svc-0-excp","status":"publish","type":"post","link":"https:\/\/tommysprinkle.com\/txxos\/?p=417","title":{"rendered":"SVC 0 &#8211; EXCP"},"content":{"rendered":"<p>EXCP provides a SVC interface to schedule I\/O requests. \u00a0The IOB is the parameter list for the SVC.<\/p>\n<pre>000000                                6 S000EXCP CSECT ,\r\n000000 18CF                           7          LR    R12,R15            SET BASE\r\n                            00000     8          USING S000EXCP,R12               REGISTER\r\n                                      9 *\r\n000002 18A1                          10          LR    R10,R1             COPY IOB POINTER\r\n                            00000    11          USING @IOB,R10\r\n                                     12 *\r\n000004 9180 A014      00014          13          TM    IOBFLG4,IOBFUCBP   NO DCB, IOBDCBPT PTS TO UCB\r\n000008 47E0 C0FC      000FC          14          BNO   EXCP990              NO - CAN'T DEAL WITH IT NOW\r\n                                     15 * \r\n00000C 1F44                          16          SLR   R4,R4\r\n00000E BF47 A015      00015          17          ICM   R4,B'0111',IOBDCBPT   GET UCB ADDRESS\r\n                            00000    18          USING @UCB,R4<\/pre>\n<p>The IOB address is saved into Register 10. \u00a0For now since we haven&#8217;t defined the Data Control Block (DCB) we only accept requests passing the UCB address instead of the DCB address.<\/p>\n<pre>000012 5810 0010      00010          20          L     R1,16              CVT\r\n000016 5810 1008      00008          21          L     R1,CVTUCB-@CVT(,R1)   UCB TABLE\r\n00001A                               22 EXCP010  DS    0H \r\n00001A D501 C15C 4004 0015C 00004    23          CLC   =X'FFFF',UCBCUA    END OF THE LINE \r\n000020 4780 C0DC      000DC          24          BE    EXCP900            BAD UCB ADDRESS\r\n                                     25 * \r\n000024 1914                          26          CR    R1,R4              UCB WE ARE LOOKING FOR\r\n000026 4780 C032      00032          27          BE    EXCP020              YES - WE FOUND IT\r\n                                     28 *\r\n00002A 5810 1000      00000          29          L     R1,0(,R1)          NEXT UCB\r\n00002E 47F0 C01A      0001A          30          B     EXCP010              LOOP BACK<\/pre>\n<p>The UCB address is validated.<\/p>\n<pre>000032                               33 EXCP020  DS    0H\r\n000032 9180 4007      00007          34          TM    UCBSTAT,UCBSONLN   IS UCB ONLINE\r\n000036 47E0 C0E4      000E4          35          BNO   EXCP910              NO - CAN'T DO I\/O\r\n                                     36 *\r\n00003A 4110 006C      0006C          37          LA    R1,IORBLEN         LENGTH OF IORB\r\n00003E BF18 C15E      0015E          38          ICM   R1,B'1000',=AL1(128)  SP ID\r\n                                     39          @CALL GETMAIN\r\n000042 58F0 0014      00014          40+         L     R15,20             MVT ADDRESS\r\n000046 58F0 F018      00018          41+         L     R15,MVTGMAIN-@MVT(,R15) ROUTINE ADDRESS\r\n00004A 05EF                          42+         BALR  R14,R15\r\n00004C 12FF                          43          LTR   R15,R15            CHECK FOR STORAGE RETURNED\r\n00004E 4770 C0EC      000EC          44          BNZ   EXCP920\r\n                                     45 * \r\n000052 18B1                          46          LR    R11,R1             IORB ADDRESS\r\n\f                            00000    47          USING @IORB,R11\r\n                                     48 *\r\n000054 4110 0060      00060          49          LA    R1,TCBLEN          LENGTH OF TCB\r\n000058 BF18 C15E      0015E          50          ICM   R1,B'1000',=AL1(128)   SP ID\r\n                                     51          @CALL GETMAIN\r\n00005C 58F0 0014      00014          52+         L     R15,20             MVT ADDRESS\r\n000060 58F0 F018      00018          53+         L     R15,MVTGMAIN-@MVT(,R15) ROUTINE ADDRESS\r\n000064 05EF                          54+         BALR  R14,R15\r\n000066 12FF                          55          LTR   R15,R15\r\n000068 4770 C0EC      000EC          56          BNZ   EXCP920\r\n                                     57 *\r\n00006C 1891                          58          LR    R9,R1               TCB ADDRESS\r\n                            00000    59          USING @TCB,R9<\/pre>\n<p>If the UCB is offline the request is rejected. \u00a0Now we allocate storage for a IORB that will be passed to the Schedule I\/O routine. \u00a0We 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.<\/p>\n<pre>00006E D76B B000 B000 00000 00000    61          XC    0(IORBLEN,R11),0(R11)   CLEAR IORB STORAGE\r\n000074 5040 B004      00004          62          ST    R4,IORBUCB          UCB ADDRESS\r\n000078 50A0 B008      00008          63          ST    R10,IORBIOB         IOB ADDRESS\r\n00007C 1F11                          64          SLR   R1,R1\r\n00007E BF17 A011      00011          65          ICM   R1,B'0111',IOBSTART GET CCW ADDRESS\r\n000082 5010 B00C      0000C          66          ST    R1,IORBCCW          CCW ADDRESS\r\n000086 5090 B010      00010          67          ST    R9,IORBTCB          TCB ADDRESS\r\n00008A 4110 C0CE      000CE          68          LA    R1,EXCPDIE          DIE ROUTINE\r\n00008E 5010 B014      00014          69          ST    R1,IORBDIE         DIE ROUTINE ADDRESS<\/pre>\n<p>Now we set up the IORB with the necessary pointers. \u00a0The UCB, CCW and IOB addresses come from the IOB.<\/p>\n<pre>000092 D75F 9000 9000 00000 00000    71          XC    0(TCBLEN,R9),0(R9) CLEAR TCB\r\n000098 D207 9018 C158 00018 00158    72          MVC   TCBPSW,=X'FF000000'\r\n00009E 4110 C10E      0010E          73          LA    R1,BACKEND         BACK END EXCP ROUTINE\r\n0000A2 5010 901C      0001C          74          ST    R1,TCBPSW+4\r\n0000A6 5010 905C      0005C          75          ST    R1,TCBREG15        SET EP IN R15\r\n0000AA 50B0 9024      00024          76          ST    R11,TCBREG1        SAVE IORB ADDRESS IN R1\r\n0000AE 4110 C0D0      000D0          77          LA    R1,EXCPRET         RETURN SVC\r\n0000B2 5010 9058      00058          78          ST    R1,TCBREG14        SAVE AS R14<\/pre>\n<p>Now we set up the TCB to be ready for dispatch. \u00a0We build a PSW with interrupts enabled. \u00a0The instruction address in the PSW points to our EXCP back end processing routine. \u00a0We also place that address into the Register 15 area and we place the IORB address in the Register 1 area. \u00a0When 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. \u00a0The TCB storage will be freed when the back end routine exits via SVC 3.<\/p>\n<pre>0000B6 4110 B000      00000          80          LA    R1,@IORB\r\n                                     81          @CALL STARTIO\r\n0000BA 58F0 0014      00014          82+         L     R15,20             MVT ADDRESS\r\n0000BE 58F0 F030      00030          83+         L     R15,MVTSIO-@MVT(,R15) ROUTINE ADDRESS\r\n0000C2 05EF                          84+         BALR  R14,R15\r\n                                     85 *\r\n                                     86          @CALL EXIT\r\n0000C4 58F0 0014      00014          87+         L     R15,20             MVT ADDRESS\r\n0000C8 58F0 F024      00024          88+         L     R15,MVTEXIT-@MVT(,R15) ROUTINE ADDRESS\r\n0000CC 05EF                          89+         BALR  R14,R15<\/pre>\n<p>Now we call the Schedule I\/O routine passing it the address of our IORB. \u00a0Once the I\/O is scheduled we can exit the SVC routine.<\/p>\n<pre>0000CE                               92 EXCPDIE  DS    0H\r\n0000CE 07FE                          93          BR    R14<\/pre>\n<p>Our Disabled Interrupt Exit simply returns back to the caller.<\/p>\n<pre>0000D0                               96 EXCPRET  DS    0H\r\n\f                                     97          @CALL EXIT\r\n0000D0 58F0 0014      00014          98+         L     R15,20             MVT ADDRESS\r\n0000D4 58F0 F024      00024          99+         L     R15,MVTEXIT-@MVT(,R15) ROUTINE ADDRESS\r\n0000D8 05EF                         100+         BALR  R14,R15\r\n0000DA 0A03                         101          SVC   3<\/pre>\n<p>Here we exit via the Exit routine.<\/p>\n<pre>0000DC                              104 EXCP900  DS    0H\r\n0000DC 4110 0100      00100         105          LA    R1,X'100'          ABEND CODE\r\n0000E0 47F0 C104      00104         106          B     EXCP999\r\n                                    107 *\r\n0000E4                              108 EXCP910  DS    0H\r\n0000E4 4110 0200      00200         109          LA    R1,X'200'\r\n0000E8 47F0 C104      00104         110          B     EXCP999\r\n                                    111 *\r\n\f0000EC                              112 EXCP920  DS    0H\r\n0000EC 4110 0300      00300         113          LA    R1,X'300'\r\n0000F0 47F0 C104      00104         114          B     EXCP999 \r\n                                    115 *\r\n0000F4                              116 EXCP930  DS    0H\r\n0000F4 4110 0900      00900         117          LA    R1,X'900' \r\n0000F8 47F0 C104      00104         118          B     EXCP999\r\n                                    119 *\r\n0000FC                              120 EXCP990  DS    0H\r\n0000FC 4110 0F00      00F00         121          LA    R1,X'F00'\r\n000100 47F0 C104      00104         122          B     EXCP999\r\n                                    123 *\r\n000104                              124 EXCP999  DS    0H \r\n                                    125          @CALL ABEND \r\n000104 58F0 0014      00014         126+         L     R15,20             MVT ADDRESS\r\n000108 58F0 F020      00020         127+         L     R15,MVTABEND-@MVT(,R15) ROUTINE ADDRESS \r\n00010C 05EF                         128+         BALR  R14,R15<\/pre>\n<p>These are the various Abend exit points. \u00a0An Abend code is placed into Register 1 and the Abend routine is called. \u00a0The Abend routine does not return back to the caller.<\/p>\n<pre>                                    131          DROP   R4,R9,R10,R11,R12 \r\n                                    133 *\r\n00010E                              134 BACKEND  DS    0H \r\n00010E 18CF                         135          LR    R12,R15            ESTABLISH BASE\r\n                            0010E   136          USING BACKEND,R12                      REGISTER\r\n                                    137 *\r\n000110 18B1                         138          LR    R11,R1             IORB ADDRESS \r\n                            00000   139          USING @IORB,R11\r\n                                    140 *\r\n000112 58A0 B008      00008         141          L     R10,IORBIOB        IOB ADDRESS \r\n                            00000   142          USING @IOB,R10<\/pre>\n<p>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. \u00a0The I\/O Interruption routine places the TCB on the Dispatcher queue.<\/p>\n<pre>000116 D200 A002 B022 00002 00022   144          MVC   IOBSENS0,IORBSEN0  COPY \r\n00011C D200 A003 B023 00003 00023   145          MVC   IOBSENS1,IORBSEN1      SENSE BYTES\r\n000122 D206 A009 B025 00009 00025   146          MVC   IOBCSW,IORBCSW+1   COPY CSW\r\n000128 D200 A004 B021 00004 00021   147          MVC   IOBECBCC,IORBECBC  COPY I\/O COMPLETION CODE<\/pre>\n<p>We start by copying status information from the IORB into the IOB.<\/p>\n<pre>00012E 1F11                         149          SLR   R1,R1\r\n000130 BF17 A005      00005         150          ICM   R1,B'0111',IOBECBPT  GET ECB ADDRESS\r\n                                    151          @CALL POST \r\n000134 58F0 0014      00014         152+         L     R15,20             MVT ADDRESS\r\n000138 58F0 F028      00028         153+         L     R15,MVTPOST-@MVT(,R15) ROUTINE ADDRESS\r\n00013C 05EF                         154+         BALR  R14,R15\r\n                                    155 *\r\n00013E 4100 B000      00000         156          LA    R0,@IORB           POINT TO IORB\r\n\f000142 BF18 C050      0015E         157          ICM   R1,B'1000',=AL1(128)   SP ID \r\n                                    158          @CALL FREEMAIN\r\n000146 58F0 0014      00014         159+         L     R15,20             MVT ADDRESS \r\n00014A 58F0 F01C      0001C         160+         L     R15,MVTFMAIN-@MVT(,R15) ROUTINE ADDRESS\r\n00014E 05EF                         161+         BALR  R14,R15 \r\n                                    162 * \r\n000150 0A03                         163          SVC   3                  EXIT<\/pre>\n<p>We Post the ECB pointed to by the IOB before we free the IORB storage and exit via SVC 3.<\/p>\n<p>[Next &#8211; ]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>EXCP provides a SVC interface to schedule I\/O requests. \u00a0The 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 &hellip; <a href=\"https:\/\/tommysprinkle.com\/txxos\/?p=417\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"template-page-builder-no-sidebar.php","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-417","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1CPQT-6J","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/posts\/417","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=417"}],"version-history":[{"count":3,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/posts\/417\/revisions"}],"predecessor-version":[{"id":419,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/posts\/417\/revisions\/419"}],"wp:attachment":[{"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=417"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=417"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=417"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}