Writing SVC routines

You can introduce user-written SVC routines into the control program whenever you IPL the system. When you write an SVC routine, you must follow the same programming conventions used by SVC routines supplied with the system. Five types of SVC routines are supplied, and the programming conventions for each type are different.

SVC routines, including user-written ones, can either be part of the resident control program (the nucleus), or be part of the fixed or pageable link pack area. Types 1, 2, and 6 SVC routines become part of the resident control program, and types 3 and 4 go into the link pack area. Before IPLing the system, you must place your SVC routine in SYS1.NUCLEUS or SYS1.LPALIB. You must also create, before IPLing the system, an IEASVCxx member in SYS1.PARMLIB with SVCPARM statements that describe the characteristics of your SVC routine.

SVC routines receive control with PSW key zero and in supervisor state. They must be reenterable and, if you want to aid system facilities in recovering from machine malfunctions, they must also be refreshable. If you write two or more SVC routines that must serialize with each other, use the locking facilities or the ENQ and DEQ macros.

When you insert an SVC routine into the control program, you specify which locks the routine will require. When an SVC routine receives control, it is normally enabled and it can be holding one or more locks. However, if you specified that the routine requires a CPU lock, the routine is disabled when it receives control. The routine is also entered in a disabled state if it is a type 6 SVC routine.

If the SVC needs to update the PSW in the current or prior RB, it should use the IEARBUP service. IEARBUP allows part or all of the PSW in RBOPSW to be updated. Updates made directly to RBOPSW may be ignored.