Differences

This shows you the differences between two versions of the page.

Link to this comparison view

instructions:ret [2011/07/20 13:09] (current)
scott created
Line 1: Line 1:
 +===== Return (RET)/OP=63 =====
 +
 +==== Format ====
 +
 +^  OP  ^  AF  ^
 +
 +''OP = 63''
 +
 +**AF** Unused and reserved.
 +
 +==== Function ====
 +
 +RET is a companion instruction to the [[instructions:hcl|hyper call]], [[instructions:ntr|enter]]
 +and [[instructions:ven|virtual enter]] instructions and the [[procedures:hcl_procedure|Hardware Call procedure]]
 +It reverses the action of the calling instruction or
 +procedure by loading machine state from the current stack, restoring
 +the user environment, and executing an unconditional branch to the
 +location specified in the stack frame as the next program instruction.
 +
 +The value of **IX3** + 14 represents the address, relative to base 0, of
 +the 2-digit stack frame indicator. The information in this field
 +indicates the type of calling procedure that stored the stack frame
 +and the type of return to be executed.
 +
 +^  Information  ^  Indicator  ^
 +| Virtual Enter/Exit  |  FF  |
 +| Hyper Call/Return  |  FE  |
 +| Hardware Call/Return  |  FD  |
 +| Enter/Exit  |  00 to 07 or\\  10 to 17  |
 +
 +All other stack frame indicator values are invalid and cause an invalid
 +instruction fault (IEX=37).
 +
 +The parameter values stored in the stack are unchanged by this
 +instruction and are not copied into any other area of memory.
 +
 +==== Variants ====
 +
 +The variants are described as follows:
 +
 +=== Virtual Enter/Exit ===
 +
 +The value of IX3 - 14 represents the address, relative to
 +base 0, of the virtual enter stack frame. The information in the
 +virtual enter stack frame is used to replace the respective
 +state in the machine and is stored in the following sequence:
 +
 +^       ^  Information  ^  Digits  ^
 +|  New TOS => | Measurement Register (User Part)  |  00-05  |
 +|             | Comparison and Overflow Flags  |  06-07  |
 +|             | Active Environment Number      |  08-13  |
 +|  Old IX3 => | Next Instruction Address       |  14-19  |
 +|             | Saved IX3 Value                |  20-27  |
 +|             | Stack Frame Indicator (FF)     |  28-29  |
 +|             | Stack Parameters (0 to 9999 bytes)  |    30-xxxx  |
 +|  Old TOS => |    |    |
 +
 +^ Note: The lowest memory address is 00.  ^
 +
 +
 +RET replaces the address in memory address 40, relative to base 0,
 +with the value of IX3 minus 14, relative to base 0. After the state
 +is loaded, RET replaces the contents of IX3 with the value of IX3
 +in the virtual enter stack frame.
 +
 +The task enable toggles, the accumulator, and the interrupt mask
 +register are not changed by this variant.
 +
 +If the environment number contained in the stack frame is
 +Zero, then the environment returned to is the same environment
 +that is specified by the active environment number. The correct
 +base/limit pairs are already resident within the processor.
 +
 +Not zero, then this instruction is a nonlocal virtual exit,
 +which requires that a new MAT be loaded.
 +
 +If the first digit of the environment number is equal to a D and
 +the processor is not in privileged mode, an invalid instruction
 +fault (IEX=31) occurs, and the instruction terminates.
 +
 +The processor loads the MAT, pointed to by the environment
 +number, in the stack frame.
 +
 +The processor resolves the next instruction address, relative to
 +base 1, and executes an unconditional branch to that address.
 +
 +The current MAT and the MAT being entered must share the same data
 +area (base 0). The processor does not check for improper memory
 +assignments.
 +
 +=== Hyper Call/Return and Hardware Call/Return ===
 +
 +The hyper call/return, hardware call/return variant can only be
 +executed with privileged enabled.
 +
 +The value IX3 - 80 represents the address of the hyper call or
 +hardware call stack frame, relative to base 0. The information in
 +the hyper call/hardware call stack frame is used to replace the
 +respective state in the machine.
 +
 +The hyper call/hardware call stack frame has been stored in the
 +following sequence:
 +
 +^       ^  Information  ^  Digits  ^
 +|  New TOS => | Accumulator   |  00-27  |
 +|             | Measurement Register (User Part)  |  28-35  |
 +|             | Interrupt Mask  |  36-37  |
 +|             | Mobile Index Registers  |  38-69  |
 +|             | Task Enable Toggles  |  70-71  |
 +|             | Comparison and Overflow Flags  |  72-73  |
 +|             | Active Environment Number      |  74-79  |
 +|  Old IX3 => | Next Instruction Address       |  80-85  |
 +|             | Saved IX3 Value                |  86-93  |
 +|             | Stack Frame Indicator (FE/FD)  |  94-95  |
 +|             | Stack Parameters (0 to 9999 bytes)  |    96-xxxx  |
 +|  Old TOS => |    |    |
 +
 +^ Note: The lowest memory address is 00.  ^
 +
 +RET replaces the address in memory address 40, relative to base 0,
 +with the value of IX3 minus 80, relative to base 0. After the state
 +is loaded, RET replaces the contents of IX3 with the value of IX3
 +in the hyper call/hardware call stack frame.
 +
 +Set the MOPOK line to zero while the measurement register is being
 +changed and set it to 1 at all other times.
 +
 +Load the MAT pointed to by the environment number in the hyper
 +call/hardware call stack frame.
 +
 +Examine the soft fault and trace mode fault condition Indicators to
 +determine if a hardware call procedure should be executed. If soft
 +fault is now enabled, examine the soft fault pending flag in the
 +reinstate list entry for this task. If it is not zero, then a soft
 +fault condition exists.
 +
 +If this variant is a hyper return (stack frame indicator = FE)
 +and trace mode is enabled, then a trace fault condition exists.
 +
 +If this variant is a hardware return (stack frame
 +indicator = FD), ignore the trace mode until the execution of
 +the following instruction is complete.
 +
 +If a fault condition is found, a hardware call procedure executes
 +to store the address of the next instruction and report all
 +existing fault conditions.
 +
 +Using the new base/limit information, resolve the next instruction
 +address, relative to base 1, and execute an unconditional branch to
 +that address.
 +
 +=== Enter/Exit ===
 +
 +The enter stack frame address (base 0 relative) is represented by
 +IX1. The information in the enter stack frame replaces the
 +respective "state" in the processor. The enter stack frame has been
 +stored in the following sequence:
 +
 +^       ^  Information  ^  Digits  ^
 +|  Old IX3 => | Next Instruction Address       |  00-05  |
 +|             | Saved IX3 Value                |  06-13  |
 +|             | Comparison and Overflow Flags  |  14-15  |
 +|             | Stack Parameters (0 to 9999 bytes)  |    16-xxxx  |
 +|  Old TOS => |    |    |
 +
 +^ Note: The lowest memory address is 00.  ^
 +
 +The overflow and comparison flags are restored as specified by
 +IX3 + 15 if the digit at IX3 + 14 is 0. If the digit at
 +IX3 + 14 is equal to 1, the flags are not restored.
 +
 +^  Information  ^       Digit  ^    Bit  ^
 +|  Reserved         |       15   |      3  |
 +|  Overflow         |       15   |      2  |
 +|  Comparison LOW   |       15   |      1  |
 +   Comparison HIGH  |       15   |      0  |
 +
 +The least significant six digits in IX3 replaces the content at
 +memory location 40 relative to base 0. The saved IX3 value in
 +the enter stack frame replaces IX3 in memory.
 +
 +An unconditional branch to the next instruction address,
 +relative to base 1, occurs as specified in the enter stack
 +frame.
 +
  
instructions/ret.txt ยท Last modified: 2011/07/20 13:09 by scott
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki