Use this system macro to change the address space control information in
the program status word (PSW). The TPF system supports 2 types of
address spaces:
- Entry control block (ECB) virtual memory (EVM), which contains all memory
that can be referenced or changed by the ECB. There is one EVM for each
ECB in the TPF system.
- System virtual memory (SVM), which contains all storage that can be used
by an I-stream.
Before using this macro, be sure you understand the effects of switching
address spaces on register 9 (the ECB pointer) and control register 1 (the ECB
segment and page table pointer). This macro can be run to set up these
registers (with a dependency on R9) or to switch the address mode without
updating the registers.
Format
- GOTO
- This parameter identifies the address space in which the TPF system is to
resume operation. There are three options:
- EVM
- The address space being switched to is the EVM. The input and
return conditions vary, dependent on the ECBINR9 parameter.
If ECBINR9=YES then R9 must contain the virtual address of the ECB for the
address space the ECB is executing in. On return, R9 contains the EVM
address of the ECB, and control register 1 is loaded with a pointer to the ECB
segment and page tables.
If ECBINR9=NO then the $SWSPC macro will issue only the SAC instruction to
switch the address space. The set-up of R9 and control register 1 would
be left to the caller. This combination of parameters (GOTO=EVM and
ECBINR9=NO) is essentially illogical, and is not recommended.
- SVM
- The address space being switched to is the SVM. The input and
return conditions vary, dependent on the ECBINR9 parameter.
If ECBINR9=YES then R9 must contain the virtual address of the ECB for the
address space the ECB is executing in. On return, R9 contains the SVM
address of the ECB.
If ECBINR9=NO then the $SWSPC macro will issue only the SAC instruction to
switch the address space. If the caller plans to access the ECB or
issue a $SWSPC to the EVM, then R9 would need to be set up by the user.
- Rx
- Rx is a register that has been previously set by the OLD option of the
$SWSPC macro. The contents of Rx cannot be modified by the user.
When GOTO=Rx is specified, R9 must contain the address of the ECB for the
address space the ECB is executing in, unless ECBINR9=NO is coded.
- Note:
- There can be no loss of control between the invocation of the $SWSPC macro
that saved the OLD register and the invocation of the $SWSPC macro with the
GOTO parameter, nor should R9 be changed.
- OLD=Ry
- This is an optional parameter. If specified, the TPF system saves
the information necessary to return to the addressing mode in effect at the
time the $SWSPC macro is issued.
This parameter can be used in a subroutine to allow entry in either mode,
with return to the correct addressing mode.
- Ry
- Specify the register that will contain the return information.
- ECBINR9
- This is an optional parameter. The default is ECBINR9=YES.
This parameter indicates if the macro call should use and update R9, which
implies R9 is a valid ECB pointer.
- YES
- R9 will be referenced as the ECB pointer and updated to point to the ECB
in the proper addressing mode. If the switch is to the EVM, then
control register 1 will be loaded with the segment and page tables.
- NO
- R9 will neither be referenced nor updated. Control register 1 will
not be updated when switching to the EVM.
Entry Requirements
- Supervisor state, protection key of zero, 31-bit addressing mode.
- See individual parameters for R9 requirements.
Return Conditions
- Control is returned to the next sequential instruction (NSI).
- Registers are unchanged except for R9 and control register 1 as noted
previously, and, optionally, the register specified by the OLD
parameter.
Programming Considerations
- This macro can be run on any I-stream.
- The results of a $SWSPC GOTO are totally unpredictable if there has been a
loss of control between the $SWSPC macro that saved the OLD register and the
$SWSPC macro with the GOTO parameter.
- Use of this macro can cause a performance impact.
- The usage of the ECBINR9=NO parameter is not recommended because it leaves
the responsibility of maintaining R9 and control register 1 to the
caller.
- If $SWSPC GOTO=EVM,ECBINR9=YES is issued, the ECB addressed by R9 must be
operating on the I-stream that issued the $SWSPC macro.
- This macro can be run in either SVM or EVM.
- The program using this macro must be in supervisor state.
- System error dump can occur when servicing a $SWSPC request.
See Messages (System Error and Offline) for more
information about system errors.
Examples
- This example will switch to the EVM, and update R9 to contain the EVA of
the ECB, and control register 1 will point to the segment and page tables for
that ECB address space.
- Note:
- R9 must contain the valid ECB address for whatever address space the macro
was invoked in upon entry.
$SWSPC GOTO=EVM
- This example will switch to the SVM, without updating R9.
- Note:
- There is no dependency on R9 for this invocation.
$SWSPC GOTO=SVM,ECBINR9=NO
- This example will switch to the SVM, then switch back to the address space
the first $SWSPC switched from. R9 will contain the SVA of the ECB
after the first call, and either the EVA or SVA after the second call,
dependent on the address space before the first call.
- Note:
- R9 must contain the valid ECB address for whatever address space the macro
was invoked in upon entry.
$SWSPC GOTO=SVM,OLD=R3
. R9 and R3 must remain unaltered
. during this process ...
.
$SWSPC GOTO=R3