Programming conventions for SVC routines
Table 1 summarizes the programming conventions for the five types of SVC routines. Details about many of the conventions are in the reference notes that follow the figure. The numbers in the far right column of the figure correspond to the reference notes.
Conventions | Type 1 | Type 2 | Type 3 | Type 4 | Type 6 | Reference Code |
---|---|---|---|---|---|---|
Part of resident control program | Yes | Yes | No | No | Yes | |
Size of routine | Any | Any | Any | Any | Any | |
Reenterable routine | Yes | Yes | Yes | Yes | Yes | 1 |
Refreshable routine | No | No | Yes | Yes | No | 2 |
Locking requirements | Yes | No | No | No | No | 3 |
Entry point: Must be on a halfword boundary and must be the first instruction to get control. Need not be the first byte of the module | ||||||
Number of routine: Numbers assigned to your SVC routine should be in descending order from 255 through 200 | ||||||
Name of routine | IGCnnn | IGCnnn | IGC00nnn | IGC00nnn | IGCnnn | 4 |
Register contents at entry time: Registers 3, 4, 5, 6, 7, and 14 contain communication pointers; registers 0, 1, 13, and 15 are parameter registers | ||||||
Supervisor request block(SVRB) used | No SVRB |
Yes | Yes | Yes | No SVRB |
6 |
May issue WAIT macro | No | Yes | Yes | Yes | No | 7 |
May suspend their caller | Yes | No | No | No | Yes | 8 |
May issue XCTL macro | No | Yes | Yes | Yes | No | 9 |
May pass control to what other types of SVC routines | None | Any | Any | Any | None | 10 |
Type of linkage with other SVC routines | Not |
Issue supervisor call (SVC) instruction | Issue supervisor call (SVC) instruction | Issue supervisor call (SVC) instruction | Not Applicable | 11 |
Exit from SVC routine | Branch using return register 14 | Branch using return register 14 | Branch using return register 14 | Branch using return register 14 | T6EXIT |
12 |
Method of abnormal termination | ABEND | ABEND | ABEND | ABEND | ABEND | |
Recovery | FRR | ESTAE or FRR | ESTAE or FRR | ESTAE or FRR | FRR | 13 |
Reference Code | SVC Routine Types | Reference Notes |
---|---|---|
1 | all | If your SVC routine is to be reenterable, you cannot use macros whose expansions store information into an inline parameter list. |
2 | 3,4 | Types 3 and 4 in the pageable LPA must be refreshable. Types 3 and 4 in the fixed LPA must be reenterable, but not necessarily refreshable. |
3 | all | The following conventions on locking requirements
apply:
|
4 | all | You must use the following conventions when naming
SVC routines:
The following conventions regarding type 3 and 4 SVCs are
not enforced by SVC processing, but have traditionally been used to
distinguish between the two types:
|
5 | all | Before your SVC routine receives control, the
contents of all registers are saved. In general, the location of
the register save area is unknown to the routine that is called.
When your SVC routine receives control, the status of the general
purpose registers is as follows:
The access registers (AR) are unchanged from when the SVC instruction was issued. You must use register 0, 1, and 15 if you want to pass information to the calling program. The contents of General Purpose registers 2 through 14 are restored when control is returned to the calling program, Access registers are not. |
6 | 2,3,4 | When a type 2, 3, or 4 SVC routine receives control, register 5 contains the address of the SVRB. |
This SVRB contains a 48-byte “extended save area,” RBEXSAVE, for use by the SVC routine. | ||
7 | 2,3,4 | You can issue the WAIT macro if you hold no locks. You can issue WAIT macros that await either single or multiple-events. The event control block (ECB) for single-event waits on the ECB list and ECBs for multiple-event waits must be in virtual storage. Type 6 SVCs may not issue WAIT but may issue SUSPEND. |
8 | 1,6 | Both type 1 and 6 SVC routines can issue SUSPEND RB=CURRENT to suspend their callers. |
9 | 2,3,4 | When you issue an XCTL(X) macro in a routine under control of a type 2, 3, or 4 SVC, the new load module must be located in the fixed or pageable link pack area. |
The contents of registers 2 through 13 are unchanged
when control is passed to the load module; register 15 contains the
entry point of the called load module. An SVC routine will get control with the caller's Floating Point Registers and Floating Point Control register. An SVC routine will get control with the caller's Floating Point Registers and Floating Point Control register. The S/390® linkage convention applies. For more information on the S/390, see "Linkage Convention" in z/OS MVS Programming: Assembler Services Guide. |
||
10 | all | No SVC routines except ABEND may be called if locks are held. ABEND may be called at any time. |
11 | all | No locks may be held. If locks are held, branch entry to SVCs is acceptable, or the locks may be freed, the SVC issued, and the locks obtained again. |
12 | all | Branch using return register 14 should be used. SVC routines that exit via BR 14 or T6EXIT must return control in the same state in which they received control, such as, key zero, supervisor state. Otherwise, if locks are held, returning to the system will result in abnormal termination. Note: To ensure that control is returned to the dispatcher, the SVC routine can load register 14 with the address in the CVTEXP1 field of the CVT before issuing BR 14. |
13 | all | If an SVC routine is entered with a lock held
or if an SVC routine obtains a lock, it should specify a functional
recovery routine (FRR) for as long as the lock is held
(see SETFRR macro). The FRR receives control if an error occurs,
and ensures the validity of the data being serialized by the lock;
the FRR either recovers or releases the lock and continues with termination. If no FRR is specified, the recovery termination manager releases the lock and terminates the task. No cleanup of the data is performed. (Note that the lock is released before any STAI/ESTAI/ESTAE (or STAE) recovery routine is entered. If no locks are acquired for or by an SVC routine, then an ESTAE may be used to define your recovery processing (see ESTAE and SETRP macros). |