?? LEFT := 1, RIGHT := 110 ??
?? FMT (FORMAT := ON, keyw := upper, ident := lower) ??
?? NEWTITLE := 'NOS/VE: Program Management - Program Conditions' ??
?? NEWTITLE := '  Global System Declarations' ??
MODULE tmm$get_monitor_fault;
{   PURPOSE:
{     The purpose of this module is to package the contained procedure
{     with the privileges necessary to modify the monitor fault
{     structures in the XCB.

{   DESIGN:
{     The procedure (TMP$GET_MONITOR_FAULT) contained in this module
{     has a execution bracket of 1, 1 and a call bracket of 3.
?? EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc OST$EXECUTION_CONTROL_BLOCK
?? POP ??
*copyc TMT$FAULT_STATUS
?? TITLE := '  Global External Procedures' ??
?? EJECT ??
*copyc I#DISABLE_TRAPS
*copyc I#RESTORE_TRAPS

*copyc PMP$FIND_EXECUTING_TASK_XCB
?? TITLE := '  [XDCL, #GATE] tmp$get_monitor_fault' ??
?? EJECT ??

  PROCEDURE [XDCL, #GATE] tmp$get_monitor_fault (fault_index: tmt$monitor_fault_buffers;
    VAR fault: ost$monitor_fault;
    VAR fault_status: tmt$fault_status);
*copy TMH$GET_MONITOR_FAULT

    VAR
      trap_enables: 0 .. 3,
      xcb: ^ost$execution_control_block;

    pmp$find_executing_task_xcb (xcb);
    i#disable_traps (trap_enables);

    IF (fault_index >= LOWERVALUE (tmt$monitor_fault_buffers)) AND (fault_index <= UPPERVALUE
          (tmt$monitor_fault_buffers)) THEN
      IF (xcb^.monitor_faults.present [fault_index]) THEN
        fault := xcb^.monitor_faults.buffer [fault_index];
        xcb^.monitor_faults.present [fault_index] := FALSE;
        xcb^.monitor_faults.reserved [fault_index] := FALSE;
        fault_status := tmc$normal_fault_status;
      ELSE
        fault_status := tmc$no_fault_present;
      IFEND;
    ELSE
      fault_status := tmc$invalid_fault_index;
    IFEND;
    i#restore_traps (trap_enables);
  PROCEND tmp$get_monitor_fault;
MODEND tmm$get_monitor_fault;
