Table of Contents

Format

OP AF BF A Syllable

OP = 93

AF Unused and reserved. Can be specified as an indirect field length.
BF Variant, which can be specified as an indirect field length. The variant functions are as follows:

All other BF values are ignored.

The A Syllable is the address of a pointer to a reinstate list entry, which is linked at the top of the ready list if BF is 01. This address can be indexed, indirect, or extended. The final address controller is ignored.

Note This instruction can only be executed in KERNEL mode with the Privileged Enable toggle set, or an Invalid Instruction fault (IEX=02) is reported.

Function

BRV is a companion instruction to the interrupt procedure. BRV accesses the ready list to find the first task that can be run and reinstates that task on the processor that is executing the instruction. The processor state is loaded from the reinstate list entry for that task and control is transferred to the next instruction address. The address is derived from the interrupt frame after the base/limit registers are loaded. If no task is found to run, the processor goes to IDLE mode.

BRV is functionally divided into the search and reinstate phases. The search phase is considered to be part of the MCP kernel task, and the time spent in this phase is charged to the kernel task. The reinstate phase is both part MCP kernel task and user task; time spent in each task is charged accordingly.

BRV searches the ready list, which is a linked list of reinstate list entry pointers. The head of ready list pointer, located in the kernel data area, points to the first entry in the ready list. Within a reinstate list entry is the Link to Next reinstate list entry field; this field contains the address that points to another entry in the reinstate List. The link format is

C7AAAAAA

C represents the positive sign, 7 is the base indicant value, and AAAAAA is the offset. The offset field of the last link in the list is EEEEEE (which represents a NIL pointer).

Within the information contained in a reinstate list entry, there are three contiguous 2-digit fields. They are the state indicator, stop count, and processor number fields.

If the state indicator field (used mainly by hardware) is a nonzero value, the corresponding task is waiting for something to happen. If the stop count field (used mainly by software) is a nonzero value, the corresponding task is stopped. If either of the fields are nonzero, the corresponding task is blocked from running. The processor number field describes the processor on which the corresponding task is active. The three fields combine to form the wait field. A task can run only if the value of the wait field is zero.

If during a search a task was found to be not active and blocked, the task is delinked from the ready list.

Search Phase

While in the search phase, the processor will halt on any processor detected fault. The processor performs the following:

  1. Locates the head-of-the-ready-list pointer.
    If BF=00, it is loacated in the kernel data area, and the processor goes to step 3.
    If BF=01, the A-address is used to find the pointer (format = C7AAAAAA) to a reinstate list entry that is examined as in step 2
  2. Examines the wait field of the reinstate list entry.
    If the field has any value other than 800000, the head of the ready list pointer is located in the kernel data area and the processor goes to step 3.
    If the field is equal to 800000, the corresponding task is added to the head of the ready list as follows:
    1. The processor writes the head of the ready list pointer value into the link to next reinstate list entry field of the reinstate list entry for the task described by the A-address pointer. It writes the pointer described by the A-address into the head-of-the-ready-list pointer field in the kernel data area.
    2. The processor resets the most significant bit of the wait field for the new head of the ready list. The link and the head of the ready list are now changed.
  3. Examines the head of the ready list pointer offset field.
    If the field contains EEEEEE, the list is empty, and the processor proceeds to step 14.
    If the field contains any value other than EEEEEE, the processor proceeds to step 4.
  4. Examines the wait field in the reinstate list entry for the task pointed to by the head of the ready list pointer.
    If the field is 000000, the corresponding task is not active on another processor and it is not blocked. It is a task that can be run and is the one that is to be reinstated. The processor number field for this task is set to the value of the current processor number, and the processor proceeds to the reinstate phase.
    If the field is not 000000, the processor proceeds to step 5 to examine the processor number field of the same reinstate list entry.
  5. The processor proceeds to step 9, if the processor number field is not 00, to examine the reinstate list entry; otherwise it examines the state indicator and stop count fields. The nonzero processor number field indicates that the task is active on another processor.
  6. If either or both fields have a nonzero value, the corresponding task is blocked, and the most significant bit of the state indicator is set before proceeding to step 7 to cause the task to be delinked.
  7. Modifies the head-of-the-ready-list pointer to point to the next task on the list because the current task is at the top of the ready list. The processor reads the link to next reinstate list entry field for this task and writes it in the head-of-the-ready-list pointer field of the kernel data area. The current task is delinked and the head of the ready list is updated.
  8. Examines the next task on the list by using the new head of the ready list and returns to step 4.
  9. Uses the link to next reinstate list entry field to point to the next task on the list.
    If the offset field contains EEEEEE, the processor proceeds to step 14 because the reinstate list entry describes the last task on the ready list.
    If the field format is C7AAAAAA, the processor uses the offset part of field to point to the next reinstate list entry and proceeds to step 10.
  10. Examines the wait field in the reinstate list entry for the new task.
    Reinstates the task if the wait field is equal to 000000, which indicates that the corresponding task is not active on another processor or blocked, and therefore can run and will be reinstated.
    Sets the processor number field for the task to the internal value of the current processor number and proceeds to the reinstate phase.
    Examines the processor number field in the same reinstate list entry if the wait field is not equal to 000000.
  11. Returns to step 9 to determine if the processor number field of the next entry contains a nonzero value. If the processor number field is zero, examines the state indicator and stop count fields.
  12. Blocks the corresponding task, if either field contains a nonzero value. The most significant bit of the state indicator is set to cause the task to be delinked.
  13. Copies the link to next reinstate list entry field for the current task into the link to next reinstate list entry field for the task to which the current task was linked. Return to step 9.
  14. The ready list for the current processor does not contain a task that can run. The processor does the following:
    • Adds the elapsed time in kernel mode to the already accumulated kernel time for the processor.
    • Changes the processor mode from kernel to idle.
    • Relinquishes the kernel mode access lock.
    • Terminates the instruction.

Reinstate Phase

The task that is reinstated becomes the current task. During the reinstate phase, the processor performs the following:

  1. Adds the elapsed time in kernel mode to the already accumulated time for the current processor.
  2. Changes mode from kernel to executing.
  3. Relinquishes the kernel mode access lock.
  4. Loads the interrupt frame from the reinstate list entry for the current task.
  5. Sets the MOPOK line to zero while the measurement register is being changed, and sets the line to 1 at all other times.
  6. Sets the task timer to the value located at the time slice remaining field in the specified reinstate list entry.
  7. Services either a pending task timer or an alarm timer or both.
  8. Performs the following steps when a fault, virtual branch failure, is detected in the reinstate phase steps 1 through 6:
    • Stores the fault indicators in the failed hardware call R/D area field of the reinstate list entry for this task.
    • Stores the “failed BRV” value in the state indicator field in the reinstate list entry for this task.
    • Saves the “failed BRV” value within the processor for future update of the instruction interrupt cause descriptor field in the kernel data area and performs an interrupt procedure that reports an instruction interrupt in the interrupt descriptor in the kernel data area.
  9. Performs the load MAT procedure to pass the active environment number from the active reinstate list entry as a parameter, and sets the type-of-MA-fault parameter to soft.
  10. Examines the soft fault and trace enable toggles to determine if a hardware call procedure is to execute. If trace enable is enabled now, a trace fault condition exists.
  11. Examines the soft pending flag in the reinstate list entry for the current task if soft fault is enabled now. If the flag is not set to zero, a soft fault condition exists.
  12. Executes a hardware call procedure that stores the address of the next instruction to execute, and reports all existing fault conditions if a fault condition is detected in steps 10 and 11.

Comparison Flags

Subsequent to the execution of this instruction, the comparison flags will be restored from the reinstate list entry for the newly reinstated task..

Overflow Flag

Subsequent to the execution of this instruction, the overflow flag will be restored from the reinstate list entry for the newly reinstated task..