Modifying a table or constant area Losing files by modifying a CMS file directory
In general, user programs and disk-resident CMS commands run with a PSi key of X'E', while nucleus code runs with PSi key of X'O'. There are, however, some exceptions to
disk-resident CMS commands run with a PSi key of
to modify nucleus pointers and storage. On the
routines called by the GET, PUT, READ and WRITE PSi key of X'E', to increase efficiency.
this rule. Certain X'O', because they need
other hand, the nucleus
macros run with a user
Two macros, DMSKEY and DMSEXS, are available for changing the PSi key. The DMSKEY macro changes the PSi key to the user value or the
nucleus value. DMSKEY NUCLEUS causes the current PSi key to be placed
in a stack, and a value of 0 to be placed in the PSi key. DMSKEY USER causes the current PSi key to be placed in a stack, and a value of X'E' to be placed in the PSi key. DMSKEY RESET causes the top value in the DMSKEY stack to be removed and re-inserted into the PSW. It is a CMS requirement when a routine terminates, that the DMSKEY stack must be empty. This means that a routine should execute a DMSKEY RESET macro instruction for each DMSKEY NUCLEUS macro instruction and
each DMSKEY USER macro instruction executed by the routine.
The DMSKEY key stack has a maximum depth of seven for each routine.
In this context, a "routine" is anything invoked by an SVC call. The DMSEXS ("execute in system mode") macro instruction is useful in
situations where a routine is running with a user PSW key, but wishes to
execute a single instruction with the nucleus PSi key. The single
instruction may be specified as the argument to the DMSEXS macro, and
that instruction is executed with a system PSi key. CP HANDLING FOR SAVED SYSTEMS The explanation of saved system nucleus protection depends on the VSK, RSK, VPK and RPK: 1. Virtual Storage Key (VSK) - This is the storage key assigned by the
virtual machine using the virtual SSK instruction.
2. Real Storage Key (RSK) - This is the actual storage key assigned
by CP to the 2K page.
3. Virtual PSi Key (VPK) - This is the PSi storage key assigned by the
virtual machine, by means of an instruction such as LPSW (Load PSi). 4. Real PSi Key
which is in
running. (RPK) - This is the PSW storage key assigned by CP, the real hardware PSi when the virtual machine is When there are no shared segments
storage protection works as it does on
pages, and RPK=VPK for the PSi. in the virtual machine, then
a real machine. RSK=VSK for all
However, when there is a shared segment (as in the case of segment 1
of CMS in the saved system), it is necessary for CP to protect the
shared segment. For non-CMS shared systems, it does this by,
essentially, ignoring the values of the VSKs and VPK, and assigning the 2-108 IBM VM/370 System Logic and Program Determination--Volume 2
real values as follows: RSK=O for each page of the shared segment, RSK=F for all other pages, and RPK=F, always, for the real PSi. The SSK instruction is ignored, except to save the key value in a table in case
the virtual machine later does an ISK to get it back.
For the CMS saved system, the RSKs and RPK are initialized as before, but resetting the virtual keys has the following effects:
If the virtual machine uses an SSK instruction to reset a VSK, CP does the following: If the new VSK is nonzero, CP resets the RSK to
the value of the VSK; if the new VSK is zero, CP resets RSK to F. If the virtual machine uses a LPSi (or other) instruction to reset
the VPK, CP does the following: If the new VPK is zero, CP resets the RPK to the value of the VPK; if the new VPK is zero, CP resets RPK to
F. If the VPK=O and
differently. In
program to store
storage key. But
unless the RPK of
the RPK=F, storage protection may be handled
a real machine, a PSi key of 0 would allow the
into any storage location, no what the
under CP, the program gets a protection violation,
the page happens to be F.
Because of this, there is extra code in the CP program check handling
routine. Whenever a protection violation occurs, CP checks to see if
the following conditions hold:
The virtual machine running is the saved CMS system, running
with a shared segment. The VPK = O. The virtual machine is operating as though its PSi key is O. The RSK of the page into which the store was attempted is
nonzero, and different from the RPK. If anyone of these three conditions fails to hold, then the
protection viclation is reflected back to the virtual machine.
If all three of these conditions hold, then the RPK (the real
protection key in the real PSW) is reset to the RSK of the page into
which the store was attempted. Q! In CMS, this works as
storage in protect key F (RSK = VSK =
key E (RSK = VSK = E).
follows: CMS keeps its system
F), and user storage in protect When the CMS supervisor is running, it runs in PSi key 0 (VPK = 0, RPK = F), so that CMS gets a protection violation the first time it
tries to store into user storage (VSK = RSK = E). At that point, CP changes the RPK to E, and lets the virtual machine re-execute the
instruction which caused the protection violation. There is not another
protection violation until the supervisor goes back to storing into
system-protected storage. Q! £MS: There are several coding restrictions which must
be imposed on CMS if it is to run as a saved system.
The first and most obvious one is that CftS may never modify segment
1, the shared segment, which runs with a RSK of C, although the VSK = F.
A less obvious,
never modify with
but just as important, restriction, is that eMS may a single machine instruction (except MVeL) a section CMS Method of Operation and Program Organization 2-109
Previous Page Next Page