Changeset 7f6a24ab in rtems for cpukit/rtems


Ignore:
Timestamp:
Aug 28, 1995, 3:30:29 PM (26 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
5072b07
Parents:
5250ff39
Message:

Added unused priority ceiling parameter to rtems_semaphore_create.

Rearranged code to created thread handler routines to initialize,
start, restart, and "close/delete" a thread.

Made internal threads their own object class. This now uses the
thread support routines for starting and initializing a thread.

Insured deleted tasks are freed to the Inactive pool associated with the
correct Information block.

Added an RTEMS API specific data area to the thread control block.

Beginnings of removing the word "rtems" from the core.

Location:
cpukit/rtems
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • cpukit/rtems/include/rtems/rtems/asr.h

    r5250ff39 r7f6a24ab  
    5555
    5656typedef struct {
    57   rtems_asr_entry            handler;          /* address of RTEMS_ASR */
    58   rtems_mode          mode_set;         /* RTEMS_ASR mode */
    59   rtems_signal_set signals_posted;   /* signal set */
    60   rtems_signal_set signals_pending;  /* pending signal set */
    61   unsigned32             nest_level;       /* nest level of RTEMS_ASR */
     57  rtems_asr_entry   handler;          /* address of RTEMS_ASR */
     58  Modes_Control     mode_set;         /* RTEMS_ASR mode */
     59  rtems_signal_set  signals_posted;   /* signal set */
     60  rtems_signal_set  signals_pending;  /* pending signal set */
     61  unsigned32        nest_level;       /* nest level of RTEMS_ASR */
    6262}   ASR_Information;
    6363
  • cpukit/rtems/include/rtems/rtems/attr.h

    r5250ff39 r7f6a24ab  
    2828/* constants */
    2929
    30 #define RTEMS_DEFAULT_ATTRIBUTES            0x00000000
     30#define RTEMS_DEFAULT_ATTRIBUTES  0x00000000
    3131
    3232#define RTEMS_NO_FLOATING_POINT   0x00000000 /* don't use FP HW */
  • cpukit/rtems/include/rtems/rtems/modes.h

    r5250ff39 r7f6a24ab  
    2929 */
    3030
    31 typedef unsigned32 rtems_mode;
     31typedef unsigned32 Modes_Control;
    3232
    3333/*
     
    7474
    7575STATIC INLINE unsigned32 RTEMS_INTERRUPT_LEVEL (
    76   rtems_mode mode_set
     76  Modes_Control mode_set
    7777);
    7878
     
    8787
    8888STATIC INLINE boolean _Modes_Mask_changed (
    89   rtems_mode mode_set,
    90   rtems_mode masks
     89  Modes_Control mode_set,
     90  Modes_Control masks
    9191);
    9292
     
    101101
    102102STATIC INLINE boolean _Modes_Is_asr_disabled (
    103   rtems_mode mode_set
     103  Modes_Control mode_set
    104104);
    105105
     
    114114
    115115STATIC INLINE boolean _Modes_Is_preempt (
    116   rtems_mode mode_set
     116  Modes_Control mode_set
    117117);
    118118
     
    127127
    128128STATIC INLINE boolean _Modes_Is_timeslice (
    129   rtems_mode mode_set
     129  Modes_Control mode_set
    130130);
    131131
     
    139139
    140140STATIC INLINE ISR_Level _Modes_Get_interrupt_level (
    141   rtems_mode mode_set
     141  Modes_Control mode_set
    142142);
    143143
     
    152152
    153153STATIC INLINE void _Modes_Set_interrupt_level (
    154   rtems_mode mode_set
     154  Modes_Control mode_set
    155155);
    156156
     
    167167
    168168STATIC INLINE void _Modes_Change (
    169   rtems_mode  old_mode_set,
    170   rtems_mode  new_mode_set,
    171   rtems_mode  mask,
    172   rtems_mode *out_mode_set,
    173   rtems_mode *changed
     169  Modes_Control  old_mode_set,
     170  Modes_Control  new_mode_set,
     171  Modes_Control  mask,
     172  Modes_Control *out_mode_set,
     173  Modes_Control *changed
    174174);
    175175
  • cpukit/rtems/include/rtems/rtems/sem.h

    r5250ff39 r7f6a24ab  
    8383
    8484rtems_status_code rtems_semaphore_create(
    85   rtems_name          name,
    86   unsigned32          count,
    87   rtems_attribute  attribute_set,
    88   Objects_Id         *id
     85  rtems_name            name,
     86  unsigned32            count,
     87  rtems_attribute       attribute_set,
     88  rtems_task_priority   priority_ceiling,
     89  Objects_Id           *id
    8990);
    9091
  • cpukit/rtems/include/rtems/rtems/signal.h

    r5250ff39 r7f6a24ab  
    3232#include <rtems/object.h>
    3333#include <rtems/status.h>
     34#include <rtems/types.h>
    3435
    3536/*
     
    4647rtems_status_code rtems_signal_catch(
    4748  rtems_asr_entry   asr_handler,
    48   rtems_mode mode_set
     49  rtems_mode        mode_set
    4950);
    5051
  • cpukit/rtems/include/rtems/rtems/tasks.h

    r5250ff39 r7f6a24ab  
    4848#include <rtems/thread.h>
    4949#include <rtems/threadq.h>
     50#include <rtems/types.h>
    5051
    5152/*
     
    9596
    9697rtems_status_code rtems_task_create(
    97   rtems_name          name,
    98   rtems_task_priority    initial_priority,
    99   unsigned32          stack_size,
    100   rtems_mode       initial_modes,
    101   rtems_attribute  attribute_set,
    102   Objects_Id         *id
     98  rtems_name           name,
     99  rtems_task_priority  initial_priority,
     100  unsigned32           stack_size,
     101  rtems_mode           initial_modes,
     102  rtems_attribute      attribute_set,
     103  Objects_Id          *id
    103104);
    104105
     
    238239
    239240rtems_status_code rtems_task_set_priority(
    240   Objects_Id        id,
     241  Objects_Id           id,
    241242  rtems_task_priority  new_priority,
    242243  rtems_task_priority *old_priority
     
    325326);
    326327
     328/*
     329 *  _RTEMS_Tasks_Priority_to_Core
     330 *
     331 *  DESCRIPTION:
     332 *
     333 *  This function converts an RTEMS API priority into a core priority.
     334 */
     335 
     336STATIC INLINE Priority_Control _RTEMS_Tasks_Priority_to_Core(
     337  rtems_task_priority   priority
     338);
     339
    327340#include <rtems/tasks.inl>
    328341#include <rtems/taskmp.h>
  • cpukit/rtems/include/rtems/rtems/types.h

    r5250ff39 r7f6a24ab  
    2222
    2323#include <rtems/object.h>
     24#include <rtems/priority.h>
     25#include <rtems/modes.h>
    2426
    2527/*
     
    4951typedef CPU_Interrupt_frame        rtems_interrupt_frame;
    5052
     53/*
     54 *  Define the type for an RTEMS API task priority.
     55 */
     56
     57typedef Priority_Control rtems_task_priority;
     58
     59#define RTEMS_NO_PRIORITY  RTEMS_CURRENT_PRIORITY
     60/*
     61 *  Define the type for an RTEMS API task mode.
     62 */
     63 
     64typedef Modes_Control rtems_mode;
     65
    5166#ifdef __cplusplus
    5267}
  • cpukit/rtems/inline/rtems/rtems/modes.inl

    r5250ff39 r7f6a24ab  
    2424
    2525STATIC INLINE unsigned32 RTEMS_INTERRUPT_LEVEL (
    26   rtems_mode mode_set
     26  Modes_Control mode_set
    2727)
    2828{
     
    3737
    3838STATIC INLINE boolean _Modes_Mask_changed (
    39   rtems_mode mode_set,
    40   rtems_mode masks
     39  Modes_Control mode_set,
     40  Modes_Control masks
    4141)
    4242{
     
    5151
    5252STATIC INLINE boolean _Modes_Is_asr_disabled (
    53   rtems_mode mode_set
     53  Modes_Control mode_set
    5454)
    5555{
     
    6464
    6565STATIC INLINE boolean _Modes_Is_preempt (
    66   rtems_mode mode_set
     66  Modes_Control mode_set
    6767)
    6868{
     
    7777
    7878STATIC INLINE boolean _Modes_Is_timeslice (
    79   rtems_mode mode_set
     79  Modes_Control mode_set
    8080)
    8181{
     
    9191
    9292STATIC INLINE ISR_Level _Modes_Get_interrupt_level (
    93   rtems_mode mode_set
     93  Modes_Control mode_set
    9494)
    9595{
     
    104104
    105105STATIC INLINE void _Modes_Set_interrupt_level (
    106   rtems_mode mode_set
     106  Modes_Control mode_set
    107107)
    108108{
     
    117117
    118118STATIC INLINE void _Modes_Change (
    119   rtems_mode  old_mode_set,
    120   rtems_mode  new_mode_set,
    121   rtems_mode  mask,
    122   rtems_mode *out_mode_set,
    123   rtems_mode *changed
     119  Modes_Control  old_mode_set,
     120  Modes_Control  new_mode_set,
     121  Modes_Control  mask,
     122  Modes_Control *out_mode_set,
     123  Modes_Control *changed
    124124)
    125125{
    126   rtems_mode _out_mode;
     126  Modes_Control _out_mode;
    127127
    128128  _out_mode      =  old_mode_set;
  • cpukit/rtems/inline/rtems/rtems/tasks.inl

    r5250ff39 r7f6a24ab  
    4444)
    4545{
    46   _Objects_Free( &_RTEMS_tasks_Information, &the_task->Object );
     46  _Objects_Free(
     47    _Objects_Get_information( the_task->Object.id ),
     48    &the_task->Object
     49  );
    4750}
    4851
     
    6265  state = the_thread->current_state;
    6366
     67/* XXX do this with the object class */
    6468  if ( _States_Is_waiting_on_thread_queue( state ) ) {
    6569    if ( _States_Is_waiting_for_rpc_reply( state ) &&
     
    9296}
    9397
     98/*PAGE
     99 *
     100 *  _RTEMS_Tasks_Priority_to_Core
     101 */
     102 
     103STATIC INLINE Priority_Control _RTEMS_Tasks_Priority_to_Core(
     104  rtems_task_priority   priority
     105)
     106{
     107  return (Priority_Control) priority;
     108}
     109
    94110#endif
    95111/* end of include file */
  • cpukit/rtems/macros/rtems/rtems/modes.inl

    r5250ff39 r7f6a24ab  
    8989#define _Modes_Change( _old_mode_set, _new_mode_set, \
    9090                       _mask, _out_mode_set, _changed ) \
    91   { rtems_mode _out_mode; \
     91  { Modes_Control _out_mode; \
    9292    \
    9393    _out_mode         =  (_old_mode_set); \
  • cpukit/rtems/macros/rtems/rtems/tasks.inl

    r5250ff39 r7f6a24ab  
    8484  }
    8585
     86/*PAGE
     87 *
     88 *  _RTEMS_Tasks_Priority_to_Core
     89 */
     90 
     91#define _RTEMS_Tasks_Priority_to_Core( _priority ) \
     92  ((Priority_Control) (_priority))
     93
    8694#endif
    8795/* end of include file */
  • cpukit/rtems/src/event.c

    r5250ff39 r7f6a24ab  
    5757      );
    5858    case OBJECTS_LOCAL:
    59       _Event_sets_Post( event_in, &the_thread->pending_events );
     59      _Event_sets_Post( event_in, &the_thread->RTEMS_API->pending_events );
    6060      _Event_Surrender( the_thread );
    6161      _Thread_Enable_dispatch();
     
    9292{
    9393  if ( _Event_sets_Is_empty( event_in ) ) {
    94     *event_out = _Thread_Executing->pending_events;
     94    *event_out = _Thread_Executing->RTEMS_API->pending_events;
    9595    return( RTEMS_SUCCESSFUL );
    9696  }
     
    9999  _Event_Seize( event_in, option_set, ticks );
    100100  _Thread_Enable_dispatch();
    101   *event_out = _Thread_Executing->events_out;
     101  *event_out = _Thread_Executing->RTEMS_API->events_out;
    102102  return( _Thread_Executing->Wait.return_code );
    103103}
  • cpukit/rtems/src/mp.c

    r5250ff39 r7f6a24ab  
    5959  _Event_sets_Post(
    6060    RTEMS_EVENT_0,
    61     &_Internal_threads_System_initialization_thread->pending_events
     61    &_Internal_threads_System_initialization_thread->RTEMS_API->pending_events
    6262  );
    6363  _Event_Surrender( _Internal_threads_System_initialization_thread );
  • cpukit/rtems/src/msg.c

    r5250ff39 r7f6a24ab  
    182182
    183183  if ( _Attributes_Is_global( attribute_set ) &&
    184        !( _Objects_MP_Open( &_Message_queue_Information, name,
     184       !( _Objects_MP_Allocate_and_open( &_Message_queue_Information, name,
    185185                            the_message_queue->Object.id, FALSE ) ) ) {
    186186    _Message_queue_Free( the_message_queue );
     
    196196  _Chain_Initialize_empty( &the_message_queue->Pending_messages );
    197197
    198   _Thread_queue_Initialize( &the_message_queue->Wait_queue, attribute_set,
    199                             STATES_WAITING_FOR_MESSAGE );
     198  _Thread_queue_Initialize(
     199    &the_message_queue->Wait_queue,
     200    OBJECTS_RTEMS_MESSAGE_QUEUES,
     201    _Attributes_Is_priority( attribute_set ) ?
     202       THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
     203    STATES_WAITING_FOR_MESSAGE,
     204    _Message_queue_MP_Send_extract_proxy
     205  );
    200206
    201207  _Objects_Open(
  • cpukit/rtems/src/msgmp.c

    r5250ff39 r7f6a24ab  
    260260    case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE:
    261261
    262       ignored = _Objects_MP_Open(
     262      ignored = _Objects_MP_Allocate_and_open(
    263263                  &_Message_queue_Information,
    264264                  the_packet->name,
  • cpukit/rtems/src/part.c

    r5250ff39 r7f6a24ab  
    108108
    109109  if ( _Attributes_Is_global( attribute_set ) &&
    110        !( _Objects_MP_Open( &_Partition_Information, name,
     110       !( _Objects_MP_Allocate_and_open( &_Partition_Information, name,
    111111                            the_partition->Object.id, FALSE ) ) ) {
    112112    _Partition_Free( the_partition );
  • cpukit/rtems/src/partmp.c

    r5250ff39 r7f6a24ab  
    185185    case PARTITION_MP_ANNOUNCE_CREATE:
    186186
    187       ignored = _Objects_MP_Open(
     187      ignored = _Objects_MP_Allocate_and_open(
    188188                  &_Partition_Information,
    189189                  the_packet->name,
  • cpukit/rtems/src/region.c

    r5250ff39 r7f6a24ab  
    114114
    115115  _Thread_queue_Initialize(
    116      &the_region->Wait_queue, attribute_set, STATES_WAITING_FOR_SEGMENT );
     116    &the_region->Wait_queue,
     117    OBJECTS_RTEMS_REGIONS,
     118    _Attributes_Is_priority( attribute_set ) ?
     119       THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
     120    STATES_WAITING_FOR_SEGMENT,
     121    _Region_MP_Send_extract_proxy
     122  );
    117123
    118124  _Objects_Open( &_Region_Information, &the_region->Object, &name );
  • cpukit/rtems/src/regionmp.c

    r5250ff39 r7f6a24ab  
    191191    case REGION_MP_ANNOUNCE_CREATE:
    192192
    193       ignored = _Objects_MP_Open(
     193      ignored = _Objects_MP_Allocate_and_open(
    194194                  &_Region_Information,
    195195                  the_packet->name,
  • cpukit/rtems/src/sem.c

    r5250ff39 r7f6a24ab  
    8888
    8989rtems_status_code rtems_semaphore_create(
    90   rtems_name          name,
    91   unsigned32          count,
    92   rtems_attribute  attribute_set,
    93   Objects_Id         *id
     90  rtems_name            name,
     91  unsigned32            count,
     92  rtems_attribute       attribute_set,
     93  rtems_task_priority   priority_ceiling,
     94  Objects_Id           *id
    9495)
    9596{
     
    128129
    129130  if ( _Attributes_Is_global( attribute_set ) &&
    130        !( _Objects_MP_Open( &_Semaphore_Information, name,
     131       !( _Objects_MP_Allocate_and_open( &_Semaphore_Information, name,
    131132                            the_semaphore->Object.id, FALSE ) ) ) {
    132133    _Semaphore_Free( the_semaphore );
     
    149150  }
    150151
    151   _Thread_queue_Initialize( &the_semaphore->Wait_queue,
    152                             attribute_set, STATES_WAITING_FOR_SEMAPHORE );
     152  _Thread_queue_Initialize(
     153    &the_semaphore->Wait_queue,
     154    OBJECTS_RTEMS_SEMAPHORES,
     155    _Attributes_Is_priority( attribute_set ) ?
     156       THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
     157    STATES_WAITING_FOR_SEMAPHORE,
     158    _Semaphore_MP_Send_extract_proxy
     159  );
    153160
    154161  _Objects_Open( &_Semaphore_Information, &the_semaphore->Object, &name );
  • cpukit/rtems/src/semmp.c

    r5250ff39 r7f6a24ab  
    188188    case SEMAPHORE_MP_ANNOUNCE_CREATE:
    189189
    190       ignored = _Objects_MP_Open(
     190      ignored = _Objects_MP_Allocate_and_open(
    191191                  &_Semaphore_Information,
    192192                  the_packet->name,
  • cpukit/rtems/src/signal.c

    r5250ff39 r7f6a24ab  
    3838
    3939rtems_status_code rtems_signal_catch(
    40   rtems_asr_entry   handler,
    41   rtems_mode mode_set
     40  rtems_asr_entry   asr_handler,
     41  rtems_mode        mode_set
    4242)
    4343{
    4444  Thread_Control *executing;
    4545
     46/* XXX normalize mode */
    4647  executing = _Thread_Executing;
    4748  _Thread_Disable_dispatch(); /* cannot reschedule while */
    4849                              /*   the thread is inconsistent */
    4950
    50   if ( ! _ASR_Is_null_handler( handler ) ) {
    51     executing->Signal.mode_set = mode_set;
    52     executing->Signal.handler  = handler;
     51  if ( !_ASR_Is_null_handler( asr_handler ) ) {
     52    executing->RTEMS_API->Signal.mode_set = mode_set;
     53    executing->RTEMS_API->Signal.handler  = asr_handler;
    5354  }
    5455  else
    55     _ASR_Initialize( &executing->Signal );
     56    _ASR_Initialize( &executing->RTEMS_API->Signal );
    5657  _Thread_Enable_dispatch();
    5758  return( RTEMS_SUCCESSFUL );
     
    9293      );
    9394    case OBJECTS_LOCAL:
    94       if ( ! _ASR_Is_null_handler( the_thread->Signal.handler ) ) {
     95      if ( ! _ASR_Is_null_handler( the_thread->RTEMS_API->Signal.handler ) ) {
    9596        if ( _Modes_Is_asr_disabled( the_thread->current_modes ) )
    96           _ASR_Post_signals( signal_set, &the_thread->Signal.signals_pending );
     97          _ASR_Post_signals(
     98            signal_set, &the_thread->RTEMS_API->Signal.signals_pending );
    9799        else {
    98           _ASR_Post_signals( signal_set, &the_thread->Signal.signals_posted );
     100          _ASR_Post_signals(
     101            signal_set, &the_thread->RTEMS_API->Signal.signals_posted );
    99102          if ( _ISR_Is_in_progress() && _Thread_Is_executing( the_thread ) )
    100103            _ISR_Signals_to_thread_executing = TRUE;
  • cpukit/rtems/src/taskmp.c

    r5250ff39 r7f6a24ab  
    194194    case RTEMS_TASKS_MP_ANNOUNCE_CREATE:
    195195
    196       ignored = _Objects_MP_Open(
     196      ignored = _Objects_MP_Allocate_and_open(
    197197                  &_RTEMS_tasks_Information,
    198198                  the_packet->name,
  • cpukit/rtems/src/tasks.c

    r5250ff39 r7f6a24ab  
    8787{
    8888  register Thread_Control *the_thread;
    89   unsigned32               actual_stack_size;
    90   unsigned32               memory_needed;
    91   void                    *memory;
     89  Objects_MP_Control      *the_global_object = NULL;
     90  boolean                  is_fp;
     91  boolean                  is_global;
    9292  rtems_attribute          the_attribute_set;
     93  Priority_Control         core_priority;
     94 
    9395
    9496  if ( !rtems_is_name_valid( name ) )
    9597    return ( RTEMS_INVALID_NAME );
     98
     99  /*
     100   *  Core Thread Initialize insures we get the minimum amount of
     101   *  stack space.
     102   */
    96103
    97104#if 0
     
    100107#endif
    101108
    102   if ( !_Stack_Is_enough( stack_size ) )
    103     actual_stack_size = RTEMS_MINIMUM_STACK_SIZE;
    104   else
    105     actual_stack_size = stack_size;
     109  /*
     110   *  Validate the RTEMS API priority and convert it to the core priority range.
     111   */
    106112
    107113  if ( !_Priority_Is_valid( initial_priority ) )
    108114    return( RTEMS_INVALID_PRIORITY );
     115
     116  core_priority = _RTEMS_Tasks_Priority_to_Core( initial_priority );
    109117
    110118  /*
     
    121129    _Attributes_Clear( the_attribute_set, ATTRIBUTES_NOT_SUPPORTED );
    122130
    123   if ( _Attributes_Is_global( the_attribute_set ) &&
    124        !_Configuration_Is_multiprocessing() )
    125     return( RTEMS_MP_NOT_CONFIGURED );
    126 
    127   _Thread_Disable_dispatch();          /* to prevent deletion */
     131  if ( _Attributes_Is_floating_point( the_attribute_set ) )
     132    is_fp = TRUE;
     133  else
     134    is_fp = FALSE;
     135
     136  if ( _Attributes_Is_global( the_attribute_set ) ) {
     137
     138    is_global = TRUE;
     139
     140    if ( !_Configuration_Is_multiprocessing() )
     141      return( RTEMS_MP_NOT_CONFIGURED );
     142
     143  } else
     144    is_global = FALSE;
     145
     146  /*
     147   *  Make sure system is MP if this task is global
     148   */
     149
     150  /*
     151   *  Disable dispatch for protection
     152   */
     153
     154  _Thread_Disable_dispatch();
     155
     156  /*
     157   *  Allocate the thread control block and -- if the task is global --
     158   *  allocate a global object control block.
     159   *
     160   *  NOTE:  This routine does not use the combined allocate and open
     161   *         global object routine because this results in a lack of
     162   *         control over when memory is allocated and can be freed in
     163   *         the event of an error.
     164   */
    128165
    129166  the_thread = _RTEMS_tasks_Allocate();
     
    134171  }
    135172
    136   actual_stack_size = _Stack_Adjust_size( actual_stack_size );
    137   memory_needed = actual_stack_size;
    138 
    139   if ( _Attributes_Is_floating_point( the_attribute_set ) )
    140     memory_needed += CONTEXT_FP_SIZE;
    141 
    142   memory = _Workspace_Allocate( memory_needed );
    143 
    144   if ( !memory ) {
     173  if ( is_global ) {
     174    the_global_object = _Objects_MP_Allocate_global_object();
     175
     176    if ( _Objects_MP_Is_null_global_object( the_global_object ) ) {
     177      _RTEMS_tasks_Free( the_thread );
     178      _Thread_Enable_dispatch();
     179      return( RTEMS_TOO_MANY );
     180    }
     181  }
     182
     183#if 0
     184  /*
     185   *  Allocate and initialize the RTEMS API specific information
     186   */
     187
     188  the_thread->RTEMS_API = _Workspace_Allocate( sizeof( RTEMS_API_Control ) );
     189
     190  if ( !the_thread->RTEMS_API ) {
     191    _RTEMS_tasks_Free( the_thread );
     192    if ( is_global )
     193    _Objects_MP_Free_global_object( the_global_object );
     194    _Thread_Enable_dispatch();
     195    return( RTEMS_UNSATISFIED );
     196  }
     197
     198  the_thread->RTEMS_API->pending_events         = EVENT_SETS_NONE_PENDING;
     199  _ASR_Initialize( &the_thread->RTEMS_API->Signal );
     200#endif
     201
     202  /*
     203   *  Initialize the core thread for this task.
     204   */
     205
     206/* XXX normalize mode */
     207
     208  if ( !_Thread_Initialize( &_RTEMS_tasks_Information, the_thread,
     209         NULL, stack_size, is_fp, core_priority, initial_modes, &name ) ) {
     210    if ( is_global )
     211      _Objects_MP_Free_global_object( the_global_object );
    145212    _RTEMS_tasks_Free( the_thread );
    146213    _Thread_Enable_dispatch();
     
    148215  }
    149216
    150   /*
    151    *  Stack is put in the lower address regions of the allocated memory.
    152    *  The optional floating point context area goes into the higher part
    153    *  of the allocated memory.
    154    */
    155 
    156   _Stack_Initialize(
    157      &the_thread->Start.Initial_stack, memory, actual_stack_size );
    158 
    159   if ( _Attributes_Is_floating_point( the_attribute_set ) )
    160     the_thread->fp_context = _Context_Fp_start( memory, actual_stack_size );
    161   else
    162     the_thread->fp_context = NULL;
    163 
    164   the_thread->Start.fp_context = the_thread->fp_context;
    165 
    166   if ( _Attributes_Is_global( the_attribute_set ) &&
    167        !( _Objects_MP_Open( &_RTEMS_tasks_Information, name,
    168                             the_thread->Object.id, FALSE ) ) ) {
    169     _RTEMS_tasks_Free( the_thread );
    170     (void) _Workspace_Free( memory );
    171     _Thread_Enable_dispatch();
    172     return( RTEMS_TOO_MANY );
    173   }
    174 
    175   the_thread->attribute_set          = the_attribute_set;
    176   the_thread->current_state          = STATES_DORMANT;
    177   the_thread->current_modes          = initial_modes;
    178   the_thread->pending_events         = EVENT_SETS_NONE_PENDING;
    179   the_thread->resource_count         = 0;
    180   the_thread->real_priority          = initial_priority;
    181   the_thread->Start.initial_priority = initial_priority;
    182   the_thread->Start.initial_modes    = initial_modes;
    183 
    184   _Thread_Set_priority( the_thread, initial_priority );
    185 
    186   _ASR_Initialize( &the_thread->Signal );
    187 
    188   _Objects_Open( &_RTEMS_tasks_Information, &the_thread->Object, &name );
    189 
    190217  *id = the_thread->Object.id;
    191218
    192   _User_extensions_Task_create( the_thread );
    193 
    194   if ( _Attributes_Is_global( the_attribute_set ) )
     219  if ( is_global ) {
     220
     221    the_thread->RTEMS_API->is_global = TRUE;
     222
     223    _Objects_MP_Open(
     224      &_RTEMS_tasks_Information,
     225      the_global_object,
     226      name,
     227      the_thread->Object.id
     228    );
     229
    195230    _RTEMS_tasks_MP_Send_process_packet(
    196231      RTEMS_TASKS_MP_ANNOUNCE_CREATE,
     
    199234    );
    200235
     236   }
     237
    201238  _Thread_Enable_dispatch();
    202239  return( RTEMS_SUCCESSFUL );
     
    253290
    254291rtems_status_code rtems_task_start(
    255   Objects_Id   id,
     292  rtems_id         id,
    256293  rtems_task_entry entry_point,
    257   unsigned32   argument
     294  unsigned32       argument
    258295)
    259296{
     
    272309      return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT );
    273310    case OBJECTS_LOCAL:
    274       if ( _States_Is_dormant( the_thread->current_state ) ) {
    275 
    276         the_thread->Start.entry_point      = entry_point;
    277         the_thread->Start.initial_argument = argument;
    278 
    279         _Thread_Load_environment( the_thread );
    280 
    281         _Thread_Ready( the_thread );
    282 
    283         _User_extensions_Task_start( the_thread );
    284 
     311      if ( _Thread_Start(
     312             the_thread, THREAD_START_NUMERIC, entry_point, NULL, argument ) ) {
    285313        _Thread_Enable_dispatch();
    286314        return( RTEMS_SUCCESSFUL );
     
    317345{
    318346  register Thread_Control *the_thread;
    319   Objects_Locations               location;
     347  Objects_Locations        location;
    320348
    321349  the_thread = _Thread_Get( id, &location );
     
    327355      return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT );
    328356    case OBJECTS_LOCAL:
    329       if ( !_States_Is_dormant( the_thread->current_state ) ) {
    330 
    331         _Thread_Set_transient( the_thread );
    332         _ASR_Initialize( &the_thread->Signal );
    333         the_thread->pending_events = EVENT_SETS_NONE_PENDING;
    334         the_thread->resource_count = 0;
    335         the_thread->current_modes  = the_thread->Start.initial_modes;
    336         the_thread->Start.initial_argument = argument;
    337 
    338         _RTEMS_tasks_Cancel_wait( the_thread );
    339 
    340         if ( the_thread->current_priority !=
    341                          the_thread->Start.initial_priority ) {
    342           the_thread->real_priority = the_thread->Start.initial_priority;
    343           _Thread_Set_priority( the_thread,
    344              the_thread->Start.initial_priority );
    345         }
    346 
    347         _Thread_Load_environment( the_thread );
    348 
    349         _Thread_Ready( the_thread );
    350 
    351         _User_extensions_Task_restart( the_thread );
    352 
    353         if ( _Thread_Is_executing ( the_thread ) )
    354           _Thread_Restart_self();
     357      if ( _Thread_Restart( the_thread, NULL, argument ) ) {
     358
     359        /*  XXX until these are in an API extension they are too late. */
     360        _ASR_Initialize( &the_thread->RTEMS_API->Signal );
     361        the_thread->RTEMS_API->pending_events = EVENT_SETS_NONE_PENDING;
    355362
    356363        _Thread_Enable_dispatch();
     
    397404      return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT );
    398405    case OBJECTS_LOCAL:
    399       _Objects_Close( &_RTEMS_tasks_Information, &the_thread->Object );
    400 
    401       _Thread_Set_state( the_thread, STATES_TRANSIENT );
    402 
    403       _User_extensions_Task_delete( the_thread );
    404 
    405 #if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE )
    406       if ( _Thread_Is_allocated_fp( the_thread ) )
    407         _Thread_Deallocate_fp();
    408 #endif
    409       the_thread->fp_context = NULL;
    410 
    411       _RTEMS_tasks_Cancel_wait( the_thread );
    412 
    413       (void) _Workspace_Free( the_thread->Start.Initial_stack.area );
     406      _Thread_Close( &_RTEMS_tasks_Information, the_thread );
     407
     408      /* XXX */
     409      (void) _Workspace_Free( the_thread->RTEMS_API );
    414410
    415411      _RTEMS_tasks_Free( the_thread );
    416412
    417       if ( _Attributes_Is_global( the_thread->attribute_set ) ) {
     413      if ( _Attributes_Is_global( the_thread->RTEMS_API->is_global ) ) {
    418414
    419415        _Objects_MP_Close( &_RTEMS_tasks_Information, the_thread->Object.id );
     
    552548
    553549rtems_status_code rtems_task_set_priority(
    554   Objects_Id        id,
     550  Objects_Id           id,
    555551  rtems_task_priority  new_priority,
    556552  rtems_task_priority *old_priority
     
    663659  if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ||
    664660       _Objects_Are_ids_equal( id, _Thread_Executing->Object.id ) ) {
    665       *note = _Thread_Executing->Notepads[ notepad ];
     661      *note = _Thread_Executing->RTEMS_API->Notepads[ notepad ];
    666662      return( RTEMS_SUCCESSFUL );
    667663  }
     
    682678      );
    683679    case OBJECTS_LOCAL:
    684       *note= the_thread->Notepads[ notepad ];
     680      *note= the_thread->RTEMS_API->Notepads[ notepad ];
    685681      _Thread_Enable_dispatch();
    686682      return( RTEMS_SUCCESSFUL );
     
    730726  if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ||
    731727       _Objects_Are_ids_equal( id, _Thread_Executing->Object.id ) ) {
    732       _Thread_Executing->Notepads[ notepad ] = note;
     728      _Thread_Executing->RTEMS_API->Notepads[ notepad ] = note;
    733729      return( RTEMS_SUCCESSFUL );
    734730  }
     
    748744
    749745    case OBJECTS_LOCAL:
    750       the_thread->Notepads[ notepad ] = note;
     746      the_thread->RTEMS_API->Notepads[ notepad ] = note;
    751747      _Thread_Enable_dispatch();
    752748      return( RTEMS_SUCCESSFUL );
Note: See TracChangeset for help on using the changeset viewer.