{"id":76,"date":"2013-01-25T13:39:39","date_gmt":"2013-01-25T19:39:39","guid":{"rendered":"http:\/\/tommysprinkle.com\/mvssp\/?p=76"},"modified":"2013-05-24T15:43:39","modified_gmt":"2013-05-24T20:43:39","slug":"screening-multiple-svc-calls","status":"publish","type":"post","link":"https:\/\/tommysprinkle.com\/mvssp\/2013\/01\/25\/screening-multiple-svc-calls\/","title":{"rendered":"Screening Multiple SVC Calls"},"content":{"rendered":"<p>We have successfully managed to use SVC screening to intercept a SVC call.\u00a0 The only problem is we can only specify one routine to receive control for the intercepted SVC(s).\u00a0 What if we want to intercept more than one and execute specific code for each unique SVC call?\u00a0 We have to add some logic to determine what SVC number was called.\u00a0 Fortunately this information is saved in a Request Block.\u00a0 When our SVC intercept routine is entered register 5 contains the address of the Supervisor Request Block (SVRB) that was created by the SVC interrupt handler.\u00a0 This SVRB does not contain information about the SVC call but does point to the previous RB that does contain the system status that was saved when the SVC instruction caused an interrupt. By examining the previous RB we can determine the SVC number assoicated with the call to our intercept routine.<\/p>\n<pre>         USING RBBASIC,R5         MAP THE SVRB                     \r\n*                                                                  \r\n         L     R9,RBLINK          LINK TO PREVIOUS RB              \r\n         LA    R9,0(,R9)          CLEAN UP ADDRESS                 \r\n         BCTR  R9,0               BACK UP TO LAST BYTE OF RB PREFIX<\/pre>\n<p>Since register 5 contains the address of the SVRB we can use it to find the previous RB.\u00a0 First we map it against the RBBASIC section of the Request Block.\u00a0 We use the RBLINK field to get the address of the previous RB.\u00a0 I use the LA instruction to &#8220;clean up&#8221; the address, that is to clear the high order bits of the address.\u00a0 We then subtract one from that address so register 9 will point to the last byte of the prefix section of the RB that is located right before the beginning of the RBBASIC section.\u00a0 The last byte of the RB prefix contains the SVC interruption code or SVC number.<\/p>\n<pre>          CLI   0(R9),230                                       \r\n          BE    SVC230                                          \r\n *                                                              \r\n          CLI   0(R9),231                                       \r\n          BE    SVC231                                          \r\n *                                                              \r\n          WTO   '*** NOT SVC 230 OR SVC 231 ***',ROUTCDE=(1,11)<\/pre>\n<p>Now we can simply use a CLI instruction to check the SVC number and branch to the appropriate processing routine. We should have some type of error code in place in the event the SVC number fails to match (because we made some type of coding error). Here we simply issue a WTO and then exit.<\/p>\n<pre>SVC230   DS    0H                                        \r\n         WTO   '++++++++ SVC 230 ++++++++',ROUTCDE=(1,11)\r\n*                                                        \r\n         LR    R14,R11            RESTORE RETURN ADDRESS \r\n         BR    R14                EXIT SVC ROUTINE       \r\n*                                                        \r\nSVC231   DS    0H                                        \r\n         WTO   '++++++++ SVC 231 ++++++++',ROUTCDE=(1,11)\r\n*                                                        \r\n         LR    R14,R11            RESTORE RETURN ADDRESS \r\n         BR    R14                EXIT SVC ROUTINE<\/pre>\n<p>Our SVC routines aren&#8217;t much more interesting but they will reveal which SVC number was called.<\/p>\n<pre>\r\n         SVC   230                SHOULD BE CAPTURED BY SVC SCREENING \r\n         SVC   231                SHOULD BE CAPTURED BY SVC SCREENING \r\n         SVC   231                SHOULD BE CAPTURED BY SVC SCREENING \r\n         SVC   230                SHOULD BE CAPTURED BY SVC SCREENING<\/pre>\n<p>Now we can issue some SVC calls and see what happens.<\/p>\n<pre>JOB 6840  $HASP373 SVC03    STARTED - INIT 12 - CLASS A - SYS TCS3\r\nJOB 6840  ++++++++ SVC 230 ++++++++                               \r\nJOB 6840  ++++++++ SVC 231 ++++++++                               \r\nJOB 6840  ++++++++ SVC 231 ++++++++                               \r\nJOB 6840  ++++++++ SVC 230 ++++++++                               \r\nJOB 6840   8.55.05   0.00.00   0.00.00  0000   SVC03     MVSSP    \r\nJOB 6840   8.55.05   0.00.00   0.00.00  0000   SVC03     ######## \r\nJOB 6840  $HASP395 SVC03    ENDED<\/pre>\n<p>And when we execute the results are just we would have expected.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We have successfully managed to use SVC screening to intercept a SVC call.\u00a0 The only problem is we can only specify one routine to receive control for the intercepted SVC(s).\u00a0 What if we want to intercept more than one and execute specific code for each unique SVC call?\u00a0 We have to add some logic to &#8230;<\/p>\n<p><a href=\"https:\/\/tommysprinkle.com\/mvssp\/2013\/01\/25\/screening-multiple-svc-calls\/\" class=\"more-link\">Continue reading &lsquo;Screening Multiple SVC Calls&rsquo; &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","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":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[11],"tags":[],"class_list":["post-76","post","type-post","status-publish","format-standard","hentry","category-screening-multiple-svc-calls"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3x7AW-1e","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tommysprinkle.com\/mvssp\/wp-json\/wp\/v2\/posts\/76","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tommysprinkle.com\/mvssp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tommysprinkle.com\/mvssp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tommysprinkle.com\/mvssp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tommysprinkle.com\/mvssp\/wp-json\/wp\/v2\/comments?post=76"}],"version-history":[{"count":4,"href":"https:\/\/tommysprinkle.com\/mvssp\/wp-json\/wp\/v2\/posts\/76\/revisions"}],"predecessor-version":[{"id":82,"href":"https:\/\/tommysprinkle.com\/mvssp\/wp-json\/wp\/v2\/posts\/76\/revisions\/82"}],"wp:attachment":[{"href":"https:\/\/tommysprinkle.com\/mvssp\/wp-json\/wp\/v2\/media?parent=76"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tommysprinkle.com\/mvssp\/wp-json\/wp\/v2\/categories?post=76"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tommysprinkle.com\/mvssp\/wp-json\/wp\/v2\/tags?post=76"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}