?? RIGHT := 110 ??
?? NEWTITLE := 'NOS/VE Signal and Flag Management' ??
?? NEWTITLE := '  TMM$ALLOCATE_EXECUTION_RINGS' ??
MODULE tmm$allocate_execution_rings;

{   PURPOSE:
{     The purpose of this module is to package contained procedures
{     so that they execute with the privileges necessary to modify
{     signal and flag execution rings (tcb) and the handler descriptions.
{
{     This module allocates an execution ring to each outstanding
{     signal and system flag.

{     The module also contains procedures enable and disable preemptive
{     communication.

{   DESIGN:
{     The procedures contained in this module have a execution bracket
{     of 2, 2 and a call bracket of 3.
{
{   DESIGN ASSUMPTIONS:
{     1.  No procedure which executes soley in task monitor rings
{         (i.e., execute bracket of 2 - 2) has a call
{         bracket greater than task services (3).  In other words,
{         such a task monitor procedure can be called only from within
{         its execute bracket or from task services.
{
{     2.  All signal and system flag recognition rings are less than or
{         equal to 4 (task services ring + 1).
{
{     3.  No signal or system flag handler has an execute bracket which
{         extends above the task services ring.
{
{

?? NEWTITLE := '    Global Declarations Referenced By This Module', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc osd$code_base_pointer
*copyc oss$job_paged_literal
*copyc ost$caller_identifier
*copyc ost$execution_control_block
*copyc pme$define_handler_exceptions
*copyc tmc$execution_ring_constants
*copyc tmt$allocated_execution_rings
*copyc tmt$pc_handler_descriptions
*copyc tmt$preempted_reason
?? POP ??

*copyc i#disable_traps
*copyc i#restore_traps
*copyc i#enable_traps
*copyc osp$set_status_abnormal
*copyc pmp$build_ring_crossing_frame
*copyc pmp$find_executing_task_tcb
*copyc pmp$find_executing_task_xcb
*copyc tmp$dispose_of_inserted_preempt
*copyc tmp$find_ring_crossing_frame

?? TITLE := '    Signal Handlers Referenced By This Module', EJECT ??

?? PUSH (LISTEXT := ON) ??
{*copyc dsh$signal_handler
?? POP ??
*copyc dsp$signal_handler

?? PUSH (LISTEXT := ON) ??
*copyc cmh$signal_handler
?? POP ??
*copyc cmp$signal_handler

?? PUSH (LISTEXT := ON) ??
*copyc clh$scl_signal_handler
?? POP ??
*copyc clp$scl_signal_handler

?? PUSH (LISTEXT := ON) ??
*copyc ifh$handle_signal
?? POP ??
*copyc ifp$handle_signal

?? PUSH (LISTEXT := ON) ??
*copyc jmh$handle_job_resource_signal
?? POP ??
*copyc jmp$handle_job_resource_signal

?? PUSH (LISTEXT := ON) ??
*copyc jmh$handle_signal_sense_switch
?? POP ??
*copyc jmp$handle_signal_sense_switch

?? PUSH (LISTEXT := ON) ??
*copyc jmh$swapin_job_signal_handler
?? POP ??
*copyc jmp$swapin_job_signal_handler

?? PUSH (LISTEXT := ON) ??
*copyc jmh$timesharing_signal_handler
?? POP ??
*copyc jmp$timesharing_signal_handler

?? PUSH (LISTEXT := ON) ??
*copyc mlh$handle_signal
?? POP ??
*copyc mlp$handle_signal

?? PUSH (LISTEXT := ON) ??
*copyc mmh$fetch_segment_attributes
?? POP ??
*copyc mmp$fetch_segment_attributes

*copyc nap$cn_signal_handler

?? PUSH (LISTEXT := ON) ??
*copyc nah$gt_deliver_event_handler
?? POP ??
*copyc nap$gt_deliver_event_handler

?? PUSH (LISTEXT := ON) ??
*copyc nah$gt_send_data_handler
?? POP ??
*copyc nap$gt_send_data_handler

?? PUSH (LISTEXT := ON) ??
*copyc nah$gt_deliver_connect_handler
?? POP ??
*copyc nap$gt_deliver_connect_handler

*copyc nap$se_deliver_event_handler

*copyc nap$se_send_data_handler

*copyc nap$se_disconnect_handler

*copyc ofp$handle_signal_processor

*copyc pmp$child_termination_handler

*copyc pmp$multi_task_signal_handler


?? TITLE := '    Flag Handlers Referenced By This Module', EJECT ??


*copyc avp$monitor_statistics_handler

*copyc dsp$log_dft_data

*copyc dsp$retrieve_system_message

?? PUSH (LISTEXT := ON) ??
*copyc ioh$mfh_subsystem_io_completion
?? POP ??
*copyc iop$mfh_subsystem_io_completion

?? PUSH (LISTEXT := ON) ??
*copyc jmh$terminate_job_flag_handler
?? POP ??
*copyc jmp$terminate_job_flag_handler

?? PUSH (LISTEXT := ON) ??
*copyc jmh$handle_logout_flag
?? POP ??
*copyc jmp$handle_logout_flag

*copyc jmp$message_waiting_flag_hndlr

*copyc mmp$failed_allocation_flag_hdl

?? PUSH (LISTEXT := ON) ??
*copyc mmh$volume_unavailable_flag_hdl
?? POP ??
*copyc mmp$volume_unavailable_flag_hdl

*copyc nap$cn_flag_handler

*copyc nlp$cc_work_list_processor

*copyc ofp$handle_operator_break_flag

*copyc osp$handle_keyp_environ_change

?? PUSH (LISTEXT := ON) ??
*copyc osh$unstep_resume_flag_handler
?? POP ??
*copyc osp$unstep_resume_flag_handler

?? PUSH (LISTEXT := ON) ??
*copy pmh$kill_task_flag_handler
?? POP ??
*copyc pmp$kill_task_flag_handler

*copyc pmp$terminate_flag_handler

?? PUSH (LISTEXT := ON) ??
*copyc rfh$process_pp_response_flag
?? POP ??
*copyc rfp$process_pp_response_flag

*copyc syp$job_recovery_flag_handler

?? PUSH (LISTEXT := ON) ??
*copyc tmh$dispose_mainframe_signals
?? POP ??
*copyc tmp$dispose_mainframe_signals


?? TITLE := '    Global Declarations Declared By This Module' ??
?? NEWTITLE := '      Signal Handler Definitions', EJECT ??

  VAR
    tmv$signal_handler_descriptions: [XDCL, READ, oss$job_paged_literal] array [pmt$signal_id] of
          tmt$pc_handler_description := [

    {tmc$signal_available_0         } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {ofc$signal                     } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$signal, ^ofp$handle_signal_processor],

    {mlc$signal_id                  } [tmc$highest_recognition_ring, osc$os_ring_1, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$signal, ^mlp$handle_signal],

    {ifc$signal_id                  } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$long_term_wait], tmc$signal, ^ifp$handle_signal],

    {pmc$ss_child_terminated        } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$signal,
          ^pmp$child_termination_handler],

    {jmc$timesharing_signal_id      } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$long_term_wait], tmc$signal, ^jmp$timesharing_signal_handler],

    {cmc$configuration_signal_id  } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$signal,
          ^cmp$signal_handler],

    {jmc$sense_switch_signal_id     } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$signal,
          ^jmp$handle_signal_sense_switch],

    {tmc$signal_available_8         } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {jmc$job_resource_signal_id     } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$signal,
          ^jmp$handle_job_resource_signal],

    {dsc$deadstart_signal           } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$signal, ^dsp$signal_handler],

    {tmc$signal_available_11        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {nac$network_device_error       } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$signal, ^nap$cn_signal_handler],

    {tmc$signal_available_13        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_14        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {pmc$multi_task_condition       } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tmtr_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$signal,
          ^pmp$multi_task_signal_handler],

    {nac$gt_deliver_data            } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$signal, ^nap$gt_deliver_event_handler],

    {nac$gt_send_data               } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$signal, ^nap$gt_send_data_handler],

    {nac$gt_deliver_connect_request } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$signal,
          ^nap$gt_deliver_connect_handler],

    {nac$se_deliver_data_signal     } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$signal, ^nap$se_deliver_event_handler],

    {nac$se_send_data_signal        } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$signal, ^nap$se_send_data_handler],

    {nac$se_disconnect_signal        } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$signal, ^nap$se_disconnect_handler],

    {tmc$signal_available_22        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_23        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_24        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_25        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_26        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {clc$scl_signal                 } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$signal, ^clp$scl_signal_handler],

    {tmc$signal_available_28        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_29        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_30        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_31        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_32        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_33        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_34        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_35        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_36        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_37        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_38        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_39        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_40        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_41        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_42        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_43        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_44        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_45        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_46        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_47        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_48        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_49        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_50        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_51        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_52        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_53        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_54        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_55        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_56        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_57        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_58        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_59        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_60        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_61        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_62        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL],

    {tmc$signal_available_63        } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$signal, NIL]];

?? TITLE := '      Flag Handler Definitions', EJECT ??

  VAR
    tmv$flag_handler_descriptions: [XDCL, READ, oss$job_paged_literal] array [ost$system_flag] of
          tmt$pc_handler_description := [

    {pmc$kill_task_flag             } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tmtr_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$system_flag,
          ^pmp$kill_task_flag_handler],

    {avc$monitor_statistics_flag    } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tmtr_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$system_flag,
          ^avp$monitor_statistics_handler],

    {pmc$sf_terminate_task          } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$system_flag,
          ^pmp$terminate_flag_handler],

    {jmc$terminate_job_flag         } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$system_flag,
          ^jmp$terminate_job_flag_handler],

    {tmc$mainframe_linked_signals   } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tmtr_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$system_flag,
          ^tmp$dispose_mainframe_signals],

    {jmc$logout_flag_id             } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$system_flag, ^jmp$handle_logout_flag],

    {jmc$kill_job_flag_id           } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$system_flag,
          ^jmp$terminate_job_flag_handler],

    {dsc$retrieve_system_message    } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$system_flag,
          ^dsp$retrieve_system_message],

    {nac$network_input_received     } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$system_flag, ^nap$cn_flag_handler],

    {osc$keyp_environ_change_flag   } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$system_flag,
          ^osp$handle_keyp_environ_change],

    {tmc$flag_available_10          } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$system_flag, NIL],

    {nac$channelnet_local_event     } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$system_flag, ^nap$cn_flag_handler],

    {tmc$flag_available_12          } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$system_flag, NIL],

    {syc$job_recovery_flag          } [tmc$lowest_signal_flag_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$system_flag,
          ^syp$job_recovery_flag_handler],

    {ioc$subsystem_io_complete      } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$system_flag,
          ^iop$mfh_subsystem_io_completion],

    {dsc$log_dft_flag_id            } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$system_flag, ^dsp$log_dft_data],

    {ofc$operator_break_flag        } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$system_flag,
          ^ofp$handle_operator_break_flag],

    {osc$system_unstep_resume_flag  } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$system_flag,
          ^osp$unstep_resume_flag_handler],

    {nlc$cc_work_list_flag          } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$system_flag,
          ^nlp$cc_work_list_processor],

    {rfc$pp_response_available      } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$system_flag,
          ^rfp$process_pp_response_flag],

    {mmc$failed_file_alloc_flag     } [tmc$lowest_signal_flag_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$system_flag,
          ^mmp$failed_allocation_flag_hdl],

    {mmc$volume_unavailable_flag    } [tmc$lowest_signal_flag_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$system_flag,
          ^mmp$volume_unavailable_flag_hdl],

    {jmc$message_waiting_flag_id    } [tmc$highest_recognition_ring, osc$tmtr_ring, osc$tsrv_ring,
          $tmt$wait_preemptability [tmc$wait, tmc$long_term_wait], tmc$system_flag,
          ^jmp$message_waiting_flag_hndlr],

    {tmc$flag_available_23          } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$system_flag, NIL],

    {tmc$flag_available_24          } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$system_flag, NIL],

    {tmc$flag_available_25          } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$system_flag, NIL],

    {tmc$flag_available_26          } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$system_flag, NIL],

    {tmc$flag_available_27          } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$system_flag, NIL],

    {tmc$flag_available_28          } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$system_flag, NIL],

    {tmc$flag_available_29          } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$system_flag, NIL],

    {tmc$flag_available_30          } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$system_flag, NIL],

    {tmc$flag_available_31          } [osc$invalid_ring, osc$invalid_ring, osc$invalid_ring,
          $tmt$wait_preemptability [], tmc$system_flag, NIL]];

?? OLDTITLE ??
?? TITLE := '    ALLOCATE_SIGNAL_X_RING', EJECT ??

  PROCEDURE allocate_signal_x_ring
    (    signal_id: pmt$signal_id;
         x_attributes: tmt$pc_handler_description;
         preempted_reason: tmt$preempted_reason;
         preempted_ring: ost$ring;
     VAR signal_execution_ring: tmt$handler_execution_ring;
     VAR allocated_execution_rings {input, output} : tmt$allocated_execution_rings);

    VAR
      traps: 0 .. 3,
      status: ost$status;

    i#disable_traps (traps);

    CASE preempted_reason OF

    = tmc$free_flag =
      IF (preempted_ring >= x_attributes.recognition_ring) THEN
        IF (preempted_ring >= x_attributes.high_execution_ring) THEN
          signal_execution_ring := x_attributes.high_execution_ring;
          allocated_execution_rings := allocated_execution_rings +
                $tmt$allocated_execution_rings [signal_execution_ring];
        ELSE
          IF (preempted_ring >= x_attributes.low_execution_ring) THEN
            signal_execution_ring := preempted_ring;
            allocated_execution_rings := allocated_execution_rings +
                  $tmt$allocated_execution_rings [signal_execution_ring];
          ELSE
            set_inserted_preemption (preempted_ring, status);
            IF status.normal THEN
              signal_execution_ring := tmc$delay_allocation;
            ELSE
              {The task is broken leave the signal in the buffer with an unallocated x ring. 'Set inserted'
              {detected an inconsistent stack segment, the task will be allowed to continue until the
              {condition arises again at which time the task will be aborted.
            IFEND;
          IFEND;
        IFEND;
      ELSE
        set_delayed_preemption (x_attributes.recognition_ring - 1, status);
        IF status.normal THEN
          signal_execution_ring := tmc$delay_allocation;
        ELSE
          {The task is broken leave the signal in the buffer with an unallocated x ring. 'Set delayed'
          {detected an inconsistent stack segment, the task will be allowed to continue until the condition
          {arises again at which time the task will be aborted.
        IFEND;
      IFEND;

    = tmc$recognition_ring_delay =
      IF (preempted_ring >= (x_attributes.recognition_ring - 1)) THEN
        IF preempted_ring >= (x_attributes.high_execution_ring) THEN
          signal_execution_ring := x_attributes.high_execution_ring;
          allocated_execution_rings := allocated_execution_rings +
                $tmt$allocated_execution_rings [signal_execution_ring];
        ELSE
          IF (preempted_ring >= x_attributes.low_execution_ring) THEN
            signal_execution_ring := preempted_ring;
            allocated_execution_rings := allocated_execution_rings +
                  $tmt$allocated_execution_rings [signal_execution_ring];
          IFEND;
        IFEND;
      IFEND;

    = tmc$x_bracket_delay =
      IF (preempted_ring >= x_attributes.recognition_ring) THEN
        IF (preempted_ring >= x_attributes.high_execution_ring) THEN
          signal_execution_ring := x_attributes.high_execution_ring;
          allocated_execution_rings := allocated_execution_rings +
                $tmt$allocated_execution_rings [signal_execution_ring];
        ELSE
          IF (preempted_ring >= x_attributes.low_execution_ring) THEN
            signal_execution_ring := preempted_ring;
            allocated_execution_rings := allocated_execution_rings +
                  $tmt$allocated_execution_rings [signal_execution_ring];
          IFEND;
        IFEND;
      IFEND;

    = tmc$wait =
      IF (tmc$wait IN x_attributes.preempt_wait) THEN
        IF (preempted_ring >= x_attributes.high_execution_ring) THEN
          signal_execution_ring := x_attributes.high_execution_ring;
          allocated_execution_rings := allocated_execution_rings +
                $tmt$allocated_execution_rings [signal_execution_ring];
        ELSE
          IF (preempted_ring >= x_attributes.low_execution_ring) THEN
            signal_execution_ring := preempted_ring;
            allocated_execution_rings := allocated_execution_rings +
                  $tmt$allocated_execution_rings [signal_execution_ring];
          IFEND;
        IFEND;
      ELSE
        set_delayed_preemption (x_attributes.recognition_ring - 1, status);
        IF status.normal THEN
          signal_execution_ring := tmc$delay_allocation;
        IFEND;
      IFEND;

    = tmc$long_term_wait =
      IF (tmc$long_term_wait IN x_attributes.preempt_wait) THEN
        IF (preempted_ring >= x_attributes.high_execution_ring) THEN
          signal_execution_ring := x_attributes.high_execution_ring;
          allocated_execution_rings := allocated_execution_rings +
                $tmt$allocated_execution_rings [signal_execution_ring];
        ELSE
          IF (preempted_ring >= x_attributes.low_execution_ring) THEN
            signal_execution_ring := preempted_ring;
            allocated_execution_rings := allocated_execution_rings +
                  $tmt$allocated_execution_rings [signal_execution_ring];
          IFEND;
        IFEND;
      ELSE
        set_delayed_preemption (x_attributes.recognition_ring - 1, status);
        IF status.normal THEN
          signal_execution_ring := tmc$delay_allocation;
        IFEND;
      IFEND;

    = tmc$task_termination =
      IF (preempted_ring >= x_attributes.high_execution_ring) THEN
        signal_execution_ring := x_attributes.high_execution_ring;
        allocated_execution_rings := allocated_execution_rings +
              $tmt$allocated_execution_rings [signal_execution_ring];
      ELSE
        IF (preempted_ring >= x_attributes.low_execution_ring) THEN
          signal_execution_ring := preempted_ring;
          allocated_execution_rings := allocated_execution_rings +
                $tmt$allocated_execution_rings [signal_execution_ring];
        IFEND;
      IFEND;
    CASEND;

    i#restore_traps (traps);
  PROCEND allocate_signal_x_ring;

?? TITLE := '    ALLOCATE_TL_SIGNAL_X_RINGS', EJECT ??
?? PUSH (LISTEXT := ON) ??
{
{   The purpose of this request is to allocate execution rings for
{ signals in the task local signal list.
{
{       ALLOCATE_TL_SIGNAL_X_RINGS (PREEMPTED_REASON, PREEMPTED_RING,
{         ALLOCATED_EXECUTION_RINGS)
{
{ PREEMPTED_REASON: (input) This parameter specifies the reason that
{       task execution was preempted.
{
{ PREEMPTED_RING: (input) This parameter specifies the ring that was
{       preempted.
{
{ ALLOCATED_EXECUTION_RINGS: (input, output) This parameter specifies
{       the rings that are currently allocated to signals.
{
?? POP ??

  PROCEDURE allocate_tl_signal_x_rings
    (    preempted_reason: tmt$preempted_reason;
         preempted_ring: ost$ring;
     VAR allocated_execution_rings {input, output} : tmt$allocated_execution_rings);

    VAR
      traps: 0 .. 3,
      tcb: ^pmt$task_control_block,
      delink: ^^tmt$task_local_linked_signal;

    pmp$find_executing_task_tcb (tcb);
    i#disable_traps (traps);
    IF (tcb^.task_local_signal_list.delink <> NIL) THEN
      delink := ^tcb^.task_local_signal_list.delink;
      WHILE (delink^ <> NIL) DO
        allocate_signal_x_ring (delink^^.linked.signal.identifier,
              tmv$signal_handler_descriptions [delink^^.linked.signal.identifier], preempted_reason,
              preempted_ring, delink^^.signal_execution_ring, allocated_execution_rings);
        delink := ^delink^^.next_linked_signal;
      WHILEND;
    IFEND;
    i#restore_traps (traps);
  PROCEND allocate_tl_signal_x_rings;

?? TITLE := '    SET_DELAYED_PREEMPTION', EJECT ??
?? PUSH (LISTEXT := ON) ??
{
{   This procedure causes TMP$DISPOSE_OF_DELAYED_PREEMPT to be called
{ when the ring corresponding to in_ring is exited.
{
{       SET_DELAYED_PREEMPTION (IN_RING, STATUS)
{
{ IN_RING: (input) This parameter specifies the ring exit at which
{       pmp$dispose_of_delayed_preempt is to be executed.
{
{ STATUS: (output) This parameter specifies the request status - the
{       stack frames between the caller and ring exit may have been
{       destroyed preventing the procedure from performing its function.
{

{ NOTE: traps are disabled when this procedure is entered - to ensure that a
{       system crash is not caused due to an inconsistent stack or detected
{       uncorrected error, traps must be enabled during the stack scan.
{       Traps are disabled prior to the scan and disabled after the scan has
{       been completed.  Preventing a crash during the scan may allow other
{       preemptive processing to continue and allow the task to terminate in a
{       graceful manner.
?? POP ??

  PROCEDURE set_delayed_preemption
    (    in_ring: ost$valid_ring;
     VAR status: ost$status);

    VAR
      traps: 0 .. 3,
      starting_frame: ^ost$stack_frame_save_area,
      crossing_frame: ^ost$stack_frame_save_area;

    starting_frame := NIL;
    status.normal := TRUE;

    i#enable_traps (traps);
    tmp$find_ring_crossing_frame (starting_frame, crossing_frame, status);
    starting_frame := crossing_frame^.minimum_save_area.a2_previous_save_area;
    WHILE ((starting_frame <> NIL) AND (#RING (starting_frame) <= in_ring)) AND status.normal DO
      tmp$find_ring_crossing_frame (starting_frame, crossing_frame, status);
      starting_frame := crossing_frame^.minimum_save_area.a2_previous_save_area;
    WHILEND;

    i#restore_traps (traps);

    IF status.normal THEN
      pmp$build_ring_crossing_frame (crossing_frame);
    IFEND;
  PROCEND set_delayed_preemption;

?? TITLE := '    SET_INSERTED_PREEMPTION', EJECT ??
?? PUSH (LISTEXT := ON) ??
{   This procedure causes TMP$DISPOSE_OF_INSERTED_PREEMPT to execute
{ when the ring above_the value of above ring is returned to.
{
{ TMP$DISPOSE_OF_INSERTED_PREEMPT is never called it is only returned
{ to.
{
{ A stack frame corresponding to TMP$DISPOSE_OF_INSERTED_PREEMPT is
{ inserted at the top of stack segment in the next active ring greater
{ than above_ring.
{
{       SET_INSERTED_PREEMPTION (ABOVE_RING, STATUS)
{
{ ABOVE_RING: (input) This parameter specifies the ring above which
{       tmp$dispose_of_inserted_preempt is to execute.
{
{ STATUS: (output) This parameter specifies the request status - the
{       caller's stack segment may have been destroyed preventing the
{       procedure from being inserted - indicated by abnormal status.
{

{ NOTE: traps are disabled when this procedure is entered - to ensure that a
{       system crash is not caused due to an inconsistent stack or detected
{       uncorrected error, traps must be enabled during the stack scan.
{       Traps are disabled prior to the scan and disabled after the scan has
{       been completed.  Preventing a crash during the scan may allow other
{       preemptive processing to continue and allow the task to terminate in a
{       graceful manner.
?? POP ??

  PROCEDURE set_inserted_preemption
    (    above_ring: ost$valid_ring;
     VAR status: ost$status);

    VAR
      traps: 0 .. 3,
      starting_frame: ^ost$stack_frame_save_area,
      x_frame: ^ost$stack_frame_save_area, {ring crossing frame}
      number_x_registers: ost$register_number,
      a0_dsp: ^^cell,
      a0_pva: ost$pva,

      inserted_frame: ost$stack_frame_save_area,
      inserted_sfsa: ^ost$stack_frame_save_area,
      return_frame: ^ost$stack_frame_save_area,
      return_frame_size: integer,
      proc: ^procedure,
      cbp: ^ost$external_code_base_pointer,
      keylock: array [1 .. 1] of mmt$attribute_descriptor;

    starting_frame := NIL;
    status.normal := TRUE;

    i#enable_traps (traps);
    tmp$find_ring_crossing_frame (starting_frame, x_frame, status);
    starting_frame := x_frame^.minimum_save_area.a2_previous_save_area;
    WHILE ((starting_frame <> NIL) AND (#RING (starting_frame) <= above_ring)) AND status.normal DO
      tmp$find_ring_crossing_frame (starting_frame, x_frame, status);
      starting_frame := x_frame^.minimum_save_area.a2_previous_save_area;
    WHILEND;
    i#restore_traps (traps);

    IF status.normal THEN
      inserted_frame.minimum_save_area.a2_previous_save_area :=
            x_frame^.minimum_save_area.a2_previous_save_area;
      return_frame := x_frame^.minimum_save_area.a2_previous_save_area;
      IF (return_frame^.minimum_save_area.frame_descriptor.x_terminating >=
            return_frame^.minimum_save_area.frame_descriptor.x_starting) THEN
        number_x_registers := ((return_frame^.minimum_save_area.frame_descriptor.x_terminating -
              return_frame^.minimum_save_area.frame_descriptor.x_starting) + 1);
      ELSE
        number_x_registers := 0;
      IFEND;
      return_frame_size := #SIZE (ost$minimum_save_area) +
            (8 * ((return_frame^.minimum_save_area.frame_descriptor.a_terminating - 2) + number_x_registers));

      a0_pva.ring := #RING (return_frame^.minimum_save_area.a2_previous_save_area);
      a0_pva.seg := #SEGMENT (return_frame^.minimum_save_area.a2_previous_save_area);
      a0_pva.offset := #OFFSET (return_frame^.minimum_save_area.a0_dynamic_space_pointer) + return_frame_size;
      a0_dsp := #LOC (a0_pva);
      inserted_frame.minimum_save_area.a0_dynamic_space_pointer := a0_dsp^;
      inserted_frame.minimum_save_area.a1_current_stack_frame :=
            inserted_frame.minimum_save_area.a0_dynamic_space_pointer;

      inserted_frame.minimum_save_area.frame_descriptor.on_condition_flag := FALSE;
      inserted_frame.minimum_save_area.frame_descriptor.critical_frame_flag := FALSE;
      inserted_frame.minimum_save_area.frame_descriptor.a_terminating := 0f(16);
      inserted_frame.minimum_save_area.frame_descriptor.x_starting := 0;
      inserted_frame.minimum_save_area.frame_descriptor.x_terminating := 0;
      inserted_frame.minimum_save_area.vmid := osc$cyber_180_mode;

      inserted_frame.x_registers [0] := 0; {no parameters}
      inserted_frame.a4 := NIL; {no parameters}

      proc := ^tmp$dispose_of_inserted_preempt;
      cbp := #LOC (proc^);
      inserted_frame.minimum_save_area.p_register.pva.ring := a0_pva.ring;
      inserted_frame.minimum_save_area.p_register.pva.seg := #SEGMENT (cbp^.code_pva);
      inserted_frame.minimum_save_area.p_register.pva.offset := #OFFSET (cbp^.code_pva);

      {global/local keys}
      keylock [1].keyword := mmc$kw_gl_key;
      mmp$fetch_segment_attributes (cbp^.code_pva, keylock, status);
      IF (return_frame^.minimum_save_area.p_register.global_key = 0) THEN
        inserted_frame.minimum_save_area.p_register.global_key := keylock [1].gl_key.value;
      ELSE
        inserted_frame.minimum_save_area.p_register.global_key :=
              return_frame^.minimum_save_area.p_register.global_key;
      IFEND;
      IF keylock [1].gl_key.local THEN
        inserted_frame.minimum_save_area.p_register.local_key := keylock [1].gl_key.value;
      ELSE
        inserted_frame.minimum_save_area.p_register.local_key := 0;
      IFEND;

      inserted_frame.a3 := cbp^.binding_pva;

      {insert the constructed stack frame}
      inserted_sfsa := inserted_frame.minimum_save_area.a1_current_stack_frame;
      inserted_sfsa^ := inserted_frame;
      x_frame^.minimum_save_area.a2_previous_save_area := inserted_frame.minimum_save_area.
            a1_current_stack_frame;
    IFEND;
  PROCEND set_inserted_preemption;

?? TITLE := '    TMP$ALLOCATE_EXECUTION_RINGS', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc tmh$allocate_execution_rings
?? POP ??

  PROCEDURE [XDCL, #GATE] tmp$allocate_execution_rings
    (    preempted_ring: ost$ring;
         preempted_reason: tmt$preempted_reason;
         preemptive_type: tmt$preemptive_type;
     VAR allocated_execution_rings: tmt$allocated_execution_rings);

    VAR
      traps: 0 .. 3,
      status: ost$status,
      x_attributes: tmt$pc_handler_description,
      xcb: ^ost$execution_control_block,
      tcb: ^pmt$task_control_block,
      number_buffers: tmt$signal_buffers,
      s: tmt$signal_buffers,
      signal_id: pmt$signal_id,
      f: ost$system_flag;

    allocated_execution_rings := $tmt$allocated_execution_rings [];
    pmp$find_executing_task_xcb (xcb);
    tcb := xcb^.task_control_block;

    CASE preemptive_type OF

    = tmc$signal =                                                                                                                 l
      number_buffers := UPPERBOUND (xcb^.signals.present);
      FOR s := 1 TO number_buffers DO
        IF xcb^.signals.present [s] THEN
          signal_id := xcb^.signals.buffer [s].signal.identifier;
          allocate_signal_x_ring (signal_id, tmv$signal_handler_descriptions [signal_id], preempted_reason,
                preempted_ring, tcb^.signal_execution_ring [s], allocated_execution_rings);
        IFEND;
      FOREND;

      allocate_tl_signal_x_rings (preempted_reason, preempted_ring, allocated_execution_rings);

    = tmc$system_flag =
      i#disable_traps (traps);
      FOR f := LOWERVALUE (ost$system_flag) TO UPPERVALUE (ost$system_flag) DO
        IF (f IN xcb^.system_flags) THEN
          x_attributes := tmv$flag_handler_descriptions [f];
          CASE preempted_reason OF

          = tmc$free_flag =
            IF (preempted_ring >= x_attributes.recognition_ring) THEN
              IF (preempted_ring >= x_attributes.high_execution_ring) THEN
                tcb^.flag_execution_ring [f] := x_attributes.high_execution_ring;
                allocated_execution_rings := allocated_execution_rings + $tmt$allocated_execution_rings
                      [tcb^.flag_execution_ring [f]];
              ELSE
                IF (preempted_ring >= x_attributes.low_execution_ring) THEN
                  tcb^.flag_execution_ring [f] := preempted_ring;
                  allocated_execution_rings := allocated_execution_rings + $tmt$allocated_execution_rings
                        [tcb^.flag_execution_ring [f]];
                ELSE
                  set_inserted_preemption (preempted_ring, status);
                  IF status.normal THEN
                    tcb^.flag_execution_ring [f] := tmc$delay_allocation;
                  ELSE
                    {The task is broken leave the flag in system flags with an unallocated x ring. 'Set
                    {inserted' detected an inconsistent stack segment, the task will be allowed to continue
                    {until the condition arises again at which time the task will be aborted.
                  IFEND;
                IFEND;
              IFEND;
            ELSE
              set_delayed_preemption (x_attributes.recognition_ring - 1, status);
              IF status.normal THEN
                tcb^.flag_execution_ring [f] := tmc$delay_allocation;
              ELSE
                {The task is broken leave the flag in system flags with an unallocated x ring. 'Set delayed'
                {detected an inconsistent stack segment, the task will be allowed to continue until the
                {condition arises again at which time the task will be aborted.
              IFEND;
            IFEND;

          = tmc$recognition_ring_delay =
            IF (preempted_ring >= (x_attributes.recognition_ring - 1)) THEN
              IF preempted_ring >= (x_attributes.high_execution_ring) THEN
                tcb^.flag_execution_ring [f] := x_attributes.high_execution_ring;
                allocated_execution_rings := allocated_execution_rings + $tmt$allocated_execution_rings
                      [tcb^.flag_execution_ring [f]];
              ELSE
                IF (preempted_ring >= x_attributes.low_execution_ring) THEN
                  tcb^.flag_execution_ring [f] := preempted_ring;
                  allocated_execution_rings := allocated_execution_rings + $tmt$allocated_execution_rings
                        [tcb^.flag_execution_ring [f]];
                IFEND;
              IFEND;
            IFEND;

          = tmc$x_bracket_delay =
            IF (preempted_ring >= x_attributes.recognition_ring) THEN
              IF (preempted_ring >= x_attributes.high_execution_ring) THEN
                tcb^.flag_execution_ring [f] := x_attributes.high_execution_ring;
                allocated_execution_rings := allocated_execution_rings + $tmt$allocated_execution_rings
                      [tcb^.flag_execution_ring [f]];
              ELSE
                IF (preempted_ring >= x_attributes.low_execution_ring) THEN
                  tcb^.flag_execution_ring [f] := preempted_ring;
                  allocated_execution_rings := allocated_execution_rings + $tmt$allocated_execution_rings
                        [tcb^.flag_execution_ring [f]];
                IFEND;
              IFEND;
            IFEND;

          = tmc$wait =
            IF (tmc$wait IN x_attributes.preempt_wait) THEN
              IF (preempted_ring >= x_attributes.high_execution_ring) THEN
                tcb^.flag_execution_ring [f] := x_attributes.high_execution_ring;
                allocated_execution_rings := allocated_execution_rings + $tmt$allocated_execution_rings
                      [tcb^.flag_execution_ring [f]];
              ELSE
                IF (preempted_ring >= x_attributes.low_execution_ring) THEN
                  tcb^.flag_execution_ring [f] := preempted_ring;
                  allocated_execution_rings := allocated_execution_rings + $tmt$allocated_execution_rings
                        [tcb^.flag_execution_ring [f]];
                IFEND;
              IFEND;
            ELSE
              set_delayed_preemption (x_attributes.recognition_ring - 1, status);
              IF status.normal THEN
                tcb^.flag_execution_ring [f] := tmc$delay_allocation;
              IFEND;
            IFEND;

          = tmc$long_term_wait =
            IF (tmc$long_term_wait IN x_attributes.preempt_wait) THEN
              IF (preempted_ring >= x_attributes.high_execution_ring) THEN
                tcb^.flag_execution_ring [f] := x_attributes.high_execution_ring;
                allocated_execution_rings := allocated_execution_rings + $tmt$allocated_execution_rings
                      [tcb^.flag_execution_ring [f]];
              ELSE
                IF (preempted_ring >= x_attributes.low_execution_ring) THEN
                  tcb^.flag_execution_ring [f] := preempted_ring;
                  allocated_execution_rings := allocated_execution_rings + $tmt$allocated_execution_rings
                        [tcb^.flag_execution_ring [f]];
                IFEND;
              IFEND;
            ELSE
              set_delayed_preemption (x_attributes.recognition_ring - 1, status);
              IF status.normal THEN
                tcb^.flag_execution_ring [f] := tmc$delay_allocation;
              IFEND;
            IFEND;

          = tmc$task_termination =
            IF (preempted_ring >= x_attributes.high_execution_ring) THEN
              tcb^.flag_execution_ring [f] := x_attributes.high_execution_ring;
              allocated_execution_rings := allocated_execution_rings + $tmt$allocated_execution_rings
                    [tcb^.flag_execution_ring [f]];
            ELSE
              IF (preempted_ring >= x_attributes.low_execution_ring) THEN
                tcb^.flag_execution_ring [f] := preempted_ring;
                allocated_execution_rings := allocated_execution_rings + $tmt$allocated_execution_rings
                      [tcb^.flag_execution_ring [f]];
              IFEND;
            IFEND;
          CASEND;
        IFEND;
      FOREND;
      i#restore_traps (traps);
    CASEND;

  PROCEND tmp$allocate_execution_rings;
?? OLDTITLE ??
MODEND tmm$allocate_execution_rings;

