Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:52

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup RtemsTaskReqRestart
0007  */
0008 
0009 /*
0010  * Copyright (C) 2021 embedded brains GmbH & Co. KG
0011  *
0012  * Redistribution and use in source and binary forms, with or without
0013  * modification, are permitted provided that the following conditions
0014  * are met:
0015  * 1. Redistributions of source code must retain the above copyright
0016  *    notice, this list of conditions and the following disclaimer.
0017  * 2. Redistributions in binary form must reproduce the above copyright
0018  *    notice, this list of conditions and the following disclaimer in the
0019  *    documentation and/or other materials provided with the distribution.
0020  *
0021  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0022  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0023  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0024  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0025  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0026  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0027  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0028  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0029  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0030  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0031  * POSSIBILITY OF SUCH DAMAGE.
0032  */
0033 
0034 /*
0035  * This file is part of the RTEMS quality process and was automatically
0036  * generated.  If you find something that needs to be fixed or
0037  * worded better please post a report or patch to an RTEMS mailing list
0038  * or raise a bug report:
0039  *
0040  * https://www.rtems.org/bugs.html
0041  *
0042  * For information on updating and regenerating please refer to the How-To
0043  * section in the Software Requirements Engineering chapter of the
0044  * RTEMS Software Engineering manual.  The manual is provided as a part of
0045  * a release.  For development sources please refer to the online
0046  * documentation at:
0047  *
0048  * https://docs.rtems.org
0049  */
0050 
0051 #ifdef HAVE_CONFIG_H
0052 #include "config.h"
0053 #endif
0054 
0055 #include <limits.h>
0056 #include <rtems.h>
0057 #include <setjmp.h>
0058 #include <rtems/test-scheduler.h>
0059 #include <rtems/score/statesimpl.h>
0060 #include <rtems/score/threaddispatch.h>
0061 #include <rtems/score/threadimpl.h>
0062 
0063 #include "tx-support.h"
0064 
0065 #include <rtems/test.h>
0066 
0067 /**
0068  * @defgroup RtemsTaskReqRestart spec:/rtems/task/req/restart
0069  *
0070  * @ingroup TestsuitesValidationNoClock0
0071  *
0072  * @{
0073  */
0074 
0075 typedef enum {
0076   RtemsTaskReqRestart_Pre_Id_Invalid,
0077   RtemsTaskReqRestart_Pre_Id_Executing,
0078   RtemsTaskReqRestart_Pre_Id_Other,
0079   RtemsTaskReqRestart_Pre_Id_NA
0080 } RtemsTaskReqRestart_Pre_Id;
0081 
0082 typedef enum {
0083   RtemsTaskReqRestart_Pre_Dormant_Yes,
0084   RtemsTaskReqRestart_Pre_Dormant_No,
0085   RtemsTaskReqRestart_Pre_Dormant_NA
0086 } RtemsTaskReqRestart_Pre_Dormant;
0087 
0088 typedef enum {
0089   RtemsTaskReqRestart_Pre_Suspended_Yes,
0090   RtemsTaskReqRestart_Pre_Suspended_No,
0091   RtemsTaskReqRestart_Pre_Suspended_NA
0092 } RtemsTaskReqRestart_Pre_Suspended;
0093 
0094 typedef enum {
0095   RtemsTaskReqRestart_Pre_Restarting_Yes,
0096   RtemsTaskReqRestart_Pre_Restarting_No,
0097   RtemsTaskReqRestart_Pre_Restarting_NA
0098 } RtemsTaskReqRestart_Pre_Restarting;
0099 
0100 typedef enum {
0101   RtemsTaskReqRestart_Pre_Terminating_Yes,
0102   RtemsTaskReqRestart_Pre_Terminating_No,
0103   RtemsTaskReqRestart_Pre_Terminating_NA
0104 } RtemsTaskReqRestart_Pre_Terminating;
0105 
0106 typedef enum {
0107   RtemsTaskReqRestart_Pre_Protected_Yes,
0108   RtemsTaskReqRestart_Pre_Protected_No,
0109   RtemsTaskReqRestart_Pre_Protected_NA
0110 } RtemsTaskReqRestart_Pre_Protected;
0111 
0112 typedef enum {
0113   RtemsTaskReqRestart_Pre_Context_Task,
0114   RtemsTaskReqRestart_Pre_Context_Interrupt,
0115   RtemsTaskReqRestart_Pre_Context_NestedRequest,
0116   RtemsTaskReqRestart_Pre_Context_NA
0117 } RtemsTaskReqRestart_Pre_Context;
0118 
0119 typedef enum {
0120   RtemsTaskReqRestart_Pre_State_Ready,
0121   RtemsTaskReqRestart_Pre_State_Blocked,
0122   RtemsTaskReqRestart_Pre_State_Enqueued,
0123   RtemsTaskReqRestart_Pre_State_NA
0124 } RtemsTaskReqRestart_Pre_State;
0125 
0126 typedef enum {
0127   RtemsTaskReqRestart_Pre_Timer_Inactive,
0128   RtemsTaskReqRestart_Pre_Timer_Active,
0129   RtemsTaskReqRestart_Pre_Timer_NA
0130 } RtemsTaskReqRestart_Pre_Timer;
0131 
0132 typedef enum {
0133   RtemsTaskReqRestart_Pre_RealPriority_Initial,
0134   RtemsTaskReqRestart_Pre_RealPriority_Changed,
0135   RtemsTaskReqRestart_Pre_RealPriority_NA
0136 } RtemsTaskReqRestart_Pre_RealPriority;
0137 
0138 typedef enum {
0139   RtemsTaskReqRestart_Pre_ThreadDispatch_Disabled,
0140   RtemsTaskReqRestart_Pre_ThreadDispatch_Enabled,
0141   RtemsTaskReqRestart_Pre_ThreadDispatch_NA
0142 } RtemsTaskReqRestart_Pre_ThreadDispatch;
0143 
0144 typedef enum {
0145   RtemsTaskReqRestart_Post_Status_Ok,
0146   RtemsTaskReqRestart_Post_Status_InvId,
0147   RtemsTaskReqRestart_Post_Status_IncStat,
0148   RtemsTaskReqRestart_Post_Status_NoReturn,
0149   RtemsTaskReqRestart_Post_Status_NA
0150 } RtemsTaskReqRestart_Post_Status;
0151 
0152 typedef enum {
0153   RtemsTaskReqRestart_Post_FatalError_Yes,
0154   RtemsTaskReqRestart_Post_FatalError_Nop,
0155   RtemsTaskReqRestart_Post_FatalError_NA
0156 } RtemsTaskReqRestart_Post_FatalError;
0157 
0158 typedef enum {
0159   RtemsTaskReqRestart_Post_Argument_Set,
0160   RtemsTaskReqRestart_Post_Argument_Nop,
0161   RtemsTaskReqRestart_Post_Argument_NA
0162 } RtemsTaskReqRestart_Post_Argument;
0163 
0164 typedef enum {
0165   RtemsTaskReqRestart_Post_State_Dormant,
0166   RtemsTaskReqRestart_Post_State_DormantSuspended,
0167   RtemsTaskReqRestart_Post_State_Blocked,
0168   RtemsTaskReqRestart_Post_State_Ready,
0169   RtemsTaskReqRestart_Post_State_Zombie,
0170   RtemsTaskReqRestart_Post_State_Nop,
0171   RtemsTaskReqRestart_Post_State_NA
0172 } RtemsTaskReqRestart_Post_State;
0173 
0174 typedef enum {
0175   RtemsTaskReqRestart_Post_Enqueued_Yes,
0176   RtemsTaskReqRestart_Post_Enqueued_No,
0177   RtemsTaskReqRestart_Post_Enqueued_NA
0178 } RtemsTaskReqRestart_Post_Enqueued;
0179 
0180 typedef enum {
0181   RtemsTaskReqRestart_Post_Timer_Active,
0182   RtemsTaskReqRestart_Post_Timer_Inactive,
0183   RtemsTaskReqRestart_Post_Timer_NA
0184 } RtemsTaskReqRestart_Post_Timer;
0185 
0186 typedef enum {
0187   RtemsTaskReqRestart_Post_Restarting_Yes,
0188   RtemsTaskReqRestart_Post_Restarting_No,
0189   RtemsTaskReqRestart_Post_Restarting_NA
0190 } RtemsTaskReqRestart_Post_Restarting;
0191 
0192 typedef enum {
0193   RtemsTaskReqRestart_Post_Terminating_Yes,
0194   RtemsTaskReqRestart_Post_Terminating_No,
0195   RtemsTaskReqRestart_Post_Terminating_NA
0196 } RtemsTaskReqRestart_Post_Terminating;
0197 
0198 typedef enum {
0199   RtemsTaskReqRestart_Post_Protected_Yes,
0200   RtemsTaskReqRestart_Post_Protected_No,
0201   RtemsTaskReqRestart_Post_Protected_NA
0202 } RtemsTaskReqRestart_Post_Protected;
0203 
0204 typedef enum {
0205   RtemsTaskReqRestart_Post_RestartExtensions_Yes,
0206   RtemsTaskReqRestart_Post_RestartExtensions_Nop,
0207   RtemsTaskReqRestart_Post_RestartExtensions_NA
0208 } RtemsTaskReqRestart_Post_RestartExtensions;
0209 
0210 typedef enum {
0211   RtemsTaskReqRestart_Post_TerminateExtensions_Yes,
0212   RtemsTaskReqRestart_Post_TerminateExtensions_Nop,
0213   RtemsTaskReqRestart_Post_TerminateExtensions_NA
0214 } RtemsTaskReqRestart_Post_TerminateExtensions;
0215 
0216 typedef struct {
0217   uint64_t Skip : 1;
0218   uint64_t Pre_Id_NA : 1;
0219   uint64_t Pre_Dormant_NA : 1;
0220   uint64_t Pre_Suspended_NA : 1;
0221   uint64_t Pre_Restarting_NA : 1;
0222   uint64_t Pre_Terminating_NA : 1;
0223   uint64_t Pre_Protected_NA : 1;
0224   uint64_t Pre_Context_NA : 1;
0225   uint64_t Pre_State_NA : 1;
0226   uint64_t Pre_Timer_NA : 1;
0227   uint64_t Pre_RealPriority_NA : 1;
0228   uint64_t Pre_ThreadDispatch_NA : 1;
0229   uint64_t Post_Status : 3;
0230   uint64_t Post_FatalError : 2;
0231   uint64_t Post_Argument : 2;
0232   uint64_t Post_State : 3;
0233   uint64_t Post_Enqueued : 2;
0234   uint64_t Post_Timer : 2;
0235   uint64_t Post_Restarting : 2;
0236   uint64_t Post_Terminating : 2;
0237   uint64_t Post_Protected : 2;
0238   uint64_t Post_RestartExtensions : 2;
0239   uint64_t Post_TerminateExtensions : 2;
0240 } RtemsTaskReqRestart_Entry;
0241 
0242 /**
0243  * @brief Test context for spec:/rtems/task/req/restart test case.
0244  */
0245 typedef struct {
0246   /**
0247    * @brief This member provides the scheduler operation records.
0248    */
0249   T_scheduler_log_10 scheduler_log;
0250 
0251   /**
0252    * @brief This member provides a jump context to resume a thread dispatch.
0253    */
0254   jmp_buf thread_dispatch_context;
0255 
0256   /**
0257    * @brief This member provides the context to wrap thread queue operations.
0258    */
0259   WrapThreadQueueContext wrap_tq_ctx;
0260 
0261   /**
0262    * @brief This member contains the identifier of the runner scheduler.
0263    */
0264   rtems_id scheduler_id;
0265 
0266   /**
0267    * @brief This member contains the identifier of the runner task.
0268    */
0269   rtems_id runner_id;
0270 
0271   /**
0272    * @brief This member contains the identifier of the mutex.
0273    */
0274   rtems_id mutex_id;
0275 
0276   /**
0277    * @brief This member provides an event set used to set up the blocking
0278    *   conditions of the task to restart.
0279    */
0280   rtems_event_set events;
0281 
0282   /**
0283    * @brief This member contains the identifier of the worker task.
0284    */
0285   rtems_id worker_id;
0286 
0287   /**
0288    * @brief This member references the TCB of the worker task.
0289    */
0290   rtems_tcb *worker_tcb;
0291 
0292   /**
0293    * @brief This member contains the worker state at the end of the
0294    *   rtems_task_restart() call.
0295    */
0296   States_Control worker_state;
0297 
0298   /**
0299    * @brief This member contains the worker thread life state at the end of the
0300    *   rtems_task_restart() call.
0301    */
0302   Thread_Life_state worker_life_state;
0303 
0304   /**
0305    * @brief This member contains the identifier of the deleter task.
0306    */
0307   rtems_id deleter_id;
0308 
0309   /**
0310    * @brief This member references the TCB of the deleter task.
0311    */
0312   rtems_tcb *deleter_tcb;
0313 
0314   /**
0315    * @brief This member contains the identifier of the test user extensions.
0316    */
0317   rtems_id extension_id;
0318 
0319   /**
0320    * @brief This member contains extension calls.
0321    */
0322   ExtensionCalls calls;
0323 
0324   /**
0325    * @brief This member contains extension calls after the rtems_task_restart()
0326    *   call.
0327    */
0328   ExtensionCalls calls_after_restart;
0329 
0330   /**
0331    * @brief This member contains the actual argument passed to the entry point.
0332    */
0333   rtems_task_argument actual_argument;
0334 
0335   /**
0336    * @brief This member contains the restart counter.
0337    */
0338   uint32_t restart_counter;
0339 
0340   /**
0341    * @brief If this member is true, then the worker shall be dormant before the
0342    *   rtems_task_restart() call.
0343    */
0344   bool dormant;
0345 
0346   /**
0347    * @brief If this member is true, then the worker shall be suspended before
0348    *   the rtems_task_restart() call.
0349    */
0350   bool suspended;
0351 
0352   /**
0353    * @brief If this member is true, then the thread life of the worker shall be
0354    *   protected before the rtems_task_restart() call.
0355    */
0356   bool protected;
0357 
0358   /**
0359    * @brief If this member is true, then the worker shall be restarting before
0360    *   the rtems_task_restart() call.
0361    */
0362   bool restarting;
0363 
0364   /**
0365    * @brief If this member is true, then the worker shall be terminating before
0366    *   the rtems_task_restart() call.
0367    */
0368   bool terminating;
0369 
0370   /**
0371    * @brief If this member is true, then the rtems_task_restart() shall be
0372    *   called from within interrupt context.
0373    */
0374   bool interrupt;
0375 
0376   /**
0377    * @brief If this member is true, then the rtems_task_restart() shall be
0378    *   called during another rtems_task_restart() call with the same task as a
0379    *   nested request.
0380    */
0381   bool nested_request;
0382 
0383   /**
0384    * @brief If this member is true, then the worker shall be blocked before the
0385    *   rtems_task_restart() call.
0386    */
0387   bool blocked;
0388 
0389   /**
0390    * @brief If this member is true, then the worker shall be enqueued on a wait
0391    *   queue before the rtems_task_restart() call.
0392    */
0393   bool enqueued;
0394 
0395   /**
0396    * @brief If this member is true, then the timer of the worker shall be
0397    *   active before the rtems_task_restart() call.
0398    */
0399   bool timer_active;
0400 
0401   /**
0402    * @brief If this member is true, then the real priority of the worker shall
0403    *   be equal to its initial priority before the rtems_task_restart() call.
0404    */
0405   bool real_priority_is_initial;
0406 
0407   /**
0408    * @brief If this member is true, then thread dispatching is disabled by the
0409    *   worker task before the rtems_task_restart() call.
0410    */
0411   bool dispatch_disabled;
0412 
0413   /**
0414    * @brief If this member is true, then it is expected to delete the worker.
0415    */
0416   bool delete_worker_expected;
0417 
0418   /**
0419    * @brief This member contains the return value of the rtems_task_restart()
0420    *   call.
0421    */
0422   rtems_status_code status;
0423 
0424   /**
0425    * @brief This member specifies if the ``id`` parameter value.
0426    */
0427   rtems_id id;
0428 
0429   struct {
0430     /**
0431      * @brief This member defines the pre-condition indices for the next
0432      *   action.
0433      */
0434     size_t pci[ 11 ];
0435 
0436     /**
0437      * @brief This member defines the pre-condition states for the next action.
0438      */
0439     size_t pcs[ 11 ];
0440 
0441     /**
0442      * @brief If this member is true, then the test action loop is executed.
0443      */
0444     bool in_action_loop;
0445 
0446     /**
0447      * @brief This member contains the next transition map index.
0448      */
0449     size_t index;
0450 
0451     /**
0452      * @brief This member contains the current transition map entry.
0453      */
0454     RtemsTaskReqRestart_Entry entry;
0455 
0456     /**
0457      * @brief If this member is true, then the current transition variant
0458      *   should be skipped.
0459      */
0460     bool skip;
0461   } Map;
0462 } RtemsTaskReqRestart_Context;
0463 
0464 static RtemsTaskReqRestart_Context
0465   RtemsTaskReqRestart_Instance;
0466 
0467 static const char * const RtemsTaskReqRestart_PreDesc_Id[] = {
0468   "Invalid",
0469   "Executing",
0470   "Other",
0471   "NA"
0472 };
0473 
0474 static const char * const RtemsTaskReqRestart_PreDesc_Dormant[] = {
0475   "Yes",
0476   "No",
0477   "NA"
0478 };
0479 
0480 static const char * const RtemsTaskReqRestart_PreDesc_Suspended[] = {
0481   "Yes",
0482   "No",
0483   "NA"
0484 };
0485 
0486 static const char * const RtemsTaskReqRestart_PreDesc_Restarting[] = {
0487   "Yes",
0488   "No",
0489   "NA"
0490 };
0491 
0492 static const char * const RtemsTaskReqRestart_PreDesc_Terminating[] = {
0493   "Yes",
0494   "No",
0495   "NA"
0496 };
0497 
0498 static const char * const RtemsTaskReqRestart_PreDesc_Protected[] = {
0499   "Yes",
0500   "No",
0501   "NA"
0502 };
0503 
0504 static const char * const RtemsTaskReqRestart_PreDesc_Context[] = {
0505   "Task",
0506   "Interrupt",
0507   "NestedRequest",
0508   "NA"
0509 };
0510 
0511 static const char * const RtemsTaskReqRestart_PreDesc_State[] = {
0512   "Ready",
0513   "Blocked",
0514   "Enqueued",
0515   "NA"
0516 };
0517 
0518 static const char * const RtemsTaskReqRestart_PreDesc_Timer[] = {
0519   "Inactive",
0520   "Active",
0521   "NA"
0522 };
0523 
0524 static const char * const RtemsTaskReqRestart_PreDesc_RealPriority[] = {
0525   "Initial",
0526   "Changed",
0527   "NA"
0528 };
0529 
0530 static const char * const RtemsTaskReqRestart_PreDesc_ThreadDispatch[] = {
0531   "Disabled",
0532   "Enabled",
0533   "NA"
0534 };
0535 
0536 static const char * const * const RtemsTaskReqRestart_PreDesc[] = {
0537   RtemsTaskReqRestart_PreDesc_Id,
0538   RtemsTaskReqRestart_PreDesc_Dormant,
0539   RtemsTaskReqRestart_PreDesc_Suspended,
0540   RtemsTaskReqRestart_PreDesc_Restarting,
0541   RtemsTaskReqRestart_PreDesc_Terminating,
0542   RtemsTaskReqRestart_PreDesc_Protected,
0543   RtemsTaskReqRestart_PreDesc_Context,
0544   RtemsTaskReqRestart_PreDesc_State,
0545   RtemsTaskReqRestart_PreDesc_Timer,
0546   RtemsTaskReqRestart_PreDesc_RealPriority,
0547   RtemsTaskReqRestart_PreDesc_ThreadDispatch,
0548   NULL
0549 };
0550 
0551 #if CPU_SIZEOF_POINTER > 4
0552 #define RESTART_ARGUMENT 0xfedcba0987654321U
0553 #else
0554 #define RESTART_ARGUMENT 0x87654321U
0555 #endif
0556 
0557 #define UNSET_ARGUMENT 1
0558 
0559 typedef RtemsTaskReqRestart_Context Context;
0560 
0561 static void PrepareRealPriority( Context *ctx )
0562 {
0563   if ( !ctx->real_priority_is_initial ) {
0564     SetScheduler( ctx->worker_id, ctx->scheduler_id, PRIO_LOW );
0565     SetPriority( ctx->worker_id, PRIO_NORMAL );
0566   }
0567 }
0568 
0569 static void CaptureWorkerState( Context *ctx )
0570 {
0571   T_scheduler_log *log;
0572 
0573   log = T_scheduler_record( NULL );
0574 
0575   if ( log != NULL ) {
0576     T_eq_ptr( &log->header, &ctx->scheduler_log.header );
0577 
0578     ctx->worker_state = ctx->worker_tcb->current_state;
0579     ctx->worker_life_state = ctx->worker_tcb->Life.state;
0580     CopyExtensionCalls( &ctx->calls, &ctx->calls_after_restart );
0581   }
0582 }
0583 
0584 static void VerifyTaskPreparation( const Context *ctx )
0585 {
0586   if ( ctx->id != INVALID_ID ) {
0587     States_Control state;
0588     Thread_Life_state life_state;
0589 
0590     state = STATES_READY;
0591     life_state = ctx->worker_tcb->Life.state;
0592 
0593     if ( ctx->suspended ) {
0594       state |= STATES_SUSPENDED;
0595     }
0596 
0597     if ( ctx->dormant ) {
0598       T_eq_int( life_state, 0 );
0599       state |= STATES_DORMANT;
0600     } else {
0601       T_eq( ctx->protected, ( life_state & THREAD_LIFE_PROTECTED ) != 0 );
0602       T_eq( ctx->restarting, ( life_state & THREAD_LIFE_RESTARTING ) != 0 );
0603       T_eq( ctx->terminating, ( life_state & THREAD_LIFE_TERMINATING ) != 0 );
0604 
0605       if ( ctx->blocked ) {
0606         if ( ctx->enqueued ) {
0607           state |= STATES_WAITING_FOR_MUTEX;
0608         } else {
0609           state |= STATES_WAITING_FOR_EVENT;
0610         }
0611       }
0612 
0613       if ( ctx->nested_request ) {
0614         state |= STATES_LIFE_IS_CHANGING;
0615       }
0616     }
0617 
0618     T_eq_u32( ctx->worker_tcb->current_state, state );
0619   }
0620 }
0621 
0622 static void Restart( void *arg )
0623 {
0624   Context         *ctx;
0625   T_scheduler_log *log;
0626 
0627   ctx = arg;
0628 
0629   if ( ctx->suspended && ctx->id != INVALID_ID ) {
0630     if ( ctx->id != RTEMS_SELF || ctx->interrupt ) {
0631       SuspendTask( ctx->worker_id );
0632     } else {
0633       Per_CPU_Control *cpu_self;
0634 
0635       /*
0636        * Where the system was built with SMP support enabled, a suspended
0637        * executing thread during the rtems_task_restart() call can happen
0638        * if the thread was suspended by another processor and the
0639        * inter-processor interrupt did not yet arrive.  Where the system was
0640        * built with SMP support disabled, this state cannot happen with the
0641        * current implementation.  However, we still specify and validate this
0642        * behaviour unconditionally since there exist alternative
0643        * implementations which would lead to such a state if the executing
0644        * thread is suspended by an ISR.
0645        */
0646       cpu_self = _Thread_Dispatch_disable();
0647       SuspendSelf();
0648       cpu_self->dispatch_necessary = false;
0649       _Thread_Dispatch_enable( cpu_self );
0650     }
0651   }
0652 
0653   if ( ctx->dispatch_disabled ) {
0654     _Thread_Dispatch_disable();
0655   }
0656 
0657   VerifyTaskPreparation( ctx );
0658   ClearExtensionCalls( &ctx->calls );
0659 
0660   log = T_scheduler_record_10( &ctx->scheduler_log );
0661   T_null( log );
0662 
0663   ctx->status = rtems_task_restart( ctx->id, RESTART_ARGUMENT );
0664 
0665   CaptureWorkerState( ctx );
0666 
0667   if ( ctx->dispatch_disabled ) {
0668     _Thread_Dispatch_enable( _Per_CPU_Get() );
0669   }
0670 }
0671 
0672 static void Block( Context *ctx )
0673 {
0674   rtems_interval ticks;
0675 
0676   if ( ctx->timer_active ) {
0677     ticks = UINT32_MAX;
0678   } else {
0679     ticks = RTEMS_NO_TIMEOUT;
0680   }
0681 
0682   if ( ctx->enqueued ) {
0683     ObtainMutexTimed( ctx->mutex_id, ticks );
0684   } else {
0685     /*
0686      * Do not use a stack variable for the event set, since we may jump out
0687      * of the directive call.
0688      */
0689     (void) rtems_event_receive(
0690       RTEMS_ALL_EVENTS,
0691       RTEMS_EVENT_ANY | RTEMS_WAIT,
0692       ticks,
0693       &ctx->events
0694     );
0695   }
0696 }
0697 
0698 static void BlockDone( const Context *ctx )
0699 {
0700   if ( ctx->enqueued ) {
0701     ReleaseMutex( ctx->mutex_id );
0702   }
0703 }
0704 
0705 static void Fatal(
0706   rtems_fatal_source source,
0707   rtems_fatal_code   code,
0708   void              *arg
0709 )
0710 {
0711   Context         *ctx;
0712   Per_CPU_Control *cpu_self;
0713 
0714   T_eq_int( source, INTERNAL_ERROR_CORE );
0715   T_eq_ulong( code, INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL );
0716 
0717   ctx = arg;
0718   ++ctx->calls.fatal;
0719   T_assert_eq_int( ctx->calls.fatal, 1 );
0720 
0721   CaptureWorkerState( ctx );
0722 
0723   _ISR_Set_level( 0 );
0724   cpu_self = _Per_CPU_Get();
0725   _Thread_Dispatch_unnest( cpu_self );
0726   _Thread_Dispatch_direct_no_return( cpu_self );
0727 }
0728 
0729 static void ResumeThreadDispatch(
0730   rtems_fatal_source source,
0731   rtems_fatal_code   code,
0732   void              *arg
0733 )
0734 {
0735   Context *ctx;
0736 
0737   T_eq_int( source, INTERNAL_ERROR_CORE );
0738   T_eq_ulong( code, INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL );
0739 
0740   ctx = arg;
0741   SetFatalHandler( Fatal, ctx );
0742   _ISR_Set_level( 0 );
0743   longjmp( ctx->thread_dispatch_context, 1 );
0744 }
0745 
0746 static void TriggerNestedRequestViaSelfRestart(
0747   Context         *ctx,
0748   Per_CPU_Control *cpu_self
0749 )
0750 {
0751   WrapThreadQueueExtract( &ctx->wrap_tq_ctx, ctx->worker_tcb );
0752   SetFatalHandler( ResumeThreadDispatch, ctx );
0753 
0754   if ( setjmp( ctx->thread_dispatch_context ) == 0 ) {
0755     (void) rtems_task_restart(
0756       RTEMS_SELF,
0757       (rtems_task_argument) ctx
0758     );
0759   } else {
0760     _Thread_Dispatch_unnest( cpu_self );
0761   }
0762 }
0763 
0764 static void Signal( rtems_signal_set signals )
0765 {
0766   Context *ctx;
0767 
0768   (void) signals;
0769   ctx = T_fixture_context();
0770 
0771   if ( ctx->id == RTEMS_SELF ) {
0772     Per_CPU_Control *cpu_self;
0773 
0774     SetPriority( ctx->runner_id, PRIO_VERY_LOW );
0775     SetPriority( ctx->deleter_id, PRIO_VERY_LOW );
0776 
0777     if ( ctx->interrupt || ctx->nested_request ) {
0778       if ( ctx->blocked ) {
0779         SetFatalHandler( ResumeThreadDispatch, ctx );
0780         cpu_self = _Thread_Dispatch_disable();
0781 
0782         if ( setjmp( ctx->thread_dispatch_context ) == 0 ) {
0783           Block( ctx );
0784         } else {
0785           _Thread_Dispatch_unnest( cpu_self );
0786         }
0787 
0788         if ( ctx->interrupt ) {
0789           CallWithinISR( Restart, ctx );
0790         } else {
0791           TriggerNestedRequestViaSelfRestart( ctx, cpu_self );
0792         }
0793 
0794         _Thread_Dispatch_direct( cpu_self );
0795         BlockDone( ctx );
0796       } else {
0797         if ( ctx->interrupt ) {
0798           CallWithinISR( Restart, ctx );
0799         } else {
0800           cpu_self = _Thread_Dispatch_disable();
0801           TriggerNestedRequestViaSelfRestart( ctx, cpu_self );
0802           _Thread_Dispatch_direct( cpu_self );
0803         }
0804       }
0805     } else {
0806       Restart( ctx );
0807     }
0808   } else {
0809     if ( ctx->blocked ) {
0810       Block( ctx );
0811       BlockDone( ctx );
0812     } else if ( ctx->nested_request ) {
0813       Yield();
0814     } else {
0815       SetPriority( ctx->runner_id, PRIO_VERY_HIGH );
0816     }
0817   }
0818 
0819   if ( ctx->protected ) {
0820     _Thread_Set_life_protection( 0 );
0821   }
0822 }
0823 
0824 static void Deleter( rtems_task_argument arg )
0825 {
0826   Context *ctx;
0827 
0828   ctx = (Context *) arg;
0829 
0830   if ( ctx != NULL ) {
0831     if ( ctx->real_priority_is_initial ) {
0832       /*
0833        * We have to prevent a potential priority boost in the task delete
0834        * below.
0835        */
0836       if ( ctx->nested_request ) {
0837         /* Lower the priority to PRIO_NORMAL without an * implicit yield */
0838         SetSelfPriorityNoYield( PRIO_NORMAL );
0839       } else {
0840         SetScheduler( ctx->worker_id, ctx->scheduler_id, PRIO_HIGH );
0841       }
0842     }
0843 
0844     if ( ctx->nested_request ) {
0845       WrapThreadQueueExtract( &ctx->wrap_tq_ctx, ctx->worker_tcb );
0846       DeleteTask( ctx->worker_id );
0847     } else {
0848       DeleteTask( ctx->worker_id );
0849     }
0850   }
0851 
0852   SuspendSelf();
0853 }
0854 
0855 static void Worker( rtems_task_argument arg )
0856 {
0857   Context          *ctx;
0858   rtems_status_code sc;
0859 
0860   ctx = T_fixture_context();
0861 
0862   if ( arg == 0 ) {
0863     sc = rtems_signal_catch( Signal, RTEMS_NO_ASR );
0864     T_rsc_success( sc );
0865 
0866     if ( ctx->protected ) {
0867       _Thread_Set_life_protection( THREAD_LIFE_PROTECTED );
0868     }
0869 
0870     Yield();
0871   } else {
0872     ctx->actual_argument = arg;
0873     ++ctx->restart_counter;
0874 
0875     CaptureWorkerState( ctx );
0876     SuspendSelf();
0877   }
0878 }
0879 
0880 static void ThreadDelete( rtems_tcb *executing, rtems_tcb *deleted )
0881 {
0882   Context *ctx;
0883 
0884   ctx = T_fixture_context();
0885   ++ctx->calls.thread_delete;
0886 
0887   T_eq_u32( executing->Object.id, ctx->runner_id );
0888 
0889   if ( ctx->delete_worker_expected ) {
0890     T_eq_u32( deleted->Object.id, ctx->worker_id );
0891   }
0892 }
0893 
0894 static void ThreadRestart( rtems_tcb *executing, rtems_tcb *restarted )
0895 {
0896   Context *ctx;
0897 
0898   ctx = T_fixture_context();
0899   ++ctx->calls.thread_restart;
0900 }
0901 
0902 static void ThreadTerminate( rtems_tcb *executing )
0903 {
0904   Context *ctx;
0905 
0906   ctx = T_fixture_context();
0907   ++ctx->calls.thread_terminate;
0908 
0909   T_eq_u32( executing->Object.id, ctx->worker_id );
0910 }
0911 
0912 static const rtems_extensions_table extensions = {
0913   .thread_delete = ThreadDelete,
0914   .thread_restart = ThreadRestart,
0915   .thread_terminate = ThreadTerminate
0916 };
0917 
0918 static void RtemsTaskReqRestart_Pre_Id_Prepare(
0919   RtemsTaskReqRestart_Context *ctx,
0920   RtemsTaskReqRestart_Pre_Id   state
0921 )
0922 {
0923   switch ( state ) {
0924     case RtemsTaskReqRestart_Pre_Id_Invalid: {
0925       /*
0926        * While the ``id`` parameter is not associated with a task.
0927        */
0928       ctx->id = INVALID_ID;
0929       break;
0930     }
0931 
0932     case RtemsTaskReqRestart_Pre_Id_Executing: {
0933       /*
0934        * While the ``id`` parameter is associated with the calling task.
0935        */
0936       ctx->id = RTEMS_SELF;
0937       break;
0938     }
0939 
0940     case RtemsTaskReqRestart_Pre_Id_Other: {
0941       /*
0942        * While the ``id`` parameter is associated with a task other than the
0943        * calling task.
0944        */
0945       ctx->id = ctx->worker_id;
0946       break;
0947     }
0948 
0949     case RtemsTaskReqRestart_Pre_Id_NA:
0950       break;
0951   }
0952 }
0953 
0954 static void RtemsTaskReqRestart_Pre_Dormant_Prepare(
0955   RtemsTaskReqRestart_Context    *ctx,
0956   RtemsTaskReqRestart_Pre_Dormant state
0957 )
0958 {
0959   switch ( state ) {
0960     case RtemsTaskReqRestart_Pre_Dormant_Yes: {
0961       /*
0962        * While the task specified by the ``id`` parameter is dormant.
0963        */
0964       ctx->dormant = true;
0965       break;
0966     }
0967 
0968     case RtemsTaskReqRestart_Pre_Dormant_No: {
0969       /*
0970        * While the task specified by the ``id`` parameter is not dormant.
0971        */
0972       ctx->dormant = false;
0973       break;
0974     }
0975 
0976     case RtemsTaskReqRestart_Pre_Dormant_NA:
0977       break;
0978   }
0979 }
0980 
0981 static void RtemsTaskReqRestart_Pre_Suspended_Prepare(
0982   RtemsTaskReqRestart_Context      *ctx,
0983   RtemsTaskReqRestart_Pre_Suspended state
0984 )
0985 {
0986   switch ( state ) {
0987     case RtemsTaskReqRestart_Pre_Suspended_Yes: {
0988       /*
0989        * While the task specified by the ``id`` parameter is suspended.
0990        */
0991       ctx->suspended = true;
0992       break;
0993     }
0994 
0995     case RtemsTaskReqRestart_Pre_Suspended_No: {
0996       /*
0997        * While the task specified by the ``id`` parameter is not suspended.
0998        */
0999       ctx->suspended = false;
1000       break;
1001     }
1002 
1003     case RtemsTaskReqRestart_Pre_Suspended_NA:
1004       break;
1005   }
1006 }
1007 
1008 static void RtemsTaskReqRestart_Pre_Restarting_Prepare(
1009   RtemsTaskReqRestart_Context       *ctx,
1010   RtemsTaskReqRestart_Pre_Restarting state
1011 )
1012 {
1013   switch ( state ) {
1014     case RtemsTaskReqRestart_Pre_Restarting_Yes: {
1015       /*
1016        * While the task specified by the ``id`` parameter is restarting.
1017        */
1018       ctx->restarting = true;
1019       break;
1020     }
1021 
1022     case RtemsTaskReqRestart_Pre_Restarting_No: {
1023       /*
1024        * While the task specified by the ``id`` parameter is not restarting.
1025        */
1026       ctx->restarting = false;
1027       break;
1028     }
1029 
1030     case RtemsTaskReqRestart_Pre_Restarting_NA:
1031       break;
1032   }
1033 }
1034 
1035 static void RtemsTaskReqRestart_Pre_Terminating_Prepare(
1036   RtemsTaskReqRestart_Context        *ctx,
1037   RtemsTaskReqRestart_Pre_Terminating state
1038 )
1039 {
1040   switch ( state ) {
1041     case RtemsTaskReqRestart_Pre_Terminating_Yes: {
1042       /*
1043        * While the task specified by the ``id`` parameter is terminating.
1044        */
1045       ctx->terminating = true;
1046       break;
1047     }
1048 
1049     case RtemsTaskReqRestart_Pre_Terminating_No: {
1050       /*
1051        * While the task specified by the ``id`` parameter is not terminating.
1052        */
1053       ctx->terminating = false;
1054       break;
1055     }
1056 
1057     case RtemsTaskReqRestart_Pre_Terminating_NA:
1058       break;
1059   }
1060 }
1061 
1062 static void RtemsTaskReqRestart_Pre_Protected_Prepare(
1063   RtemsTaskReqRestart_Context      *ctx,
1064   RtemsTaskReqRestart_Pre_Protected state
1065 )
1066 {
1067   switch ( state ) {
1068     case RtemsTaskReqRestart_Pre_Protected_Yes: {
1069       /*
1070        * While thread life of the task specified by the ``id`` parameter is
1071        * protected.
1072        */
1073       ctx->protected = true;
1074       break;
1075     }
1076 
1077     case RtemsTaskReqRestart_Pre_Protected_No: {
1078       /*
1079        * While thread life of the task specified by the ``id`` parameter is not
1080        * protected.
1081        */
1082       ctx->protected = false;
1083       break;
1084     }
1085 
1086     case RtemsTaskReqRestart_Pre_Protected_NA:
1087       break;
1088   }
1089 }
1090 
1091 static void RtemsTaskReqRestart_Pre_Context_Prepare(
1092   RtemsTaskReqRestart_Context    *ctx,
1093   RtemsTaskReqRestart_Pre_Context state
1094 )
1095 {
1096   switch ( state ) {
1097     case RtemsTaskReqRestart_Pre_Context_Task: {
1098       /*
1099        * While the rtems_task_restart() directive is called from within task
1100        * context.
1101        */
1102       ctx->interrupt = false;
1103       ctx->nested_request = false;
1104       break;
1105     }
1106 
1107     case RtemsTaskReqRestart_Pre_Context_Interrupt: {
1108       /*
1109        * While the rtems_task_restart() directive is called from within
1110        * interrupt context.
1111        */
1112       ctx->interrupt = true;
1113       ctx->nested_request = false;
1114       break;
1115     }
1116 
1117     case RtemsTaskReqRestart_Pre_Context_NestedRequest: {
1118       /*
1119        * While the rtems_task_restart() directive is called during another
1120        * rtems_task_restart() call with the same task as a nested request.
1121        */
1122       ctx->interrupt = false;
1123       ctx->nested_request = true;
1124       break;
1125     }
1126 
1127     case RtemsTaskReqRestart_Pre_Context_NA:
1128       break;
1129   }
1130 }
1131 
1132 static void RtemsTaskReqRestart_Pre_State_Prepare(
1133   RtemsTaskReqRestart_Context  *ctx,
1134   RtemsTaskReqRestart_Pre_State state
1135 )
1136 {
1137   switch ( state ) {
1138     case RtemsTaskReqRestart_Pre_State_Ready: {
1139       /*
1140        * While the task specified by the ``id`` parameter is a ready task or
1141        * scheduled task.
1142        */
1143       ctx->blocked = false;
1144       break;
1145     }
1146 
1147     case RtemsTaskReqRestart_Pre_State_Blocked: {
1148       /*
1149        * While the task specified by the ``id`` parameter is blocked.
1150        */
1151       ctx->blocked = true;
1152       ctx->enqueued = false;
1153       break;
1154     }
1155 
1156     case RtemsTaskReqRestart_Pre_State_Enqueued: {
1157       /*
1158        * While the task specified by the ``id`` parameter is enqueued on a wait
1159        * queue.
1160        */
1161       ctx->blocked = true;
1162       ctx->enqueued = true;
1163       break;
1164     }
1165 
1166     case RtemsTaskReqRestart_Pre_State_NA:
1167       break;
1168   }
1169 }
1170 
1171 static void RtemsTaskReqRestart_Pre_Timer_Prepare(
1172   RtemsTaskReqRestart_Context  *ctx,
1173   RtemsTaskReqRestart_Pre_Timer state
1174 )
1175 {
1176   switch ( state ) {
1177     case RtemsTaskReqRestart_Pre_Timer_Inactive: {
1178       /*
1179        * While timer of the task specified by the ``id`` parameter is inactive.
1180        */
1181       ctx->timer_active = false;
1182       break;
1183     }
1184 
1185     case RtemsTaskReqRestart_Pre_Timer_Active: {
1186       /*
1187        * While timer of the task specified by the ``id`` parameter is active.
1188        */
1189       ctx->timer_active = true;
1190       break;
1191     }
1192 
1193     case RtemsTaskReqRestart_Pre_Timer_NA:
1194       break;
1195   }
1196 }
1197 
1198 static void RtemsTaskReqRestart_Pre_RealPriority_Prepare(
1199   RtemsTaskReqRestart_Context         *ctx,
1200   RtemsTaskReqRestart_Pre_RealPriority state
1201 )
1202 {
1203   switch ( state ) {
1204     case RtemsTaskReqRestart_Pre_RealPriority_Initial: {
1205       /*
1206        * While real priority of the task specified by the ``id`` parameter is
1207        * equal to the initial priority.
1208        */
1209       ctx->real_priority_is_initial = true;
1210       break;
1211     }
1212 
1213     case RtemsTaskReqRestart_Pre_RealPriority_Changed: {
1214       /*
1215        * While real priority of the task specified by the ``id`` parameter is
1216        * not equal to the initial priority.
1217        */
1218       ctx->real_priority_is_initial = false;
1219       break;
1220     }
1221 
1222     case RtemsTaskReqRestart_Pre_RealPriority_NA:
1223       break;
1224   }
1225 }
1226 
1227 static void RtemsTaskReqRestart_Pre_ThreadDispatch_Prepare(
1228   RtemsTaskReqRestart_Context           *ctx,
1229   RtemsTaskReqRestart_Pre_ThreadDispatch state
1230 )
1231 {
1232   switch ( state ) {
1233     case RtemsTaskReqRestart_Pre_ThreadDispatch_Disabled: {
1234       /*
1235        * While thread dispatching is disabled for the calling task.
1236        */
1237       ctx->dispatch_disabled = true;
1238       break;
1239     }
1240 
1241     case RtemsTaskReqRestart_Pre_ThreadDispatch_Enabled: {
1242       /*
1243        * While thread dispatching is enabled for the calling task.
1244        */
1245       ctx->dispatch_disabled = false;
1246       break;
1247     }
1248 
1249     case RtemsTaskReqRestart_Pre_ThreadDispatch_NA:
1250       break;
1251   }
1252 }
1253 
1254 static void RtemsTaskReqRestart_Post_Status_Check(
1255   RtemsTaskReqRestart_Context    *ctx,
1256   RtemsTaskReqRestart_Post_Status state
1257 )
1258 {
1259   switch ( state ) {
1260     case RtemsTaskReqRestart_Post_Status_Ok: {
1261       /*
1262        * The return status of rtems_task_restart() shall be RTEMS_SUCCESSFUL.
1263        */
1264       T_rsc_success( ctx->status );
1265       break;
1266     }
1267 
1268     case RtemsTaskReqRestart_Post_Status_InvId: {
1269       /*
1270        * The return status of rtems_task_restart() shall be RTEMS_INVALID_ID.
1271        */
1272       T_rsc( ctx->status, RTEMS_INVALID_ID );
1273       break;
1274     }
1275 
1276     case RtemsTaskReqRestart_Post_Status_IncStat: {
1277       /*
1278        * The return status of rtems_task_restart() shall be
1279        * RTEMS_INCORRECT_STATE.
1280        */
1281       T_rsc( ctx->status, RTEMS_INCORRECT_STATE );
1282       break;
1283     }
1284 
1285     case RtemsTaskReqRestart_Post_Status_NoReturn: {
1286       /*
1287        * The rtems_task_restart() call shall not return.
1288        */
1289       T_rsc( ctx->status, RTEMS_NOT_IMPLEMENTED );
1290       break;
1291     }
1292 
1293     case RtemsTaskReqRestart_Post_Status_NA:
1294       break;
1295   }
1296 }
1297 
1298 static void RtemsTaskReqRestart_Post_FatalError_Check(
1299   RtemsTaskReqRestart_Context        *ctx,
1300   RtemsTaskReqRestart_Post_FatalError state
1301 )
1302 {
1303   switch ( state ) {
1304     case RtemsTaskReqRestart_Post_FatalError_Yes: {
1305       /*
1306        * The fatal error with a fatal source of INTERNAL_ERROR_CORE and a fatal
1307        * code of INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL shall occur
1308        * through the rtems_task_restart() call.
1309        */
1310       T_eq_u32( ctx->calls.fatal, 1 );
1311       break;
1312     }
1313 
1314     case RtemsTaskReqRestart_Post_FatalError_Nop: {
1315       /*
1316        * No fatal error shall occur through the rtems_task_restart() call.
1317        */
1318       T_eq_u32( ctx->calls.fatal, 0 );
1319       break;
1320     }
1321 
1322     case RtemsTaskReqRestart_Post_FatalError_NA:
1323       break;
1324   }
1325 }
1326 
1327 static void RtemsTaskReqRestart_Post_Argument_Check(
1328   RtemsTaskReqRestart_Context      *ctx,
1329   RtemsTaskReqRestart_Post_Argument state
1330 )
1331 {
1332   switch ( state ) {
1333     case RtemsTaskReqRestart_Post_Argument_Set: {
1334       /*
1335        * The entry point argument of the task specified by the ``id`` parameter
1336        * shall be set to the value specified by the ``argument`` parameter
1337        * before the task is unblocked by the rtems_task_restart() call.
1338        */
1339       if ( ctx->restart_counter != 0 ) {
1340         #if CPU_SIZEOF_POINTER > 4
1341         T_eq_u64( ctx->actual_argument, RESTART_ARGUMENT );
1342         #else
1343         T_eq_u32( ctx->actual_argument, RESTART_ARGUMENT );
1344         #endif
1345 
1346         T_eq_u32( ctx->restart_counter, 1 );
1347       } else {
1348         #if CPU_SIZEOF_POINTER > 4
1349         T_eq_u64(
1350           ctx->worker_tcb->Start.Entry.Kinds.Numeric.argument,
1351           RESTART_ARGUMENT
1352         );
1353         T_eq_u64( ctx->actual_argument, UNSET_ARGUMENT );
1354         #else
1355         T_eq_u32(
1356           ctx->worker_tcb->Start.Entry.Kinds.Numeric.argument,
1357           RESTART_ARGUMENT
1358         );
1359         T_eq_u32( ctx->actual_argument, UNSET_ARGUMENT );
1360         #endif
1361       }
1362       break;
1363     }
1364 
1365     case RtemsTaskReqRestart_Post_Argument_Nop: {
1366       /*
1367        * No entry point argument of a task shall be modified by the
1368        * rtems_task_restart() call.
1369        */
1370       T_eq_u32( ctx->actual_argument, UNSET_ARGUMENT );
1371       T_eq_u32( ctx->restart_counter, 0 );
1372       break;
1373     }
1374 
1375     case RtemsTaskReqRestart_Post_Argument_NA:
1376       break;
1377   }
1378 }
1379 
1380 static void RtemsTaskReqRestart_Post_State_Check(
1381   RtemsTaskReqRestart_Context   *ctx,
1382   RtemsTaskReqRestart_Post_State state
1383 )
1384 {
1385   const T_scheduler_event *event;
1386   size_t                   index;
1387 
1388   index = 0;
1389 
1390   switch ( state ) {
1391     case RtemsTaskReqRestart_Post_State_Dormant: {
1392       /*
1393        * The state of the task specified by the ``id`` parameter shall be
1394        * dormant after the rtems_task_restart() call.
1395        */
1396       T_eq_u32( ctx->worker_state, STATES_DORMANT )
1397 
1398       event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
1399       T_eq_int( event->operation, T_SCHEDULER_NOP );
1400       break;
1401     }
1402 
1403     case RtemsTaskReqRestart_Post_State_DormantSuspended: {
1404       /*
1405        * The state of the task specified by the ``id`` parameter shall be
1406        * dormant and suspended after the rtems_task_restart() call.
1407        */
1408       T_eq_u32( ctx->worker_state, STATES_DORMANT | STATES_SUSPENDED )
1409 
1410       event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
1411       T_eq_int( event->operation, T_SCHEDULER_NOP );
1412       break;
1413     }
1414 
1415     case RtemsTaskReqRestart_Post_State_Blocked: {
1416       /*
1417        * The state of the task specified by the ``id`` parameter shall be
1418        * blocked after the rtems_task_restart() call.
1419        */
1420       T_ne_u32( ctx->worker_state & STATES_BLOCKED, 0 )
1421       T_eq_u32( ctx->worker_state & STATES_BLOCKED, ctx->worker_state )
1422 
1423       if ( ctx->suspended && !ctx->blocked ) {
1424         event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
1425         T_eq_int( event->operation, T_SCHEDULER_UNBLOCK );
1426         T_eq_ptr( event->thread, ctx->worker_tcb );
1427       }
1428 
1429       if ( !ctx->real_priority_is_initial && !ctx->terminating ) {
1430         event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
1431         T_eq_int( event->operation, T_SCHEDULER_UPDATE_PRIORITY );
1432         T_eq_ptr( event->thread, ctx->worker_tcb );
1433       }
1434 
1435       event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
1436       T_eq_int( event->operation, T_SCHEDULER_NOP );
1437       break;
1438     }
1439 
1440     case RtemsTaskReqRestart_Post_State_Ready: {
1441       /*
1442        * The state of the task specified by the ``id`` parameter shall be ready
1443        * after the rtems_task_restart() call.
1444        */
1445       T_eq_u32( ctx->worker_state, STATES_READY )
1446 
1447       if ( ctx->protected ) {
1448         if ( ctx->suspended ) {
1449           event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
1450           T_eq_int( event->operation, T_SCHEDULER_UNBLOCK );
1451           T_eq_ptr( event->thread, ctx->worker_tcb );
1452         }
1453       } else {
1454         if ( ctx->suspended || ctx->blocked ) {
1455           event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
1456           T_eq_int( event->operation, T_SCHEDULER_UNBLOCK );
1457           T_eq_ptr( event->thread, ctx->worker_tcb );
1458         } else {
1459           event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
1460           T_eq_int( event->operation, T_SCHEDULER_BLOCK );
1461           T_eq_ptr( event->thread, ctx->worker_tcb );
1462 
1463           event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
1464           T_eq_int( event->operation, T_SCHEDULER_UNBLOCK );
1465           T_eq_ptr( event->thread, ctx->worker_tcb );
1466         }
1467       }
1468 
1469       if ( !ctx->real_priority_is_initial && !ctx->terminating ) {
1470         event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
1471         T_eq_int( event->operation, T_SCHEDULER_UPDATE_PRIORITY );
1472         T_eq_ptr( event->thread, ctx->worker_tcb );
1473       }
1474 
1475       event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
1476       T_eq_int( event->operation, T_SCHEDULER_NOP );
1477       break;
1478     }
1479 
1480     case RtemsTaskReqRestart_Post_State_Zombie: {
1481       /*
1482        * The state of the task specified by the ``id`` parameter shall be the
1483        * zombie state after the rtems_task_restart() call.
1484        */
1485       T_eq_u32( ctx->worker_state, STATES_ZOMBIE )
1486 
1487       if ( ctx->protected ) {
1488         if ( ctx->suspended ) {
1489           event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
1490           T_eq_int( event->operation, T_SCHEDULER_UNBLOCK );
1491           T_eq_ptr( event->thread, ctx->worker_tcb );
1492         }
1493       } else {
1494         if ( ctx->suspended ) {
1495           event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
1496           T_eq_int( event->operation, T_SCHEDULER_UNBLOCK );
1497           T_eq_ptr( event->thread, ctx->worker_tcb );
1498         } else {
1499           event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
1500           T_eq_int( event->operation, T_SCHEDULER_BLOCK );
1501           T_eq_ptr( event->thread, ctx->worker_tcb );
1502 
1503           event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
1504           T_eq_int( event->operation, T_SCHEDULER_UNBLOCK );
1505           T_eq_ptr( event->thread, ctx->worker_tcb );
1506         }
1507       }
1508 
1509       if ( !ctx->real_priority_is_initial && !ctx->terminating ) {
1510         event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
1511         T_eq_int( event->operation, T_SCHEDULER_UPDATE_PRIORITY );
1512         T_eq_ptr( event->thread, ctx->worker_tcb );
1513       }
1514 
1515       /* Set zombie state */
1516       event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
1517       T_eq_int( event->operation, T_SCHEDULER_BLOCK );
1518       T_eq_ptr( event->thread, ctx->worker_tcb );
1519 
1520       /* Wake up deleter */
1521       event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
1522       T_eq_int( event->operation, T_SCHEDULER_UNBLOCK );
1523       T_eq_ptr( event->thread, ctx->deleter_tcb );
1524 
1525       event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
1526       T_eq_int( event->operation, T_SCHEDULER_NOP );
1527       break;
1528     }
1529 
1530     case RtemsTaskReqRestart_Post_State_Nop: {
1531       /*
1532        * The state of the task specified by the ``id`` parameter shall not be
1533        * modified by the rtems_task_restart() call.
1534        */
1535       T_ne_u32( ctx->worker_state & STATES_LIFE_IS_CHANGING, 0 )
1536 
1537       if ( !ctx->real_priority_is_initial ) {
1538         event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
1539         T_eq_int( event->operation, T_SCHEDULER_UPDATE_PRIORITY );
1540         T_eq_ptr( event->thread, ctx->worker_tcb );
1541       }
1542 
1543       event = T_scheduler_next_any( &ctx->scheduler_log.header, &index );
1544       T_eq_int( event->operation, T_SCHEDULER_NOP );
1545       break;
1546     }
1547 
1548     case RtemsTaskReqRestart_Post_State_NA:
1549       break;
1550   }
1551 }
1552 
1553 static void RtemsTaskReqRestart_Post_Enqueued_Check(
1554   RtemsTaskReqRestart_Context      *ctx,
1555   RtemsTaskReqRestart_Post_Enqueued state
1556 )
1557 {
1558   switch ( state ) {
1559     case RtemsTaskReqRestart_Post_Enqueued_Yes: {
1560       /*
1561        * The task specified by the ``id`` parameter shall be enqueued on a wait
1562        * queue after the rtems_task_restart() call.
1563        */
1564       T_not_null( ctx->worker_tcb->Wait.queue );
1565       break;
1566     }
1567 
1568     case RtemsTaskReqRestart_Post_Enqueued_No: {
1569       /*
1570        * The task specified by the ``id`` parameter shall not be enqueued on a
1571        * wait queue after the rtems_task_restart() call.
1572        */
1573       T_null( ctx->worker_tcb->Wait.queue );
1574       break;
1575     }
1576 
1577     case RtemsTaskReqRestart_Post_Enqueued_NA:
1578       break;
1579   }
1580 }
1581 
1582 static void RtemsTaskReqRestart_Post_Timer_Check(
1583   RtemsTaskReqRestart_Context   *ctx,
1584   RtemsTaskReqRestart_Post_Timer state
1585 )
1586 {
1587   TaskTimerInfo info;
1588 
1589   switch ( state ) {
1590     case RtemsTaskReqRestart_Post_Timer_Active: {
1591       /*
1592        * The timer of the task specified by the ``id`` parameter shall be
1593        * active after the rtems_task_restart() call.
1594        */
1595       GetTaskTimerInfoByThread( ctx->worker_tcb, &info);
1596       T_eq_int( info.state, TASK_TIMER_TICKS );
1597       break;
1598     }
1599 
1600     case RtemsTaskReqRestart_Post_Timer_Inactive: {
1601       /*
1602        * The timer of the task specified by the ``id`` parameter shall be
1603        * inactive after the rtems_task_restart() call.
1604        */
1605       GetTaskTimerInfoByThread( ctx->worker_tcb, &info);
1606       T_eq_int( info.state, TASK_TIMER_INACTIVE );
1607       break;
1608     }
1609 
1610     case RtemsTaskReqRestart_Post_Timer_NA:
1611       break;
1612   }
1613 }
1614 
1615 static void RtemsTaskReqRestart_Post_Restarting_Check(
1616   RtemsTaskReqRestart_Context        *ctx,
1617   RtemsTaskReqRestart_Post_Restarting state
1618 )
1619 {
1620   switch ( state ) {
1621     case RtemsTaskReqRestart_Post_Restarting_Yes: {
1622       /*
1623        * The task specified by the ``id`` parameter shall be restarting after
1624        * the rtems_task_restart() call.
1625        */
1626       T_ne_int( ctx->worker_life_state & THREAD_LIFE_RESTARTING, 0 );
1627       break;
1628     }
1629 
1630     case RtemsTaskReqRestart_Post_Restarting_No: {
1631       /*
1632        * The task specified by the ``id`` parameter shall not be restarting
1633        * after the rtems_task_restart() call.
1634        */
1635       T_eq_int( ctx->worker_life_state & THREAD_LIFE_RESTARTING, 0 );
1636       break;
1637     }
1638 
1639     case RtemsTaskReqRestart_Post_Restarting_NA:
1640       break;
1641   }
1642 }
1643 
1644 static void RtemsTaskReqRestart_Post_Terminating_Check(
1645   RtemsTaskReqRestart_Context         *ctx,
1646   RtemsTaskReqRestart_Post_Terminating state
1647 )
1648 {
1649   switch ( state ) {
1650     case RtemsTaskReqRestart_Post_Terminating_Yes: {
1651       /*
1652        * The task specified by the ``id`` parameter shall be terminating after
1653        * the rtems_task_restart() call.
1654        */
1655       T_ne_int( ctx->worker_life_state & THREAD_LIFE_TERMINATING, 0 );
1656       break;
1657     }
1658 
1659     case RtemsTaskReqRestart_Post_Terminating_No: {
1660       /*
1661        * The task specified by the ``id`` parameter shall not be terminating
1662        * after the rtems_task_restart() call.
1663        */
1664       T_eq_int( ctx->worker_life_state & THREAD_LIFE_TERMINATING, 0 );
1665       break;
1666     }
1667 
1668     case RtemsTaskReqRestart_Post_Terminating_NA:
1669       break;
1670   }
1671 }
1672 
1673 static void RtemsTaskReqRestart_Post_Protected_Check(
1674   RtemsTaskReqRestart_Context       *ctx,
1675   RtemsTaskReqRestart_Post_Protected state
1676 )
1677 {
1678   switch ( state ) {
1679     case RtemsTaskReqRestart_Post_Protected_Yes: {
1680       /*
1681        * The thread life of the task specified by the ``id`` parameter be
1682        * protected after the rtems_task_restart() call.
1683        */
1684       T_ne_int( ctx->worker_life_state & THREAD_LIFE_PROTECTED, 0 );
1685       break;
1686     }
1687 
1688     case RtemsTaskReqRestart_Post_Protected_No: {
1689       /*
1690        * The thread life of the task specified by the ``id`` parameter shall
1691        * not be protected after the rtems_task_restart() call.
1692        */
1693       T_eq_int( ctx->worker_life_state & THREAD_LIFE_PROTECTED, 0 );
1694       break;
1695     }
1696 
1697     case RtemsTaskReqRestart_Post_Protected_NA:
1698       break;
1699   }
1700 }
1701 
1702 static void RtemsTaskReqRestart_Post_RestartExtensions_Check(
1703   RtemsTaskReqRestart_Context               *ctx,
1704   RtemsTaskReqRestart_Post_RestartExtensions state
1705 )
1706 {
1707   switch ( state ) {
1708     case RtemsTaskReqRestart_Post_RestartExtensions_Yes: {
1709       /*
1710        * The thread restart user extensions shall be invoked by the
1711        * rtems_task_restart() call.
1712        */
1713       T_eq_u32( ctx->calls_after_restart.thread_restart, 1 );
1714       break;
1715     }
1716 
1717     case RtemsTaskReqRestart_Post_RestartExtensions_Nop: {
1718       /*
1719        * The thread restart user extensions shall not be invoked by the
1720        * rtems_task_restart() call.
1721        */
1722       T_eq_u32( ctx->calls_after_restart.thread_restart, 0 );
1723       break;
1724     }
1725 
1726     case RtemsTaskReqRestart_Post_RestartExtensions_NA:
1727       break;
1728   }
1729 }
1730 
1731 static void RtemsTaskReqRestart_Post_TerminateExtensions_Check(
1732   RtemsTaskReqRestart_Context                 *ctx,
1733   RtemsTaskReqRestart_Post_TerminateExtensions state
1734 )
1735 {
1736   switch ( state ) {
1737     case RtemsTaskReqRestart_Post_TerminateExtensions_Yes: {
1738       /*
1739        * The thread terminate user extensions shall be invoked by the
1740        * rtems_task_restart() call.
1741        */
1742       T_eq_u32( ctx->calls_after_restart.thread_terminate, 1 );
1743       break;
1744     }
1745 
1746     case RtemsTaskReqRestart_Post_TerminateExtensions_Nop: {
1747       /*
1748        * The thread terminate user extensions shall not be invoked by the
1749        * rtems_task_restart() call.
1750        */
1751       T_eq_u32( ctx->calls_after_restart.thread_terminate, 0 );
1752       break;
1753     }
1754 
1755     case RtemsTaskReqRestart_Post_TerminateExtensions_NA:
1756       break;
1757   }
1758 }
1759 
1760 static void RtemsTaskReqRestart_Setup( RtemsTaskReqRestart_Context *ctx )
1761 {
1762   rtems_status_code sc;
1763 
1764   ctx->runner_id = rtems_task_self();
1765   ctx->scheduler_id = GetSelfScheduler();
1766   ctx->mutex_id = CreateMutexNoProtocol();
1767   ObtainMutex( ctx->mutex_id );
1768   WrapThreadQueueInitialize( &ctx->wrap_tq_ctx, Restart, ctx );
1769 
1770   sc = rtems_extension_create(
1771     rtems_build_name( 'T', 'E', 'S', 'T' ),
1772     &extensions,
1773     &ctx->extension_id
1774   );
1775   T_rsc_success( sc );
1776 
1777   SetFatalHandler( Fatal, ctx );
1778   SetSelfPriority( PRIO_NORMAL );
1779 
1780   ctx->deleter_id = CreateTask( "DELE", PRIO_HIGH );
1781   ctx->deleter_tcb = GetThread( ctx->deleter_id );
1782   StartTask( ctx->deleter_id, Deleter, NULL );
1783 }
1784 
1785 static void RtemsTaskReqRestart_Setup_Wrap( void *arg )
1786 {
1787   RtemsTaskReqRestart_Context *ctx;
1788 
1789   ctx = arg;
1790   ctx->Map.in_action_loop = false;
1791   RtemsTaskReqRestart_Setup( ctx );
1792 }
1793 
1794 static void RtemsTaskReqRestart_Teardown( RtemsTaskReqRestart_Context *ctx )
1795 {
1796   rtems_status_code sc;
1797 
1798   sc = rtems_extension_delete( ctx->extension_id );
1799   T_rsc_success( sc );
1800 
1801   SetFatalHandler( NULL, NULL );
1802   DeleteTask( ctx->deleter_id );
1803   ReleaseMutex( ctx->mutex_id );
1804   DeleteMutex( ctx->mutex_id );
1805   RestoreRunnerASR();
1806   RestoreRunnerPriority();
1807   WrapThreadQueueDestroy( &ctx->wrap_tq_ctx );
1808 }
1809 
1810 static void RtemsTaskReqRestart_Teardown_Wrap( void *arg )
1811 {
1812   RtemsTaskReqRestart_Context *ctx;
1813 
1814   ctx = arg;
1815   ctx->Map.in_action_loop = false;
1816   RtemsTaskReqRestart_Teardown( ctx );
1817 }
1818 
1819 static void RtemsTaskReqRestart_Prepare( RtemsTaskReqRestart_Context *ctx )
1820 {
1821   ctx->status = RTEMS_NOT_IMPLEMENTED;
1822   ctx->actual_argument = UNSET_ARGUMENT;
1823   ctx->restart_counter = 0;
1824 
1825   ctx->delete_worker_expected = false;
1826   ctx->worker_id = CreateTask( "WORK", PRIO_NORMAL );
1827   ctx->delete_worker_expected = true;
1828 
1829   ctx->worker_tcb = GetThread( ctx->worker_id );
1830   ctx->worker_state = UINT32_MAX;
1831   ctx->worker_life_state = INT_MAX;
1832 
1833   SetPriority( ctx->deleter_id, PRIO_HIGH );
1834 }
1835 
1836 static void RtemsTaskReqRestart_Action( RtemsTaskReqRestart_Context *ctx )
1837 {
1838   rtems_status_code sc;
1839 
1840   if ( ctx->id != INVALID_ID ) {
1841     if ( ctx->dormant ) {
1842       PrepareRealPriority( ctx );
1843     } else {
1844       StartTask( ctx->worker_id, Worker, NULL );
1845 
1846       /* Let the worker catch signals and set the thread life protection state */
1847       Yield();
1848 
1849       sc = rtems_signal_send( ctx->worker_id, RTEMS_SIGNAL_0 );
1850       T_rsc_success( sc );
1851 
1852       if (
1853         ctx->restarting &&
1854         ( !ctx->nested_request || ( ctx->nested_request && ctx->terminating ) )
1855       ) {
1856         sc = rtems_task_restart( ctx->worker_id, (rtems_task_argument) ctx );
1857         T_rsc_success( sc );
1858       }
1859 
1860       if ( ctx->terminating && !ctx->nested_request ) {
1861         sc = rtems_task_restart( ctx->deleter_id, (rtems_task_argument) ctx );
1862         T_rsc_success( sc );
1863       } else {
1864         PrepareRealPriority( ctx );
1865         Yield();
1866       }
1867     }
1868   }
1869 
1870   if ( ctx->id == RTEMS_SELF ) {
1871     CaptureWorkerState( ctx );
1872   } else {
1873     if ( ctx->nested_request ) {
1874       if ( ctx->terminating ) {
1875         sc = rtems_task_restart( ctx->deleter_id, (rtems_task_argument) ctx );
1876         T_rsc_success( sc );
1877       } else {
1878         WrapThreadQueueExtract( &ctx->wrap_tq_ctx, ctx->worker_tcb );
1879 
1880         sc = rtems_task_restart( ctx->worker_id, (rtems_task_argument) ctx );
1881         T_rsc_success( sc );
1882       }
1883     } else {
1884       SetSelfPriority( PRIO_VERY_HIGH );
1885 
1886       if ( ctx->interrupt ) {
1887         CallWithinISR( Restart, ctx );
1888       } else {
1889         Restart( ctx );
1890       }
1891     }
1892   }
1893 }
1894 
1895 static void RtemsTaskReqRestart_Cleanup( RtemsTaskReqRestart_Context *ctx )
1896 {
1897   SetSelfPriority( PRIO_VERY_LOW );
1898 
1899   if ( ctx->protected && ctx->blocked ) {
1900     if ( ctx->enqueued ) {
1901       ReleaseMutex( ctx->mutex_id );
1902       ObtainMutex( ctx->mutex_id );
1903     } else {
1904       SendEvents( ctx->worker_id, RTEMS_EVENT_0 );
1905     }
1906   }
1907 
1908   if ( ctx->id == INVALID_ID || ctx->dormant || !ctx->terminating ) {
1909     DeleteTask( ctx->worker_id );
1910   }
1911 
1912   SetSelfPriority( PRIO_NORMAL );
1913 }
1914 
1915 static const RtemsTaskReqRestart_Entry
1916 RtemsTaskReqRestart_Entries[] = {
1917   { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_NA,
1918     RtemsTaskReqRestart_Post_FatalError_NA,
1919     RtemsTaskReqRestart_Post_Argument_NA, RtemsTaskReqRestart_Post_State_NA,
1920     RtemsTaskReqRestart_Post_Enqueued_NA, RtemsTaskReqRestart_Post_Timer_NA,
1921     RtemsTaskReqRestart_Post_Restarting_NA,
1922     RtemsTaskReqRestart_Post_Terminating_NA,
1923     RtemsTaskReqRestart_Post_Protected_NA,
1924     RtemsTaskReqRestart_Post_RestartExtensions_NA,
1925     RtemsTaskReqRestart_Post_TerminateExtensions_NA },
1926   { 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, RtemsTaskReqRestart_Post_Status_InvId,
1927     RtemsTaskReqRestart_Post_FatalError_Nop,
1928     RtemsTaskReqRestart_Post_Argument_NA, RtemsTaskReqRestart_Post_State_NA,
1929     RtemsTaskReqRestart_Post_Enqueued_NA, RtemsTaskReqRestart_Post_Timer_NA,
1930     RtemsTaskReqRestart_Post_Restarting_NA,
1931     RtemsTaskReqRestart_Post_Terminating_NA,
1932     RtemsTaskReqRestart_Post_Protected_NA,
1933     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
1934     RtemsTaskReqRestart_Post_TerminateExtensions_Nop },
1935   { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_NA,
1936     RtemsTaskReqRestart_Post_FatalError_NA,
1937     RtemsTaskReqRestart_Post_Argument_NA, RtemsTaskReqRestart_Post_State_NA,
1938     RtemsTaskReqRestart_Post_Enqueued_NA, RtemsTaskReqRestart_Post_Timer_NA,
1939     RtemsTaskReqRestart_Post_Restarting_NA,
1940     RtemsTaskReqRestart_Post_Terminating_NA,
1941     RtemsTaskReqRestart_Post_Protected_NA,
1942     RtemsTaskReqRestart_Post_RestartExtensions_NA,
1943     RtemsTaskReqRestart_Post_TerminateExtensions_NA },
1944   { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_NA,
1945     RtemsTaskReqRestart_Post_FatalError_NA,
1946     RtemsTaskReqRestart_Post_Argument_NA, RtemsTaskReqRestart_Post_State_NA,
1947     RtemsTaskReqRestart_Post_Enqueued_NA, RtemsTaskReqRestart_Post_Timer_NA,
1948     RtemsTaskReqRestart_Post_Restarting_NA,
1949     RtemsTaskReqRestart_Post_Terminating_NA,
1950     RtemsTaskReqRestart_Post_Protected_NA,
1951     RtemsTaskReqRestart_Post_RestartExtensions_NA,
1952     RtemsTaskReqRestart_Post_TerminateExtensions_NA },
1953   { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_NA,
1954     RtemsTaskReqRestart_Post_FatalError_NA,
1955     RtemsTaskReqRestart_Post_Argument_NA, RtemsTaskReqRestart_Post_State_NA,
1956     RtemsTaskReqRestart_Post_Enqueued_NA, RtemsTaskReqRestart_Post_Timer_NA,
1957     RtemsTaskReqRestart_Post_Restarting_NA,
1958     RtemsTaskReqRestart_Post_Terminating_NA,
1959     RtemsTaskReqRestart_Post_Protected_NA,
1960     RtemsTaskReqRestart_Post_RestartExtensions_NA,
1961     RtemsTaskReqRestart_Post_TerminateExtensions_NA },
1962   { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_NA,
1963     RtemsTaskReqRestart_Post_FatalError_NA,
1964     RtemsTaskReqRestart_Post_Argument_NA, RtemsTaskReqRestart_Post_State_NA,
1965     RtemsTaskReqRestart_Post_Enqueued_NA, RtemsTaskReqRestart_Post_Timer_NA,
1966     RtemsTaskReqRestart_Post_Restarting_NA,
1967     RtemsTaskReqRestart_Post_Terminating_NA,
1968     RtemsTaskReqRestart_Post_Protected_NA,
1969     RtemsTaskReqRestart_Post_RestartExtensions_NA,
1970     RtemsTaskReqRestart_Post_TerminateExtensions_NA },
1971   { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_NA,
1972     RtemsTaskReqRestart_Post_FatalError_NA,
1973     RtemsTaskReqRestart_Post_Argument_NA, RtemsTaskReqRestart_Post_State_NA,
1974     RtemsTaskReqRestart_Post_Enqueued_NA, RtemsTaskReqRestart_Post_Timer_NA,
1975     RtemsTaskReqRestart_Post_Restarting_NA,
1976     RtemsTaskReqRestart_Post_Terminating_NA,
1977     RtemsTaskReqRestart_Post_Protected_NA,
1978     RtemsTaskReqRestart_Post_RestartExtensions_NA,
1979     RtemsTaskReqRestart_Post_TerminateExtensions_NA },
1980   { 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0,
1981     RtemsTaskReqRestart_Post_Status_IncStat,
1982     RtemsTaskReqRestart_Post_FatalError_Nop,
1983     RtemsTaskReqRestart_Post_Argument_Nop,
1984     RtemsTaskReqRestart_Post_State_DormantSuspended,
1985     RtemsTaskReqRestart_Post_Enqueued_No,
1986     RtemsTaskReqRestart_Post_Timer_Inactive,
1987     RtemsTaskReqRestart_Post_Restarting_No,
1988     RtemsTaskReqRestart_Post_Terminating_No,
1989     RtemsTaskReqRestart_Post_Protected_No,
1990     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
1991     RtemsTaskReqRestart_Post_TerminateExtensions_Nop },
1992   { 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0,
1993     RtemsTaskReqRestart_Post_Status_IncStat,
1994     RtemsTaskReqRestart_Post_FatalError_Nop,
1995     RtemsTaskReqRestart_Post_Argument_Nop,
1996     RtemsTaskReqRestart_Post_State_Dormant,
1997     RtemsTaskReqRestart_Post_Enqueued_No,
1998     RtemsTaskReqRestart_Post_Timer_Inactive,
1999     RtemsTaskReqRestart_Post_Restarting_No,
2000     RtemsTaskReqRestart_Post_Terminating_No,
2001     RtemsTaskReqRestart_Post_Protected_No,
2002     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
2003     RtemsTaskReqRestart_Post_TerminateExtensions_Nop },
2004   { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_NA,
2005     RtemsTaskReqRestart_Post_FatalError_NA,
2006     RtemsTaskReqRestart_Post_Argument_NA, RtemsTaskReqRestart_Post_State_NA,
2007     RtemsTaskReqRestart_Post_Enqueued_NA, RtemsTaskReqRestart_Post_Timer_NA,
2008     RtemsTaskReqRestart_Post_Restarting_NA,
2009     RtemsTaskReqRestart_Post_Terminating_NA,
2010     RtemsTaskReqRestart_Post_Protected_NA,
2011     RtemsTaskReqRestart_Post_RestartExtensions_NA,
2012     RtemsTaskReqRestart_Post_TerminateExtensions_NA },
2013   { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_NA,
2014     RtemsTaskReqRestart_Post_FatalError_NA,
2015     RtemsTaskReqRestart_Post_Argument_NA, RtemsTaskReqRestart_Post_State_NA,
2016     RtemsTaskReqRestart_Post_Enqueued_NA, RtemsTaskReqRestart_Post_Timer_NA,
2017     RtemsTaskReqRestart_Post_Restarting_NA,
2018     RtemsTaskReqRestart_Post_Terminating_NA,
2019     RtemsTaskReqRestart_Post_Protected_NA,
2020     RtemsTaskReqRestart_Post_RestartExtensions_NA,
2021     RtemsTaskReqRestart_Post_TerminateExtensions_NA },
2022   { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_NA,
2023     RtemsTaskReqRestart_Post_FatalError_NA,
2024     RtemsTaskReqRestart_Post_Argument_NA, RtemsTaskReqRestart_Post_State_NA,
2025     RtemsTaskReqRestart_Post_Enqueued_NA, RtemsTaskReqRestart_Post_Timer_NA,
2026     RtemsTaskReqRestart_Post_Restarting_NA,
2027     RtemsTaskReqRestart_Post_Terminating_NA,
2028     RtemsTaskReqRestart_Post_Protected_NA,
2029     RtemsTaskReqRestart_Post_RestartExtensions_NA,
2030     RtemsTaskReqRestart_Post_TerminateExtensions_NA },
2031   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_Ok,
2032     RtemsTaskReqRestart_Post_FatalError_Nop,
2033     RtemsTaskReqRestart_Post_Argument_Set,
2034     RtemsTaskReqRestart_Post_State_Ready, RtemsTaskReqRestart_Post_Enqueued_No,
2035     RtemsTaskReqRestart_Post_Timer_Inactive,
2036     RtemsTaskReqRestart_Post_Restarting_Yes,
2037     RtemsTaskReqRestart_Post_Terminating_Yes,
2038     RtemsTaskReqRestart_Post_Protected_No,
2039     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
2040     RtemsTaskReqRestart_Post_TerminateExtensions_Nop },
2041   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_Ok,
2042     RtemsTaskReqRestart_Post_FatalError_Nop,
2043     RtemsTaskReqRestart_Post_Argument_Set,
2044     RtemsTaskReqRestart_Post_State_Ready, RtemsTaskReqRestart_Post_Enqueued_No,
2045     RtemsTaskReqRestart_Post_Timer_Inactive,
2046     RtemsTaskReqRestart_Post_Restarting_Yes,
2047     RtemsTaskReqRestart_Post_Terminating_No,
2048     RtemsTaskReqRestart_Post_Protected_No,
2049     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
2050     RtemsTaskReqRestart_Post_TerminateExtensions_Nop },
2051   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_Ok,
2052     RtemsTaskReqRestart_Post_FatalError_Nop,
2053     RtemsTaskReqRestart_Post_Argument_Set, RtemsTaskReqRestart_Post_State_Nop,
2054     RtemsTaskReqRestart_Post_Enqueued_No,
2055     RtemsTaskReqRestart_Post_Timer_Inactive,
2056     RtemsTaskReqRestart_Post_Restarting_Yes,
2057     RtemsTaskReqRestart_Post_Terminating_No,
2058     RtemsTaskReqRestart_Post_Protected_No,
2059     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
2060     RtemsTaskReqRestart_Post_TerminateExtensions_Nop },
2061   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_Ok,
2062     RtemsTaskReqRestart_Post_FatalError_Nop,
2063     RtemsTaskReqRestart_Post_Argument_Set, RtemsTaskReqRestart_Post_State_Nop,
2064     RtemsTaskReqRestart_Post_Enqueued_No,
2065     RtemsTaskReqRestart_Post_Timer_Inactive,
2066     RtemsTaskReqRestart_Post_Restarting_Yes,
2067     RtemsTaskReqRestart_Post_Terminating_Yes,
2068     RtemsTaskReqRestart_Post_Protected_No,
2069     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
2070     RtemsTaskReqRestart_Post_TerminateExtensions_Nop },
2071   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_Ok,
2072     RtemsTaskReqRestart_Post_FatalError_Nop,
2073     RtemsTaskReqRestart_Post_Argument_Set,
2074     RtemsTaskReqRestart_Post_State_Ready, RtemsTaskReqRestart_Post_Enqueued_No,
2075     RtemsTaskReqRestart_Post_Timer_Inactive,
2076     RtemsTaskReqRestart_Post_Restarting_Yes,
2077     RtemsTaskReqRestart_Post_Terminating_Yes,
2078     RtemsTaskReqRestart_Post_Protected_Yes,
2079     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
2080     RtemsTaskReqRestart_Post_TerminateExtensions_Nop },
2081   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_Ok,
2082     RtemsTaskReqRestart_Post_FatalError_Nop,
2083     RtemsTaskReqRestart_Post_Argument_Set,
2084     RtemsTaskReqRestart_Post_State_Blocked,
2085     RtemsTaskReqRestart_Post_Enqueued_No,
2086     RtemsTaskReqRestart_Post_Timer_Inactive,
2087     RtemsTaskReqRestart_Post_Restarting_Yes,
2088     RtemsTaskReqRestart_Post_Terminating_Yes,
2089     RtemsTaskReqRestart_Post_Protected_Yes,
2090     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
2091     RtemsTaskReqRestart_Post_TerminateExtensions_Nop },
2092   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_Ok,
2093     RtemsTaskReqRestart_Post_FatalError_Nop,
2094     RtemsTaskReqRestart_Post_Argument_Set,
2095     RtemsTaskReqRestart_Post_State_Blocked,
2096     RtemsTaskReqRestart_Post_Enqueued_No,
2097     RtemsTaskReqRestart_Post_Timer_Active,
2098     RtemsTaskReqRestart_Post_Restarting_Yes,
2099     RtemsTaskReqRestart_Post_Terminating_Yes,
2100     RtemsTaskReqRestart_Post_Protected_Yes,
2101     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
2102     RtemsTaskReqRestart_Post_TerminateExtensions_Nop },
2103   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_Ok,
2104     RtemsTaskReqRestart_Post_FatalError_Nop,
2105     RtemsTaskReqRestart_Post_Argument_Set,
2106     RtemsTaskReqRestart_Post_State_Blocked,
2107     RtemsTaskReqRestart_Post_Enqueued_Yes,
2108     RtemsTaskReqRestart_Post_Timer_Inactive,
2109     RtemsTaskReqRestart_Post_Restarting_Yes,
2110     RtemsTaskReqRestart_Post_Terminating_Yes,
2111     RtemsTaskReqRestart_Post_Protected_Yes,
2112     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
2113     RtemsTaskReqRestart_Post_TerminateExtensions_Nop },
2114   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_Ok,
2115     RtemsTaskReqRestart_Post_FatalError_Nop,
2116     RtemsTaskReqRestart_Post_Argument_Set,
2117     RtemsTaskReqRestart_Post_State_Blocked,
2118     RtemsTaskReqRestart_Post_Enqueued_Yes,
2119     RtemsTaskReqRestart_Post_Timer_Active,
2120     RtemsTaskReqRestart_Post_Restarting_Yes,
2121     RtemsTaskReqRestart_Post_Terminating_Yes,
2122     RtemsTaskReqRestart_Post_Protected_Yes,
2123     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
2124     RtemsTaskReqRestart_Post_TerminateExtensions_Nop },
2125   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_Ok,
2126     RtemsTaskReqRestart_Post_FatalError_Nop,
2127     RtemsTaskReqRestart_Post_Argument_Set,
2128     RtemsTaskReqRestart_Post_State_Ready, RtemsTaskReqRestart_Post_Enqueued_No,
2129     RtemsTaskReqRestart_Post_Timer_Inactive,
2130     RtemsTaskReqRestart_Post_Restarting_Yes,
2131     RtemsTaskReqRestart_Post_Terminating_No,
2132     RtemsTaskReqRestart_Post_Protected_Yes,
2133     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
2134     RtemsTaskReqRestart_Post_TerminateExtensions_Nop },
2135   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_Ok,
2136     RtemsTaskReqRestart_Post_FatalError_Nop,
2137     RtemsTaskReqRestart_Post_Argument_Set,
2138     RtemsTaskReqRestart_Post_State_Blocked,
2139     RtemsTaskReqRestart_Post_Enqueued_No,
2140     RtemsTaskReqRestart_Post_Timer_Inactive,
2141     RtemsTaskReqRestart_Post_Restarting_Yes,
2142     RtemsTaskReqRestart_Post_Terminating_No,
2143     RtemsTaskReqRestart_Post_Protected_Yes,
2144     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
2145     RtemsTaskReqRestart_Post_TerminateExtensions_Nop },
2146   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_Ok,
2147     RtemsTaskReqRestart_Post_FatalError_Nop,
2148     RtemsTaskReqRestart_Post_Argument_Set,
2149     RtemsTaskReqRestart_Post_State_Blocked,
2150     RtemsTaskReqRestart_Post_Enqueued_No,
2151     RtemsTaskReqRestart_Post_Timer_Active,
2152     RtemsTaskReqRestart_Post_Restarting_Yes,
2153     RtemsTaskReqRestart_Post_Terminating_No,
2154     RtemsTaskReqRestart_Post_Protected_Yes,
2155     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
2156     RtemsTaskReqRestart_Post_TerminateExtensions_Nop },
2157   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_Ok,
2158     RtemsTaskReqRestart_Post_FatalError_Nop,
2159     RtemsTaskReqRestart_Post_Argument_Set,
2160     RtemsTaskReqRestart_Post_State_Blocked,
2161     RtemsTaskReqRestart_Post_Enqueued_Yes,
2162     RtemsTaskReqRestart_Post_Timer_Inactive,
2163     RtemsTaskReqRestart_Post_Restarting_Yes,
2164     RtemsTaskReqRestart_Post_Terminating_No,
2165     RtemsTaskReqRestart_Post_Protected_Yes,
2166     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
2167     RtemsTaskReqRestart_Post_TerminateExtensions_Nop },
2168   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsTaskReqRestart_Post_Status_Ok,
2169     RtemsTaskReqRestart_Post_FatalError_Nop,
2170     RtemsTaskReqRestart_Post_Argument_Set,
2171     RtemsTaskReqRestart_Post_State_Blocked,
2172     RtemsTaskReqRestart_Post_Enqueued_Yes,
2173     RtemsTaskReqRestart_Post_Timer_Active,
2174     RtemsTaskReqRestart_Post_Restarting_Yes,
2175     RtemsTaskReqRestart_Post_Terminating_No,
2176     RtemsTaskReqRestart_Post_Protected_Yes,
2177     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
2178     RtemsTaskReqRestart_Post_TerminateExtensions_Nop },
2179   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2180     RtemsTaskReqRestart_Post_Status_NoReturn,
2181     RtemsTaskReqRestart_Post_FatalError_Nop,
2182     RtemsTaskReqRestart_Post_Argument_Set,
2183     RtemsTaskReqRestart_Post_State_Zombie,
2184     RtemsTaskReqRestart_Post_Enqueued_No,
2185     RtemsTaskReqRestart_Post_Timer_Inactive,
2186     RtemsTaskReqRestart_Post_Restarting_Yes,
2187     RtemsTaskReqRestart_Post_Terminating_Yes,
2188     RtemsTaskReqRestart_Post_Protected_Yes,
2189     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
2190     RtemsTaskReqRestart_Post_TerminateExtensions_Yes },
2191   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2192     RtemsTaskReqRestart_Post_Status_NoReturn,
2193     RtemsTaskReqRestart_Post_FatalError_Nop,
2194     RtemsTaskReqRestart_Post_Argument_Set,
2195     RtemsTaskReqRestart_Post_State_Ready, RtemsTaskReqRestart_Post_Enqueued_No,
2196     RtemsTaskReqRestart_Post_Timer_Inactive,
2197     RtemsTaskReqRestart_Post_Restarting_No,
2198     RtemsTaskReqRestart_Post_Terminating_No,
2199     RtemsTaskReqRestart_Post_Protected_No,
2200     RtemsTaskReqRestart_Post_RestartExtensions_Yes,
2201     RtemsTaskReqRestart_Post_TerminateExtensions_Nop },
2202   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2203     RtemsTaskReqRestart_Post_Status_NoReturn,
2204     RtemsTaskReqRestart_Post_FatalError_Yes,
2205     RtemsTaskReqRestart_Post_Argument_Set,
2206     RtemsTaskReqRestart_Post_State_Ready, RtemsTaskReqRestart_Post_Enqueued_No,
2207     RtemsTaskReqRestart_Post_Timer_Inactive,
2208     RtemsTaskReqRestart_Post_Restarting_Yes,
2209     RtemsTaskReqRestart_Post_Terminating_Yes,
2210     RtemsTaskReqRestart_Post_Protected_Yes,
2211     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
2212     RtemsTaskReqRestart_Post_TerminateExtensions_Nop },
2213   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2214     RtemsTaskReqRestart_Post_Status_NoReturn,
2215     RtemsTaskReqRestart_Post_FatalError_Yes,
2216     RtemsTaskReqRestart_Post_Argument_Set,
2217     RtemsTaskReqRestart_Post_State_Ready, RtemsTaskReqRestart_Post_Enqueued_No,
2218     RtemsTaskReqRestart_Post_Timer_Inactive,
2219     RtemsTaskReqRestart_Post_Restarting_Yes,
2220     RtemsTaskReqRestart_Post_Terminating_Yes,
2221     RtemsTaskReqRestart_Post_Protected_No,
2222     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
2223     RtemsTaskReqRestart_Post_TerminateExtensions_Nop },
2224   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2225     RtemsTaskReqRestart_Post_Status_NoReturn,
2226     RtemsTaskReqRestart_Post_FatalError_Yes,
2227     RtemsTaskReqRestart_Post_Argument_Set,
2228     RtemsTaskReqRestart_Post_State_Ready, RtemsTaskReqRestart_Post_Enqueued_No,
2229     RtemsTaskReqRestart_Post_Timer_Inactive,
2230     RtemsTaskReqRestart_Post_Restarting_Yes,
2231     RtemsTaskReqRestart_Post_Terminating_No,
2232     RtemsTaskReqRestart_Post_Protected_Yes,
2233     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
2234     RtemsTaskReqRestart_Post_TerminateExtensions_Nop },
2235   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2236     RtemsTaskReqRestart_Post_Status_NoReturn,
2237     RtemsTaskReqRestart_Post_FatalError_Yes,
2238     RtemsTaskReqRestart_Post_Argument_Set,
2239     RtemsTaskReqRestart_Post_State_Ready, RtemsTaskReqRestart_Post_Enqueued_No,
2240     RtemsTaskReqRestart_Post_Timer_Inactive,
2241     RtemsTaskReqRestart_Post_Restarting_Yes,
2242     RtemsTaskReqRestart_Post_Terminating_No,
2243     RtemsTaskReqRestart_Post_Protected_No,
2244     RtemsTaskReqRestart_Post_RestartExtensions_Nop,
2245     RtemsTaskReqRestart_Post_TerminateExtensions_Nop }
2246 };
2247 
2248 static const uint8_t
2249 RtemsTaskReqRestart_Map[] = {
2250   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
2251   1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 2, 2, 2, 2,
2252   2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1,
2253   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0,
2254   1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2255   2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2256   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,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10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 16, 0, 16, 0, 10, 0,
2385   10, 0, 17, 0, 17, 0, 18, 0, 18, 0, 19, 0, 19, 0, 20, 0, 20, 0, 4, 4, 4, 4, 4,
2386   4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 29, 26, 29, 26, 10,
2387   10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 12, 0, 12, 0, 10,
2388   0, 10, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 4, 4, 4, 4,
2389   4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 30, 27, 30, 27,
2390   10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 21, 0, 21, 0,
2391   10, 0, 10, 0, 22, 0, 22, 0, 23, 0, 23, 0, 24, 0, 24, 0, 25, 0, 25, 0, 5, 5,
2392   5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 31, 27, 31,
2393   27, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 13, 0,
2394   13, 0, 10, 0, 10, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0,
2395   14, 0, 14, 0, 10, 0, 10, 0, 14, 0, 14, 0, 14, 0, 14, 0, 14, 0, 14, 0, 14, 0,
2396   14, 0, 28, 26, 28, 26, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
2397   9, 9, 9, 16, 0, 16, 0, 10, 0, 10, 0, 17, 0, 17, 0, 18, 0, 18, 0, 19, 0, 19,
2398   0, 20, 0, 20, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
2399   4, 4, 4, 4, 29, 26, 29, 26, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
2400   9, 9, 9, 9, 9, 12, 0, 12, 0, 10, 0, 10, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0,
2401   12, 0, 12, 0, 12, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
2402   4, 4, 4, 4, 4, 30, 27, 30, 27, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
2403   9, 9, 9, 9, 9, 9, 21, 0, 21, 0, 10, 0, 10, 0, 22, 0, 22, 0, 23, 0, 23, 0, 24,
2404   0, 24, 0, 25, 0, 25, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
2405   6, 6, 6, 6, 6, 6, 31, 27, 31, 27, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9,
2406   9, 9, 9, 9, 9, 9, 9, 13, 0, 13, 0, 10, 0, 10, 0, 13, 0, 13, 0, 13, 0, 13, 0,
2407   13, 0, 13, 0, 13, 0, 13, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
2408   6, 6, 6, 6, 6, 6, 6, 6, 28, 26, 28, 26, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9,
2409   9, 9, 9, 9, 9, 9, 9, 9, 9, 16, 0, 16, 0, 10, 0, 10, 0, 17, 0, 17, 0, 18, 0,
2410   18, 0, 19, 0, 19, 0, 20, 0, 20, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
2411   4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 29, 26, 29, 26, 10, 10, 10, 10, 9, 9, 9, 9, 9,
2412   9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 12, 0, 12, 0, 10, 0, 10, 0, 12, 0, 12, 0,
2413   12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
2414   4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 30, 27, 30, 27, 10, 10, 10, 10, 9, 9, 9,
2415   9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 21, 0, 21, 0, 10, 0, 10, 0, 22, 0, 22,
2416   0, 23, 0, 23, 0, 24, 0, 24, 0, 25, 0, 25, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
2417   5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 31, 27, 31, 27, 10, 10, 10, 10, 9, 9,
2418   9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 13, 0, 13, 0, 10, 0, 10, 0, 13, 0,
2419   13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 14, 0, 14, 0, 10, 0, 10, 0,
2420   14, 0, 14, 0, 14, 0, 14, 0, 14, 0, 14, 0, 14, 0, 14, 0, 28, 26, 28, 26, 10,
2421   10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 16, 0, 16, 0, 10,
2422   0, 10, 0, 17, 0, 17, 0, 18, 0, 18, 0, 19, 0, 19, 0, 20, 0, 20, 0, 4, 4, 4, 4,
2423   4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 29, 26, 29, 26,
2424   10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 12, 0, 12, 0,
2425   10, 0, 10, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 4, 4,
2426   4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 30, 27, 30,
2427   27, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 21, 0,
2428   21, 0, 10, 0, 10, 0, 22, 0, 22, 0, 23, 0, 23, 0, 24, 0, 24, 0, 25, 0, 25, 0,
2429   6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 31,
2430   27, 31, 27, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
2431   13, 0, 13, 0, 10, 0, 10, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0,
2432   13, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
2433   6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
2434   0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 5, 5, 5,
2435   5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7, 7, 7, 7, 7,
2436   7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 7, 0, 7, 0, 7,
2437   0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 11, 11, 11, 11, 11, 11,
2438   11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 7, 7,
2439   7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7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2466   8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 11, 11, 11, 11, 11, 11,
2467   11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8,
2468   8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 8, 0,
2469   8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 5, 5, 5, 5, 5, 5,
2470   5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 8, 8, 8, 8, 8, 8, 8,
2471   8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0,
2472   8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 11, 11, 11, 11, 11, 11, 11, 11, 11,
2473   11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8,
2474   8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 8, 0, 8, 0, 8, 0,
2475   8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
2476   6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
2477   8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0,
2478   8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
2479   6, 6, 6, 6, 6, 6, 6, 6, 16, 16, 16, 16, 10, 10, 10, 10, 17, 17, 17, 17, 18,
2480   18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 16, 0, 16, 0, 10, 0, 10, 0, 17,
2481   0, 17, 0, 18, 0, 18, 0, 19, 0, 19, 0, 20, 0, 20, 0, 5, 5, 5, 5, 5, 5, 5, 5,
2482   5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 12, 12, 12, 12, 10, 10, 10,
2483   10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 0,
2484   12, 0, 10, 0, 10, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0,
2485   15, 0, 15, 0, 10, 0, 10, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0,
2486   15, 0, 21, 21, 21, 21, 10, 10, 10, 10, 22, 22, 22, 22, 23, 23, 23, 23, 24,
2487   24, 24, 24, 25, 25, 25, 25, 21, 0, 21, 0, 10, 0, 10, 0, 22, 0, 22, 0, 23, 0,
2488   23, 0, 24, 0, 24, 0, 25, 0, 25, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
2489   5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 13, 13, 13, 13, 10, 10, 10, 10, 13, 13, 13, 13,
2490   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 0, 13, 0, 10, 0, 10, 0,
2491   13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 14, 0, 14, 0, 10, 0,
2492   10, 0, 14, 0, 14, 0, 14, 0, 14, 0, 14, 0, 14, 0, 14, 0, 14, 0, 16, 16, 16,
2493   16, 10, 10, 10, 10, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20,
2494   20, 20, 16, 0, 16, 0, 10, 0, 10, 0, 17, 0, 17, 0, 18, 0, 18, 0, 19, 0, 19, 0,
2495   20, 0, 20, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
2496   5, 5, 5, 12, 12, 12, 12, 10, 10, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12,
2497   12, 12, 12, 12, 12, 12, 12, 12, 0, 12, 0, 10, 0, 10, 0, 12, 0, 12, 0, 12, 0,
2498   12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 15, 0, 15, 0, 10, 0, 10, 0, 15, 0, 15, 0,
2499   15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 21, 21, 21, 21, 10, 10, 10, 10, 22,
2500   22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 21, 0, 21, 0, 10,
2501   0, 10, 0, 22, 0, 22, 0, 23, 0, 23, 0, 24, 0, 24, 0, 25, 0, 25, 0, 6, 6, 6, 6,
2502   6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 13, 13, 13, 13,
2503   10, 10, 10, 10, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
2504   13, 13, 0, 13, 0, 10, 0, 10, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13,
2505   0, 13, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
2506   6, 6, 16, 16, 16, 16, 10, 10, 10, 10, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19,
2507   19, 19, 20, 20, 20, 20, 16, 0, 16, 0, 10, 0, 10, 0, 17, 0, 17, 0, 18, 0, 18,
2508   0, 19, 0, 19, 0, 20, 0, 20, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
2509   5, 5, 5, 5, 5, 5, 5, 5, 5, 12, 12, 12, 12, 10, 10, 10, 10, 12, 12, 12, 12,
2510   12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 0, 12, 0, 10, 0, 10, 0,
2511   12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 15, 0, 15, 0, 10, 0,
2512   10, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 21, 21, 21,
2513   21, 10, 10, 10, 10, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25,
2514   25, 25, 21, 0, 21, 0, 10, 0, 10, 0, 22, 0, 22, 0, 23, 0, 23, 0, 24, 0, 24, 0,
2515   25, 0, 25, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
2516   5, 5, 5, 13, 13, 13, 13, 10, 10, 10, 10, 13, 13, 13, 13, 13, 13, 13, 13, 13,
2517   13, 13, 13, 13, 13, 13, 13, 13, 0, 13, 0, 10, 0, 10, 0, 13, 0, 13, 0, 13, 0,
2518   13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 14, 0, 14, 0, 10, 0, 10, 0, 14, 0, 14, 0,
2519   14, 0, 14, 0, 14, 0, 14, 0, 14, 0, 14, 0, 16, 16, 16, 16, 10, 10, 10, 10, 17,
2520   17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 16, 0, 16, 0, 10,
2521   0, 10, 0, 17, 0, 17, 0, 18, 0, 18, 0, 19, 0, 19, 0, 20, 0, 20, 0, 5, 5, 5, 5,
2522   5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 12, 12, 12, 12,
2523   10, 10, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
2524   12, 12, 0, 12, 0, 10, 0, 10, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12,
2525   0, 12, 0, 15, 0, 15, 0, 10, 0, 10, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15,
2526   0, 15, 0, 15, 0, 21, 21, 21, 21, 10, 10, 10, 10, 22, 22, 22, 22, 23, 23, 23,
2527   23, 24, 24, 24, 24, 25, 25, 25, 25, 21, 0, 21, 0, 10, 0, 10, 0, 22, 0, 22, 0,
2528   23, 0, 23, 0, 24, 0, 24, 0, 25, 0, 25, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
2529   6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 13, 13, 13, 13, 10, 10, 10, 10, 13, 13,
2530   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 0, 13, 0, 10, 0,
2531   10, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 6, 6, 6, 6, 6,
2532   6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6
2533 };
2534 
2535 static size_t RtemsTaskReqRestart_Scope( void *arg, char *buf, size_t n )
2536 {
2537   RtemsTaskReqRestart_Context *ctx;
2538 
2539   ctx = arg;
2540 
2541   if ( ctx->Map.in_action_loop ) {
2542     return T_get_scope( RtemsTaskReqRestart_PreDesc, buf, n, ctx->Map.pcs );
2543   }
2544 
2545   return 0;
2546 }
2547 
2548 static T_fixture RtemsTaskReqRestart_Fixture = {
2549   .setup = RtemsTaskReqRestart_Setup_Wrap,
2550   .stop = NULL,
2551   .teardown = RtemsTaskReqRestart_Teardown_Wrap,
2552   .scope = RtemsTaskReqRestart_Scope,
2553   .initial_context = &RtemsTaskReqRestart_Instance
2554 };
2555 
2556 static inline RtemsTaskReqRestart_Entry RtemsTaskReqRestart_PopEntry(
2557   RtemsTaskReqRestart_Context *ctx
2558 )
2559 {
2560   size_t index;
2561 
2562   index = ctx->Map.index;
2563   ctx->Map.index = index + 1;
2564   return RtemsTaskReqRestart_Entries[
2565     RtemsTaskReqRestart_Map[ index ]
2566   ];
2567 }
2568 
2569 static void RtemsTaskReqRestart_SetPreConditionStates(
2570   RtemsTaskReqRestart_Context *ctx
2571 )
2572 {
2573   ctx->Map.pcs[ 0 ] = ctx->Map.pci[ 0 ];
2574 
2575   if ( ctx->Map.entry.Pre_Dormant_NA ) {
2576     ctx->Map.pcs[ 1 ] = RtemsTaskReqRestart_Pre_Dormant_NA;
2577   } else {
2578     ctx->Map.pcs[ 1 ] = ctx->Map.pci[ 1 ];
2579   }
2580 
2581   if ( ctx->Map.entry.Pre_Suspended_NA ) {
2582     ctx->Map.pcs[ 2 ] = RtemsTaskReqRestart_Pre_Suspended_NA;
2583   } else {
2584     ctx->Map.pcs[ 2 ] = ctx->Map.pci[ 2 ];
2585   }
2586 
2587   if ( ctx->Map.entry.Pre_Restarting_NA ) {
2588     ctx->Map.pcs[ 3 ] = RtemsTaskReqRestart_Pre_Restarting_NA;
2589   } else {
2590     ctx->Map.pcs[ 3 ] = ctx->Map.pci[ 3 ];
2591   }
2592 
2593   if ( ctx->Map.entry.Pre_Terminating_NA ) {
2594     ctx->Map.pcs[ 4 ] = RtemsTaskReqRestart_Pre_Terminating_NA;
2595   } else {
2596     ctx->Map.pcs[ 4 ] = ctx->Map.pci[ 4 ];
2597   }
2598 
2599   if ( ctx->Map.entry.Pre_Protected_NA ) {
2600     ctx->Map.pcs[ 5 ] = RtemsTaskReqRestart_Pre_Protected_NA;
2601   } else {
2602     ctx->Map.pcs[ 5 ] = ctx->Map.pci[ 5 ];
2603   }
2604 
2605   ctx->Map.pcs[ 6 ] = ctx->Map.pci[ 6 ];
2606 
2607   if ( ctx->Map.entry.Pre_State_NA ) {
2608     ctx->Map.pcs[ 7 ] = RtemsTaskReqRestart_Pre_State_NA;
2609   } else {
2610     ctx->Map.pcs[ 7 ] = ctx->Map.pci[ 7 ];
2611   }
2612 
2613   if ( ctx->Map.entry.Pre_Timer_NA ) {
2614     ctx->Map.pcs[ 8 ] = RtemsTaskReqRestart_Pre_Timer_NA;
2615   } else {
2616     ctx->Map.pcs[ 8 ] = ctx->Map.pci[ 8 ];
2617   }
2618 
2619   if ( ctx->Map.entry.Pre_RealPriority_NA ) {
2620     ctx->Map.pcs[ 9 ] = RtemsTaskReqRestart_Pre_RealPriority_NA;
2621   } else {
2622     ctx->Map.pcs[ 9 ] = ctx->Map.pci[ 9 ];
2623   }
2624 
2625   ctx->Map.pcs[ 10 ] = ctx->Map.pci[ 10 ];
2626 }
2627 
2628 static void RtemsTaskReqRestart_TestVariant( RtemsTaskReqRestart_Context *ctx )
2629 {
2630   RtemsTaskReqRestart_Pre_Id_Prepare( ctx, ctx->Map.pcs[ 0 ] );
2631   RtemsTaskReqRestart_Pre_Dormant_Prepare( ctx, ctx->Map.pcs[ 1 ] );
2632   RtemsTaskReqRestart_Pre_Suspended_Prepare( ctx, ctx->Map.pcs[ 2 ] );
2633   RtemsTaskReqRestart_Pre_Restarting_Prepare( ctx, ctx->Map.pcs[ 3 ] );
2634   RtemsTaskReqRestart_Pre_Terminating_Prepare( ctx, ctx->Map.pcs[ 4 ] );
2635   RtemsTaskReqRestart_Pre_Protected_Prepare( ctx, ctx->Map.pcs[ 5 ] );
2636   RtemsTaskReqRestart_Pre_Context_Prepare( ctx, ctx->Map.pcs[ 6 ] );
2637   RtemsTaskReqRestart_Pre_State_Prepare( ctx, ctx->Map.pcs[ 7 ] );
2638   RtemsTaskReqRestart_Pre_Timer_Prepare( ctx, ctx->Map.pcs[ 8 ] );
2639   RtemsTaskReqRestart_Pre_RealPriority_Prepare( ctx, ctx->Map.pcs[ 9 ] );
2640   RtemsTaskReqRestart_Pre_ThreadDispatch_Prepare( ctx, ctx->Map.pcs[ 10 ] );
2641   RtemsTaskReqRestart_Action( ctx );
2642   RtemsTaskReqRestart_Post_Status_Check( ctx, ctx->Map.entry.Post_Status );
2643   RtemsTaskReqRestart_Post_FatalError_Check(
2644     ctx,
2645     ctx->Map.entry.Post_FatalError
2646   );
2647   RtemsTaskReqRestart_Post_Argument_Check( ctx, ctx->Map.entry.Post_Argument );
2648   RtemsTaskReqRestart_Post_State_Check( ctx, ctx->Map.entry.Post_State );
2649   RtemsTaskReqRestart_Post_Enqueued_Check( ctx, ctx->Map.entry.Post_Enqueued );
2650   RtemsTaskReqRestart_Post_Timer_Check( ctx, ctx->Map.entry.Post_Timer );
2651   RtemsTaskReqRestart_Post_Restarting_Check(
2652     ctx,
2653     ctx->Map.entry.Post_Restarting
2654   );
2655   RtemsTaskReqRestart_Post_Terminating_Check(
2656     ctx,
2657     ctx->Map.entry.Post_Terminating
2658   );
2659   RtemsTaskReqRestart_Post_Protected_Check(
2660     ctx,
2661     ctx->Map.entry.Post_Protected
2662   );
2663   RtemsTaskReqRestart_Post_RestartExtensions_Check(
2664     ctx,
2665     ctx->Map.entry.Post_RestartExtensions
2666   );
2667   RtemsTaskReqRestart_Post_TerminateExtensions_Check(
2668     ctx,
2669     ctx->Map.entry.Post_TerminateExtensions
2670   );
2671 }
2672 
2673 /**
2674  * @fn void T_case_body_RtemsTaskReqRestart( void )
2675  */
2676 T_TEST_CASE_FIXTURE( RtemsTaskReqRestart, &RtemsTaskReqRestart_Fixture )
2677 {
2678   RtemsTaskReqRestart_Context *ctx;
2679 
2680   ctx = T_fixture_context();
2681   ctx->Map.in_action_loop = true;
2682   ctx->Map.index = 0;
2683 
2684   for (
2685     ctx->Map.pci[ 0 ] = RtemsTaskReqRestart_Pre_Id_Invalid;
2686     ctx->Map.pci[ 0 ] < RtemsTaskReqRestart_Pre_Id_NA;
2687     ++ctx->Map.pci[ 0 ]
2688   ) {
2689     for (
2690       ctx->Map.pci[ 1 ] = RtemsTaskReqRestart_Pre_Dormant_Yes;
2691       ctx->Map.pci[ 1 ] < RtemsTaskReqRestart_Pre_Dormant_NA;
2692       ++ctx->Map.pci[ 1 ]
2693     ) {
2694       for (
2695         ctx->Map.pci[ 2 ] = RtemsTaskReqRestart_Pre_Suspended_Yes;
2696         ctx->Map.pci[ 2 ] < RtemsTaskReqRestart_Pre_Suspended_NA;
2697         ++ctx->Map.pci[ 2 ]
2698       ) {
2699         for (
2700           ctx->Map.pci[ 3 ] = RtemsTaskReqRestart_Pre_Restarting_Yes;
2701           ctx->Map.pci[ 3 ] < RtemsTaskReqRestart_Pre_Restarting_NA;
2702           ++ctx->Map.pci[ 3 ]
2703         ) {
2704           for (
2705             ctx->Map.pci[ 4 ] = RtemsTaskReqRestart_Pre_Terminating_Yes;
2706             ctx->Map.pci[ 4 ] < RtemsTaskReqRestart_Pre_Terminating_NA;
2707             ++ctx->Map.pci[ 4 ]
2708           ) {
2709             for (
2710               ctx->Map.pci[ 5 ] = RtemsTaskReqRestart_Pre_Protected_Yes;
2711               ctx->Map.pci[ 5 ] < RtemsTaskReqRestart_Pre_Protected_NA;
2712               ++ctx->Map.pci[ 5 ]
2713             ) {
2714               for (
2715                 ctx->Map.pci[ 6 ] = RtemsTaskReqRestart_Pre_Context_Task;
2716                 ctx->Map.pci[ 6 ] < RtemsTaskReqRestart_Pre_Context_NA;
2717                 ++ctx->Map.pci[ 6 ]
2718               ) {
2719                 for (
2720                   ctx->Map.pci[ 7 ] = RtemsTaskReqRestart_Pre_State_Ready;
2721                   ctx->Map.pci[ 7 ] < RtemsTaskReqRestart_Pre_State_NA;
2722                   ++ctx->Map.pci[ 7 ]
2723                 ) {
2724                   for (
2725                     ctx->Map.pci[ 8 ] = RtemsTaskReqRestart_Pre_Timer_Inactive;
2726                     ctx->Map.pci[ 8 ] < RtemsTaskReqRestart_Pre_Timer_NA;
2727                     ++ctx->Map.pci[ 8 ]
2728                   ) {
2729                     for (
2730                       ctx->Map.pci[ 9 ] = RtemsTaskReqRestart_Pre_RealPriority_Initial;
2731                       ctx->Map.pci[ 9 ] < RtemsTaskReqRestart_Pre_RealPriority_NA;
2732                       ++ctx->Map.pci[ 9 ]
2733                     ) {
2734                       for (
2735                         ctx->Map.pci[ 10 ] = RtemsTaskReqRestart_Pre_ThreadDispatch_Disabled;
2736                         ctx->Map.pci[ 10 ] < RtemsTaskReqRestart_Pre_ThreadDispatch_NA;
2737                         ++ctx->Map.pci[ 10 ]
2738                       ) {
2739                         ctx->Map.entry = RtemsTaskReqRestart_PopEntry( ctx );
2740 
2741                         if ( ctx->Map.entry.Skip ) {
2742                           continue;
2743                         }
2744 
2745                         RtemsTaskReqRestart_SetPreConditionStates( ctx );
2746                         RtemsTaskReqRestart_Prepare( ctx );
2747                         RtemsTaskReqRestart_TestVariant( ctx );
2748                         RtemsTaskReqRestart_Cleanup( ctx );
2749                       }
2750                     }
2751                   }
2752                 }
2753               }
2754             }
2755           }
2756         }
2757       }
2758     }
2759   }
2760 }
2761 
2762 /** @} */