I The DMSKEY Macro
Modifying nucleus code
Modifying a table or constant area
Losing files by modifying a CMS 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 PSW key of X'D'.
There are, however, some exceptions to this rule. Certain disk-resident CMS commands run with a PSW key of X'D', 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 PSW key of X'E', to increase efficien­
cy.
Two macros, DMSKEY and DMSEXS, are available to any routine that wishes to
change its PSW key for some special purpose.
The DMSKEY macro may be used to change the PSW key to the user value or the
nucleus value. The format of the DMSKEY macro is:
[label]
where: NUCLEUS USER LASTUSER NOSTACK RESET
DMSKEY [NUCLEUS [,NOSTACK] I USER [, NOSTACK] I LASTUSER[,NOSTACK] I RESET}
causes the nucleus storage protection key to be placed in the PSW, and the old contents of the second byte of the PSW are
saved in a stack. This option allows the program to store into
system storage, which is ordinarily protected.
causes the user storage protection key to be placed in the PSW, and the old contents of the second byte of the PSW are
saved in a stack. This option prevents the program from inad­
vertently modifying nucleus storage, which is protected.
The SVC handler traces back through its system save areas for
the active user routine closest to the top of the stack. The
storage key in effect for that routine is placed in the PSW. The old contents of the second byte of the PSW are saved in a
stack. This option should be used only by system routines that
should enter a user exit routine. (aS macro simulation rou­
tines use this option when they want 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.)
This option may be used with any of the above options to pre­
vent the system from saving the second byte of the current PSW in a stack. If this is done, then no DMSKEY RESET need be issued later.
The second byte of the PSW is changed to the value at the top
of the DMSKEY stack, and removed from the stack. Thus, the
effect of the last DMSKEY NUCLEUS, DMSKEY USER, or DMSKEY LASTUSER request is reversed. However, if the
Functional Information 333
I The DMSEXS Macro CMS SVC Handling NOST ACK option was specified on the DMSKEY macro, the RESET option should not be used. A DMSKEY RESET mac­
ro must be executed for each DMSKEY NUCLEUS, DMSKEY USER, or DMSKEY LASTUSER macro that was
executed and that did not specify the NOST ACK option.
Failure to observe this rule results in program abnormal termi­
nation. CMS requires that the DMSKEY stack be empty when
a routine terminates.
Note: The DMSKEY key stack has a current 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 allows a routine executed with a
user PSW key, to execute a single instruction with a nucleus PSW key. The single
instruction may be specified as the argument to the DMSEXS macro, and that
instruction is executed with a nucleus PSW key. This macro can be used instead of
two DMSKEY macros. The format of the DMSEXS macro is: I [label] I DMSEXS lop-code, operands
The op-code and the operands of the Basic Assembler Language instruction to be
executed must be given as arguments to the DMSEXS macro.
For example, execution of the sequence, USING NUCON,O DMSEXS OI,OSSFLAGS,COMPSWT causes the 01 instruction to be executed with a zero protect key in the PSW. This
sequence turns on the COMPSWT flag in the nucleus. It is reset with DMSEXS NI,OSSFLAGS,255-COMPSWT The instruction to be executed may be an EX instruction.
Note: Programs that modify or manipulate bits in CMS control blocks, however,
may hinder the operation of CMS, causing it to function ineffectively.
Register 1 cannot be used in any way in the instruction being executed.
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 is used for as
short a period of time as is possible. DMSITS (INTSVC) is the CMS system SVC handling routine. The general opera­
tion of DMSITS is as follows:
1. The SVC new PSW (low storage location X'60') contains, in the address field,
the address of DMSITS 1. The DMSITS module is entered whenever a supervi­
sor call is executed.
334 VM/SP System Programmer's Guide
Previous Page Next Page