Document revision date: 30 March 2001

## VAX MACRO and Instruction Set Reference Manual

Previous | Contents | Index

## EO$ADJUST_INPUT

> Adjust Input Length

### Format

> opcode pattern len

### Pattern Operators

47 | EO$ADJUST_INPUT | Adjust Input Length

### Description

> The EO$ADJUST_INPUT pattern operator is followed by an unsigned byte integer length in the range 1 to 31. If the source string has more digits than this length, the excess leading digits are read and discarded. If any discarded digits are nonzero, the overflow is set, significance is set, and zero is cleared. If the source string has fewer digits than this length, a counter is set of the number of leading zeros to supply. This counter is stored as a negative number in R0<31:16>.

Note

If the length is not in the range 1 to 31, the destination string, condition codes, and R0 to R5 are UNPREDICTABLE.

## EO$BLANK_ZERO

> Blank Backwards when Zero

### Format

> opcode pattern len

### Pattern Operators

45 | EO$BLANK_ZERO | Blank Backwards when Zero

### Description

> The EO$BLANK_ZERO pattern operator is followed by an unsigned byte integer length. If the value of the source string is zero, then the contents of the fill register are stored into the last length bytes of the destination string.

Notes

1. The length must be nonzero and within the destination string already produced. If it is not, the contents of the destination string and the memory preceding it are UNPREDICTABLE.
2. Use this pattern operator to blank out any characters stored in the destination under a forced significance such as a sign or the digits following the radix point.

## EO$END

> End Edit

### Format

> opcode pattern

### Pattern Operators

00 | EO$END | End Edit

### Description

> The EO$END pattern operator terminates the edit operation.

Notes

1. If there are still input digits, a reserved operand abort is taken.
2. If the source value is -0, the N condition code is cleared.

## EO$END_FLOAT

> End Floating Sign

### Format

> opcode pattern

### Pattern Operators

01 | EO$END_FLOAT | End Floating Sign

### Description

> The EO$END_FLOAT pattern operator terminates a floating sign operation. If the floating sign has not yet been placed in the destination (if significance is not set), the contents of the sign register are stored in the destination, and significance is set.

Note

Use this pattern operator after a sequence of one or more EO$FLOAT pattern operators that start with significance clear. The EO$FLOAT sequence can include intermixed EO$INSERTs and EO$FILLs.

## EO$FILL

> Store Fill

### Format

> opcode pattern r

### Pattern Operators

8x | EO$FILL | Store Fill

### Description

> The rightmost nibble of the pattern operator is the repeat count. The EO$FILL pattern operator places the contents of the fill register into the destination the number of times specified by the repeat count.

Note

Use this pattern operator for fill (blank) insertion.

## EO$FLOAT

> Float Sign

### Format

> opcode pattern r

### Pattern Operators

Ax | EO$FLOAT | Float Sign

### Description

> The EO$FLOAT pattern operator moves digits, floating the sign across insignificant digits. The rightmost nibble of the pattern operator is the repeat count. For the number of times specified in the repeat count, the following algorithm is executed:

> The next digit from the source is examined. If it is nonzero and significance is not yet set, then the contents of the sign register are stored in the destination, significance is set, and zero is cleared. If the digit is significant, it is stored in the destination; otherwise, the contents of the fill register are stored in the destination.

Notes

1. If r is greater than the number of digits remaining in the source string, a reserved operand abort is taken.
2. Use this pattern operator to move digits with a floating arithmetic sign. The sign must already be set up as for EO$STORE_SIGN. A sequence of one or more EO$FLOATs can include intermixed EO$INSERTs and EO$FILLs. Significance must be clear before the first pattern operator of the sequence. The sequence must be terminated by one EO$END_FLOAT.
3. Use this pattern operator to move digits with a floating currency sign. The sign must already be set up with an EO$LOAD_SIGN. A sequence of one or more EO$FLOATs can include intermixed EO$INSERTs and EO$FILLs. Significance must be clear before the first pattern operator of the sequence. The sequence must be terminated by one EO$END_FLOAT.

## EO$INSERT

> Insert Character

### Format

> opcode pattern ch

### Pattern Operators

44 | EO$INSERT | Insert Character

### Description

> The EO$INSERT pattern operator is followed by a character. If significance is set, the character is placed into the destination. If significance is not set, the contents of the fill register are placed into the destination.

Note

Use this pattern operator for inserts that can be made blank (for example, comma (,)) and fixed inserts (for example, slash (/)). Fixed inserts require that significance be set (by EO$SET_SIGNIF or EO$END_FLOAT).

## EO$LOAD_

> Load Register

### Format

> opcode pattern ch

### Pattern Operators

40 | EO$LOAD_FILL | Load Fill Register
41 | EO$LOAD_SIGN | Load Sign Register
42 | EO$LOAD_PLUS | Load Sign Register If Plus
43 | EO$LOAD_MINUS | Load Sign Register If Minus

### Description

> The pattern operator is followed by a character. For EO$LOAD_FILL, this character is placed into the fill register. For EO$LOAD_SIGN, this character is placed into the sign register. For EO$LOAD_PLUS, this character is placed into the sign register if the source string has a positive sign. For EO$LOAD_MINUS, this character is placed into the sign register if the source string has a negative sign.

Notes

1. Use EO$LOAD_FILL to set up check protection (* instead of space).
2. Use EO$LOAD_SIGN to set up a floating currency sign.
3. Use EO$LOAD_PLUS to set up a nonblank plus sign.
4. Use EO$LOAD_MINUS to set up a nonminus minus sign (such as CR, DB, or the PL/I +).

## EO$MOVE

> Move Digits

### Format

> opcode pattern r

### Pattern Operators

9x | EO$MOVE | Move Digits

### Description

> The EO$MOVE pattern operator moves digits, filling for insignificant digits. The rightmost nibble of the pattern operator is the repeat count. For the number of times specified in the repeat count, the following algorithm is executed:

> The next digit is moved from the source to the destination. If the digit is nonzero, significance is set and zero is cleared. If the digit is not significant (that is, a leading zero), it is replaced by the contents of the fill register in the destination.

Notes

1. If r is greater than the number of digits remaining in the source string, a reserved operand abort is taken.
2. Use this pattern operator to move digits without a floating sign. If leading-zero suppression is desired, significance must be clear. If leading zeros should be explicit, significance must be set. A string of EO$MOVEs intermixed with EO$INSERTs and EO$FILLs will handle suppression correctly.
3. If check protection (*) is desired, EO$LOAD_FILL must precede the EO$MOVE.

## EO$REPLACE_SIGN

> Replace Sign when Zero

### Format

> opcode pattern len

### Pattern Operators

46 | EO$REPLACE_SIGN | Replace Sign when Zero

### Description

> The EO$REPLACE_SIGN pattern operator is followed by an unsigned byte integer length. If the value of the source string is zero (that is, if Z is set), the contents of the fill register are stored in the byte of the destination string that is len bytes before the current position.

Notes

1. The length must be nonzero and within the destination string already produced. If it is not, the contents of the destination string and the memory preceding it are UNPREDICTABLE.
2. You can use this pattern operator to correct a stored sign (EO$END_FLOAT or EO$STORE_SIGN) if a minus was stored and the source value turned out to be zero.

## EO$_SIGNIF

> Significance

### Format

> opcode pattern

### Pattern Operators

02 | EO$CLEAR_SIGNIF | Clear Significance
03 | EO$SET_SIGNIF | Set Significance

### Description

> The significance indicator is set or cleared. This controls the treatment of leading zeros (leading zeros are zero digits for which the significance indicator is clear).

Notes

1. Use EO$CLEAR_SIGNIF to initialize leading-zero suppression (EO$MOVE) or floating sign (EO$FLOAT) following a fixed insert (EO$INSERT with significance set).
2. Use EO$SET_SIGNIF to avoid leading-zero suppression (before EO$MOVE) or to force a fixed insert (before EO$INSERT).

## EO$STORE_SIGN

> Store Sign

### Format

> opcode pattern

### Pattern Operators

04 | EO$STORE_SIGN | Store Sign

### Description

> The EO$STORE_SIGN pattern operator places contents of the sign register into the destination.

Note

Use this pattern operator for any nonfloating arithmetic sign. Precede it with either a EO$LOAD_PLUS or EO$LOAD_MINUS, or both, if the default sign convention is not desired.

### 9.2.13 Other VAX Instructions

The following table lists other VAX instructions:

| Description and Opcode | Number of Instructions
--- | --- | ---
1. | Probe {Read, Write} Accessibility PROBE{R,W} mode.rb, len.rw, base.ab | 2
2. | Change Mode CHM{K,E,S,U} param.rw, {-(ySP).w*} Where y=MINU(x, PSL<current_mode>) | 4
3. | Return from Exception or Interrupt REI {(SP)+.r*} | 1
4. | Load Process Context LDPCTX {PCB.r*, -(KSP).w*} | 1
5. | Save Process Context SVPCTX {(SP)+.r*, PCB.w*} | 1
6. | Move to Process Register MTPR src.rl, procreg.rl | 1
7. | Move from Processor Register MFPR procreg.rl, dst.wl | 1
8. | Bugcheck with {word, longword} message identifier BUG{W,L} message.bx | 2

## PROBEx

> Probe Accessibility

### Format

> opcode mode.rb, len.rw, base.ab

### Condition Codes

N|| <--- 0; |
Z|| <--- if {both accessible} then 0 else 1; |
V|| <--- 0; |
C|| <--- C; |

#### Exceptions

> translation not valid

### Opcodes

0C | PROBER | Probe Read Accessibility
0D | PROBEW | Probe Write Accessibility

### Description

> The PROBE instruction checks the read or write accessibility of the first and last byte specified by the base address and the zero-extended length. Note that the bytes in between are not checked. System software must check all pages if they will be accessed between the two end bytes.

> The protection is checked against the larger (and therefore less privileged) of the modes specified in bits <1:0> of the mode operand and the previous mode field of the processor status longword (PSL). Note that probing with a mode operand of zero is equivalent to probing the mode specified in the previous-mode field of the PSL.

### Example

    MOVL    4(AP),R0        ; Copy the address of first arg so
                            ;   that it cannot be changed
    PROBER  #0,#4,(R0)      ; Verify that the longword pointed to
                            ;   by the first arg could be read by
                            ;   the previous access mode
                            ; Note that the arg list itself must
                            ;   already have been probed
    BEQL    violation       ; Branch if either byte gives an
                            ;   access violation
    MOVQ    8(AP),R0        ; Copy length and address of buffer
                            ;   arg so that they cannot change
    PROBER  #0,R0,(R1)      ; Verify that the buffer described by
                            ;   the 2nd and 3rd args could be
                            ;   written by the previous access
                            ;   mode
                            ; Note that the arg list must already
                            ;   have been probed and that the 2nd
                            ;   arg must be known to be less than
                            ;   512
    BEQL    violation       ; Branch if either byte gives an
                            ;   access violation

> Note that for the PROBE instruction, probing an address returns only the accessibility of the pages and has no effect on their residency. However, probing a process address may cause a page fault in the system address space on the per-process page tables.

Notes

1. If the valid bit of the examined page table entry is set, it is UNPREDICTABLE whether the modify bit of the examined page table entry is set by a PROBER. If the valid bit is clear, the modify bit is not changed.
2. Except for note 1, above, the valid bit of the page table entry, PTE<31>, mapping the probed address is ignored.
3. A length violation gives a status of "not-accessible."
4. On the probe of a process virtual address, if the valid bit of the system page table entry is zero, a Translation Not Valid Fault occurs. This allows for the demand paging of the process page tables.
5. On the probe of a process virtual address, if the protection field of the system page table entry indicates No Access, a status of "not-accessible" is given. Thus, a single No Access page table entry in the system map is equivalent to 128 No Access page table entries in the process map.

## CHM

> Change Mode

### Format

> opcode code.rw

### Condition Codes

N|| <--- 0; |
Z|| <--- 0; |
V|| <--- 0; |
C|| <--- 0; |

#### Exceptions

> halt

### Opcodes

BC | CHMK | Change Mode to Kernel
BD | CHME | Change Mode to Executive
BE | CHMS | Change Mode to Supervisor
BF | CHMU | Change Mode to User

### Description

> Change mode instructions allow processes to change their access mode in a controlled manner. The instruction increases privilege only (decreases the access mode).

> A change in mode also results in a change of stack pointers; the old pointer is saved, and the new pointer is loaded. The processor status longword (PSL), program counter (PC), and code passed by the instruction are pushed onto the stack of the new mode. The saved PC addresses the instruction following the CHMx instruction. The code is sign extended. After execution, the appearance of the new stack is as follows:

The destination mode selected by the opcode is used to obtain a location from the system control block (SCB). This location addresses the CHMx dispatcher for the specified mode. If the vector<1:0> code is NEQU 0, then the operation is UNDEFINED.

Notes

1. As usual for faults, any Access Violation or Translation Not Valid fault saves the PC and the PSL, and leaves the stack pointer (SP) as it was at the beginning of the instruction except for any pushes onto the kernel stack. Note that addresses just off the top of the target stack may have been written.
2. The noninterrupt stack pointers may be fetched and stored either in privileged registers or in their allocated slots in the process control block (PCB). Only LDPCTX and SVPCTX always fetch and store in the PCB. MFPR and MTPR always fetch and store the pointers whether in registers or the PCB.
3. By software convention, negative codes are reserved to CSS and customers.

###

#### Examples

#1
    CHMK   #7           ; Request the kernel mode service
                        ;   specified by code 7

    CHME   #4           ; Request the executive mode service
                        ;   specified by code 4

    CHMS   #-2          ; Request the supervisor mode service
                        ;   specified by customer code -2

Previous | Next | Contents | Index

| privacy and legal statement |
4515PRO_029.HTML