SVC — Supervisor Call — Opcode 0A / Decimal 10 — RR Instruction
- SVC number (where number is 0-255 decimal or X'00' to X'FF')
- SVC 11
|RR Instruction (2 bytes)|
The SVC instruction is available on all models, 360, 370 and z/System.
Purpose of InstructionEdit
This instruction is used to allow a program to call the operating system in order to request services. The operand is the Supervisor Call number, which is in the range 0 to 255 (decimal). The value of the operand is operating system dependent. Typically, a supervisor call is made after loading certain machine registers with values. Supervisor Calls may or may not return information. They may return the information in registers, or in specific fields which were passed in the original call.
In some cases, a supervisor call will never return. Either the call is invalid and the program is terminated, or the call is in fact the operating system call to terminate the program. Some operating systems have privileged SVCs which are not available to user programs, and not all operating systems use all SVC values.
Typically a supervisor call is used as part of an Operating System macro. For example, under OS/VS1 the WTO macro issues an SVC 35. Some operating systems will provide services to various parts of itself by using a "privileged" supervisor call. The supervisor call is not technically a privileged instruction, it is that the operating system will not allow a non-privileged program to use that particular supervisor call and will either fault the program or return an error depending on what the supervisor call manager has been programmed to do.
When a supervisor call instruction occurs, the program counter is advanced by two, the PSW is stored in the "Supervisor Call Old PSW Address," the supervisor call number is stored in the "Interrupt Number address", and the new PSW is loaded from the "Supervisor Call New PSW address" all of which differ from model to model.
|SVC Addresses Used (Decimal)|
|Machine||SVC Old PSW||Interrupt number||SVC New PSW|
|370 Series and z/System||320-335||136-139 ||448-463|
-  Bits 5 and 6 of byte 137 are set to 012 unless the SVC was the result of an EXECUTE instruction, then they are set to 102; the rest of the bits are cleared. Byte 139 contains the SVC number; the other bytes are zeroed.
The supervisor call routine has access to the memory and registers of the calling routine, and can use these to retrieve arguments and/or return results. The registers used differ for each operating system, e.g. OS/VS1, MVS, and VM would usually use registers 1 and 0 and sometimes 14 or 15; the same is true for the VS/9 operating system on the Univac 90/60, 90/70 and 90/80 mainframe computers, while Linux on S/390 uses registers 0 through 6 depending on the number of arguments and may use 14 or 15 in some instances. The register usage for supervisor calls is a convention established by general usage, not mandated by the hardware.
The supervisor call routine will typically exit by using the LPSW instruction from the address of the Supervisor Call Old PSW address to return to the instruction in the calling program after the SVC instruction. The method the SVC will return information may be through registers or changes in memory which the user pointed to via registers or argument lists in registers. The results and values are operating-system dependent.
Condition codes are changed to the value of the condition codes stored in the condition code bits of the PSW stored at the Supervisor Call New PSW address.
Exceptions and FaultsEdit
The Supervisor Call is a non-privileged instruction, and will not cause a program exception. The specific SVC number to use for any particular service is assigned by the operating system the program runs under, and if incorrect, the operating system may terminate the program (or transfer control to an exception routine in some cases.)
|360 Assembly Instructions||Next Instruction
|360 Assembly Language|
|360 Family||Introduction · Basic FAQ · 360 Family · 360 Architecture · Comments|
|360 Instruction Set||360 Instructions · Branch Instructions · Data Transfer Instructions · Control Flow Instructions · Arithmetic Instructions · Logic Instructions · Shift and Rotate Instructions · Other Instructions|
|Syntaxes and Assemblers||360 Assemblers· Pseudo Instructions|
|Instruction Extensions||Floating Point · High-Level Languages|