Jump to content

360 Assembly/Privileged Instructions

From Wikibooks, open books for an open world

Privileged Instructions are programming instructions that need to be restrited to the operating system in order to protect system resources, system integrity, or system security. These include, but are not limited to:

  • I/O instructions. To make sure two programs do not try to write to a printer, or edit a database record, or other errors that could corrupt files, a program issues I/O requests to the operating system, and it handles these operations.
  • Load PSW. The PSW (program status word) contains the status about the computer and the currently executing job.
  • Insert storage key, set storage key. Change or read any memory.
  • Page table functions. Contaminate other jobs, lose pages swapped out to disc, corrupt memory and/or other jobs.
  • Diagnose. Used by operating systems to issue requests to the hypervisor.

Programs that do not have privileges are known as "problem" programs. Without protecting the PSW, page tables, or I/O devices, problem programs could:

  • Grant themselves privileges
  • Allow themselves to reset their storage key, allowing them to change any memory
  • Rewrite, contaminate or destroy page tables, losing or corrupting other jobs
  • Change the system date and time
  • Halt the machine

Anyone having heard about or seen the effects of malware or ransomware can understand the kind of damage a rogue privileged program do to a computer. Unless you have your own machine (like using the Hercules emulator on Linux, Mac, Raspberry Pi, or Windows, and don't care if something in the virtual environment is damaged), or you know exactly what you're doing, it's probably best to restrict privileged functions to the operating system than allow just anyone to use them willy-nilly. However, because sometimes problem programs in a production environment legitimately have a need to execute privileged instructions or access operating system tables or memory belonging to another process, many installations will install a "private" SVC routine ("private" in that is only set up on that machine, and is not part of the "stock" operating system supplied by the developer) and that SVC either grants privileged state to that process or changes an operating system table to grant the program additional privilege(s). Often the same SVC can be used to reset the request, revoking the privilege.

These are the privileged instructions: Legend:

  •         Available on all models unless indicated by (360 only) or (360 & 370 only)
  •         Available on the 370, 390 and z/System
  •         Available on the 390 and z/System
  •         Available only on the z/System

Using any of these in a problem (unprivileged) program will cause a protection exception. Using one of these instructions in a privileged program on the wrong class of machine will cause an operation exception.

Opcode
(Hex)

Mnemonic

Description
08 SSK Set Storage Key (360 only)
09 ISK Insert Storage Key (360 only)
82 LPSW Load Program Status Word
84 WRD Write Direct (360 only)
85 RDD Read Direct (360 Only)
9C SIO Start I/O (360 Only)
9D TIO Test I/O (360 Only)
9D01 CLRIO CLeaR I/O (370 only)
9E HIO Halt I/O (360 only}
9F TCH Test CHannel (360 & 370 only)
B200 CONCS Connect Channel Set
B201 DISCS DISconnect Channel Set
B202 STIDP Store CPU ID
B204 SCK Set Clock
B206 SCKC Set Clock Comparator
B207 STCKC Store Clock Comparator
B208 SPT Set CPU Timer
B209 STPT Store CPU Timer
B20A SPKA Set PSW Key From Address
B20B IPK Insert PSW Key
B20D PTLB Purge TLB
B210 SPX Set Prefix
B211 STPX Store Prefix
B212 STAP Store CPU Address
B213 RRB Reset Reference Bit
B221 IPTE Invalidate Page Table Entry
B223 IVSK Insert Virtual Storage Key
B224 IAC Insert Address Space Control
B225 SSAR Set Secondary ASN
B226 EPAR Extract Primary ASN
B227 ESAR Extract Secondary ASN
B228 PT Program Transfer
B229 ISKE Insert Storage Key Extended
B22A RRBE Reset Storage Key Extended
B22B SSKE Set Storage Key Extended
B22C TB Test Block
B22E PGIN Page In
B22F PGOUT Page Out
B230 CSCH Clear SubCHannel
B231 HSCH Halt SubCHannel
B232 MSCH Modify SubCHannel
B233 SSCH Start SubCHannel
B234 STSCH Store SubCHannel
B235 TSCH Test SubCHannel
B236 TPI Test Pending Interruption
B237 SAL Set Address Limit
B238 RSCH Resume SubCHannel
B239 STCRW Store Channel Report Word
B23A STCPS Store Channel Path Status
B23B RCHP Reset Channel Path
B23C SCHM Set Channel Monitor
B246 STURA STore Using Real Address
B248 PALB Purge ALB
B24B LURA Load Using Real Address
B254 MVPG Move Page
B277 RP Resume Program
B2B1 STFL Store Facility List
B2B2 LPSWE Load PSW Extended
B6 STCTL Store ConTroL
B7 LCTL Load ConTroL
B905 LURAG Load Using Real Address (64 bit)
B925 STURG Store Using Real Address
B928 PCKMO Perform Cryptographic Key Mgmt Operations
B98E IDTE Invalidate DAT Table Entry
B98F CRDTE Compare and Replace DAT Table Entry
B99A EPAIR Extract Primary ASN and Instance
B99B ESAIR Extract Secondary ASN and Instance
B99D ESEA Extract and Set Extended Authority
B99E PTI Program Transfer with Instance
B99F SSAIR Set Secondary ASN and Instance
B9A1 TPEI Test Pending External Interruption
B9A2 PTF Perform Topology Function
B9AA LPTEA Load Page Table Entry Address
B9AE RRBM Reset Reference Bits Multiple
B9AF PFMF Perform Frame Management Function
E500 LASP Load Address Space Parameters
E501 TPROT Test PROTection
E502 STRAG STore Real Address Grande
EB0F TRACG TRACe Grande
EB25 STCTG STore ConTrol (64)
EB2F LCTLG Load Control (64)
360 Assembly Language
360 Family Introduction · Basic FAQ · 360 Family · 360 Architecture
360 Instruction Set 360 Instructions · Branch Instructions · Data Transfer Instructions · Control Flow Instructions · Arithmetic Instructions · Logic Instructions · Shift and Rotate Instructions · Priveleged Instructions · Other Instructions
Syntaxes and Assemblers 360 Assemblers· Pseudo Instructions
Instruction Extensions Floating Point · High-Level Languages