CMS HANDLING OF PSW KEYS The purpose of the CMS Nucleus protection sche.e is to protect the CMS nucleus fro. inadvertent destruction by a user program. Without it, it
would be possible, for example, for a FORTRAN user who accidentally
assigns an incorrectly subscripted array element to destroy nucleus
code, wipe out a crucial table or constant area, or even destroy an
entire disk by destroying the contents of the master file directory.
In general, user programs and disk-resident CMS commands are executed
with a PSW key of X'E', while nucleus code is executed with a PSi key of 1'0'. There are, however, some exceptions to this rule. Certain
disk-resident CMS commands run with a PSW key of X'O', since they have a
constant need to modify nucleus pointers and storage. The nucleus
routines called by the GET, PUT, READ, and WRITE macros run with a user PSi key of X'E', to increase efficiency.
Two macros are available to any routine that wishes to change its PSi key for some special purpose. These are the DMSKEY macro and the DKSEXS .acro.
The DMSKEY macro .ay be used to change the PSi key to the user value
or the nucleus value. The DMSKEY NUCLEUS option causes the current PSi key to be placed in a stack, and a value of 0 to be placed in the PSW key. The DMSKEY USER option causes the current PSi key to be placed in
a stack, and a value of X'E' to be placed in the PSi key. The D5SKEY RESET option causes the top value in the DMSKEY stack to be removed and
re-inserted into the PSi. It is a requirement of the CMS system that when a routine terminates,
the DKSKEY stack must be empty. This .eans that a routine should
execute a DMSKEY RESET option for each DKSKEY NUCLEUS option and each DMSKEY USER option executed by the routine.
The DMSKEY key stack has a current maxi.u. depth of seven for each
routine. In this context, a "routine" is anything invoked by an SVC call.
The DMSKEY LASTUSER option causes the current PSi key to be placed in
the stack, and a new key inserted into the PSi, determined as follows:
the SVC system save area stack is searched in reverse order (top to
bottom) for the first save area corresponding to a user routine. The PSi key that was in effect in that routine is then taken for the new PSi key. (If no user routine is found in the search, then LISTUSER has the
same effect as USER.) This option is used ty as macro simulation
routines when they wish to enter a user-supplied exit routine; the exit
routine is entered with the PSW key of the last user routine on the SVC system save area stack.
The NOSTACK option of DMSKEY may be used with NUCLEUS, USER, or LASTUSER (as in, for example, DMSKEY NUCLEUS,NOSTACK) if the current key
is not to be placed on the DMSKEY stack. If this option is used, then
no corresponding DMSKEY RESET should be issued.
The DMSEXS ("execute in system mode") macro instruction is useful in
situations where a routine is being executed with a user protect key.
but wishes to execute a single instruction that, for example, sets a bit
in the NUCON area. The single instruction may be specified as the
argument to the DMSEXS macro, and that instruction will be executed with
a system PSi key. CMS Introduction 2-25
Whenever possible, CMS commands are executed with a user protect key.
This protects the CMS Nucleus in cases where there is an error in the
system command that would otherwise destroy the nucleus. If the command
must execute a single instruction or small group of instructions that modify nucleus storage, then the DMSKEY or DMSEXS macros are used, so
that the system PSW key will be used for as short a period of time as is
possible. CMS SVC HANDLING DMSITS (INTSVC) is the CMS system SVC handling routine.
operation of DMSITS is as follows:
The general
1. The SVC new PSi (low storage location X'60') contains, in the
address field, the address of DMSITS1. The DMSITS module will be
entered whenever a supervisor call is executed.
2. DMSITS allocates a system and user save area. The used as a register save area (or work area)
routine.
3. The called routine is called (via a LPSW or EALR).
user save area
by the called 4. Upon return from the called routine, the save areas are released.
5. Control is returned to the caller (the routine that originally made
the SVC call). SVC TYPES AND LINKAGE CONVENTIONS SVC conventions are important to any discussion of CMS because the
system is driven by SVCs (supervisor calls). SVCs 202 and 203 are the most common CMS SVCs. SVC 202 is used
calling routines
modules).
both for
written
calling nucleus-resident routines, and for
as commands (for example, disk resident
A typical coding sequence for an SVC 202 call is the following:
LA Rl,PLIST SVC 202 DC AL4(ERRADD) Whenever SVC 202 is called, register 1 must point to a parameter list (PLIST). The for.at of this parameter list depends upon the actual
routine or co.mand being called, but the SVC handler will examine the
first eight bytes of this parameter list to find the name of the routine
or command being called.
The "DC AL4(address)" instruction following the SVC 202 is optional,
and may be omitted if the programmer does not expect any errors to occur
in the routine or command being called. If included, an error return is made to the address specified in the DC. DMSITS determines whether this DC was inserted by examining the byte following the SVC call inlinea A nonzero byte indicates an instruction, a zero value indicates that "DC AL4(address)" follows.
2-26 IBM VM/370 System Logic and program Determination--Volume 2
Previous Page Next Page