summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/score/src')
-rw-r--r--cpukit/score/src/chain.c6
-rw-r--r--cpukit/score/src/coremutex.c269
-rw-r--r--cpukit/score/src/coresem.c185
-rw-r--r--cpukit/score/src/coretod.c30
-rw-r--r--cpukit/score/src/heap.c4
-rw-r--r--cpukit/score/src/interr.c61
-rw-r--r--cpukit/score/src/isr.c60
-rw-r--r--cpukit/score/src/mpci.c181
-rw-r--r--cpukit/score/src/object.c62
-rw-r--r--cpukit/score/src/objectmp.c53
-rw-r--r--cpukit/score/src/thread.c237
-rw-r--r--cpukit/score/src/threadmp.c15
-rw-r--r--cpukit/score/src/threadq.c72
-rw-r--r--cpukit/score/src/userext.c56
-rw-r--r--cpukit/score/src/watchdog.c14
-rw-r--r--cpukit/score/src/wkspace.c10
16 files changed, 1006 insertions, 309 deletions
diff --git a/cpukit/score/src/chain.c b/cpukit/score/src/chain.c
index 88f6759b0b..3cea8ea90f 100644
--- a/cpukit/score/src/chain.c
+++ b/cpukit/score/src/chain.c
@@ -18,9 +18,9 @@
*/
#include <rtems/system.h>
-#include <rtems/address.h>
-#include <rtems/chain.h>
-#include <rtems/isr.h>
+#include <rtems/core/address.h>
+#include <rtems/core/chain.h>
+#include <rtems/core/isr.h>
/*PAGE
*
diff --git a/cpukit/score/src/coremutex.c b/cpukit/score/src/coremutex.c
new file mode 100644
index 0000000000..ea2b5773e1
--- /dev/null
+++ b/cpukit/score/src/coremutex.c
@@ -0,0 +1,269 @@
+/*
+ * Mutex Handler
+ *
+ * DESCRIPTION:
+ *
+ * This package is the implementation of the Mutex Handler.
+ * This handler provides synchronization and mutual exclusion capabilities.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/core/isr.h>
+#include <rtems/core/coremutex.h>
+#include <rtems/core/states.h>
+#include <rtems/core/thread.h>
+#include <rtems/core/threadq.h>
+
+/*PAGE
+ *
+ * _CORE_mutex_Initialize
+ *
+ * This routine initializes a mutex at create time and set the control
+ * structure according to the values passed.
+ *
+ * Input parameters:
+ * the_mutex - the mutex control block to initialize
+ * the_class - the API class of the object
+ * the_mutex_attributes - the mutex attributes specified at create time
+ * initial_lock - mutex initial lock or unlocked status
+ * proxy_extract_callout - MP specific extract callout
+ *
+ * Output parameters: NONE
+ */
+
+void _CORE_mutex_Initialize(
+ CORE_mutex_Control *the_mutex,
+ Objects_Classes the_class,
+ CORE_mutex_Attributes *the_mutex_attributes,
+ unsigned32 initial_lock,
+ Thread_queue_Extract_callout proxy_extract_callout
+)
+{
+
+/* Add this to the RTEMS environment later ?????????
+ rtems_assert( initial_lock == CORE_MUTEX_LOCKED ||
+ initial_lock == CORE_MUTEX_UNLOCKED );
+ */
+
+ the_mutex->Attributes = *the_mutex_attributes;
+ the_mutex->lock = initial_lock;
+
+ if ( initial_lock == CORE_MUTEX_LOCKED ) {
+ the_mutex->nest_count = 1;
+ the_mutex->holder = _Thread_Executing;
+ the_mutex->holder_id = _Thread_Executing->Object.id;
+ _Thread_Executing->resource_count++;
+ } else {
+ the_mutex->nest_count = 0;
+ the_mutex->holder = NULL;
+ the_mutex->holder_id = 0;
+ }
+
+ _Thread_queue_Initialize(
+ &the_mutex->Wait_queue,
+ the_class,
+ _CORE_mutex_Is_priority( the_mutex_attributes ) ?
+ THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
+ STATES_WAITING_FOR_MUTEX,
+ proxy_extract_callout,
+ CORE_MUTEX_TIMEOUT
+ );
+}
+
+/*PAGE
+ *
+ * _CORE_mutex_Seize
+ *
+ * This routine attempts to allocate a mutex to the calling thread.
+ *
+ * Input parameters:
+ * the_mutex - pointer to mutex control block
+ * id - id of object to wait on
+ * wait - TRUE if wait is allowed, FALSE otherwise
+ * timeout - number of ticks to wait (0 means forever)
+ *
+ * Output parameters: NONE
+ *
+ * INTERRUPT LATENCY:
+ * available
+ * wait
+ */
+
+void _CORE_mutex_Seize(
+ CORE_mutex_Control *the_mutex,
+ Objects_Id id,
+ boolean wait,
+ Watchdog_Interval timeout
+)
+{
+ Thread_Control *executing;
+ ISR_Level level;
+
+ executing = _Thread_Executing;
+ executing->Wait.return_code = CORE_MUTEX_STATUS_SUCCESSFUL;
+ _ISR_Disable( level );
+ if ( ! _CORE_mutex_Is_locked( the_mutex ) ) {
+ the_mutex->lock = CORE_MUTEX_LOCKED;
+ the_mutex->holder = executing;
+ the_mutex->holder_id = executing->Object.id;
+ the_mutex->nest_count = 1;
+ executing->resource_count++;
+ _ISR_Enable( level );
+ return;
+ }
+
+ if ( !wait ) {
+ _ISR_Enable( level );
+ executing->Wait.return_code = CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT;
+ return;
+ }
+
+ if ( _Objects_Are_ids_equal(
+ _Thread_Executing->Object.id, the_mutex->holder_id ) ) {
+ if ( _CORE_mutex_Is_nesting_allowed( &the_mutex->Attributes ) )
+ the_mutex->nest_count++;
+ else
+ executing->Wait.return_code = CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED;
+
+ _ISR_Enable( level );
+ return;
+ }
+
+ the_mutex->Wait_queue.sync = TRUE;
+ executing->Wait.queue = &the_mutex->Wait_queue;
+ executing->Wait.id = id;
+ _ISR_Enable( level );
+
+ if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) &&
+ the_mutex->holder->current_priority >
+ _Thread_Executing->current_priority ) {
+ _Thread_Change_priority(
+ the_mutex->holder, _Thread_Executing->current_priority );
+ }
+
+ _Thread_queue_Enqueue( &the_mutex->Wait_queue, timeout );
+}
+
+/*
+ * _CORE_mutex_Surrender
+ *
+ * DESCRIPTION:
+ *
+ * This routine frees a unit to the mutex. If a task was blocked waiting for
+ * a unit from this mutex, then that task will be readied and the unit
+ * given to that task. Otherwise, the unit will be returned to the mutex.
+ *
+ * Input parameters:
+ * the_mutex - the mutex to be flushed
+ * id - id of parent mutex
+ * api_mutex_mp_support - api dependent MP support actions
+ *
+ * Output parameters:
+ * CORE_MUTEX_STATUS_SUCCESSFUL - if successful
+ * core error code - if unsuccessful
+ */
+
+CORE_mutex_Status _CORE_mutex_Surrender(
+ CORE_mutex_Control *the_mutex,
+ Objects_Id id,
+ CORE_mutex_API_mp_support_callout api_mutex_mp_support
+)
+{
+ Thread_Control *the_thread;
+
+ if ( !_Objects_Are_ids_equal(
+ _Thread_Executing->Object.id, the_mutex->holder_id ) )
+ return( CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE );
+
+ the_mutex->nest_count--;
+
+ if ( the_mutex->nest_count != 0 )
+ return( CORE_MUTEX_STATUS_SUCCESSFUL );
+
+ _Thread_Executing->resource_count--;
+ the_mutex->holder = NULL;
+ the_mutex->holder_id = 0;
+
+ /*
+ * Whether or not someone is waiting for the mutex, an
+ * inherited priority must be lowered if this is the last
+ * mutex (i.e. resource) this task has.
+ */
+
+ if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) &&
+ _Thread_Executing->resource_count == 0 &&
+ _Thread_Executing->real_priority !=
+ _Thread_Executing->current_priority ) {
+ _Thread_Change_priority(
+ _Thread_Executing,
+ _Thread_Executing->real_priority
+ );
+ }
+
+ if ( ( the_thread = _Thread_queue_Dequeue( &the_mutex->Wait_queue ) ) ) {
+
+ if ( !_Objects_Is_local_id( the_thread->Object.id ) ) {
+
+ the_mutex->holder = NULL;
+ the_mutex->holder_id = the_thread->Object.id;
+ the_mutex->nest_count = 1;
+
+ ( *api_mutex_mp_support)( the_thread, id );
+
+ } else {
+
+ the_mutex->holder = the_thread;
+ the_mutex->holder_id = the_thread->Object.id;
+ the_thread->resource_count++;
+ the_mutex->nest_count = 1;
+
+ /*
+ * No special action for priority inheritance because the_thread
+ * is guaranteed to be the highest priority thread waiting for
+ * the mutex.
+ */
+ }
+ } else
+ the_mutex->lock = CORE_MUTEX_UNLOCKED;
+
+ return( CORE_MUTEX_STATUS_SUCCESSFUL );
+}
+
+/*PAGE
+ *
+ * _CORE_mutex_Flush
+ *
+ * This function a flushes the mutex's task wait queue.
+ *
+ * Input parameters:
+ * the_mutex - the mutex to be flushed
+ * remote_extract_callout - function to invoke remotely
+ * status - status to pass to thread
+ *
+ * Output parameters: NONE
+ */
+
+void _CORE_mutex_Flush(
+ CORE_mutex_Control *the_mutex,
+ Thread_queue_Flush_callout remote_extract_callout,
+ unsigned32 status
+)
+{
+
+ _Thread_queue_Flush(
+ &the_mutex->Wait_queue,
+ remote_extract_callout,
+ status
+ );
+
+}
diff --git a/cpukit/score/src/coresem.c b/cpukit/score/src/coresem.c
new file mode 100644
index 0000000000..e7e1705f3c
--- /dev/null
+++ b/cpukit/score/src/coresem.c
@@ -0,0 +1,185 @@
+/*
+ * CORE Semaphore Handler
+ *
+ * DESCRIPTION:
+ *
+ * This package is the implementation of the CORE Semaphore Handler.
+ * This core object utilizes standard Dijkstra counting semaphores to provide
+ * synchronization and mutual exclusion capabilities.
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/core/isr.h>
+#include <rtems/core/coresem.h>
+#include <rtems/core/states.h>
+#include <rtems/core/thread.h>
+#include <rtems/core/threadq.h>
+#include <rtems/core/mpci.h>
+
+/*PAGE
+ *
+ * CORE_semaphore_Initialize
+ *
+ * This function initialize a semaphore and sets the initial value based
+ * on the given count.
+ *
+ * Input parameters:
+ * the_semaphore - the semaphore control block to initialize
+ * the_class - the API class of the object
+ * the_semaphore_attributes - the attributes specified at create time
+ * initial_value - semaphore's initial value
+ * proxy_extract_callout - MP specific extract callout
+ *
+ * Output parameters: NONE
+ */
+
+void _CORE_semaphore_Initialize(
+ CORE_semaphore_Control *the_semaphore,
+ Objects_Classes the_class,
+ CORE_semaphore_Attributes *the_semaphore_attributes,
+ unsigned32 initial_value,
+ Thread_queue_Extract_callout proxy_extract_callout
+)
+{
+
+ the_semaphore->Attributes = *the_semaphore_attributes;
+ the_semaphore->count = initial_value;
+
+ _Thread_queue_Initialize(
+ &the_semaphore->Wait_queue,
+ the_class,
+ _CORE_semaphore_Is_priority( the_semaphore_attributes ) ?
+ THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
+ STATES_WAITING_FOR_SEMAPHORE,
+ proxy_extract_callout,
+ CORE_SEMAPHORE_TIMEOUT
+ );
+}
+
+/*PAGE
+ *
+ * _CORE_semaphore_Surrender
+ *
+ * Input parameters:
+ * the_semaphore - the semaphore to be flushed
+ * id - id of parent semaphore
+ * api_semaphore_mp_support - api dependent MP support actions
+ *
+ * Output parameters:
+ * CORE_SEMAPHORE_STATUS_SUCCESSFUL - if successful
+ * core error code - if unsuccessful
+ *
+ * Output parameters:
+ */
+
+CORE_semaphore_Status _CORE_semaphore_Surrender(
+ CORE_semaphore_Control *the_semaphore,
+ Objects_Id id,
+ CORE_semaphore_API_mp_support_callout api_semaphore_mp_support
+)
+{
+ Thread_Control *the_thread;
+
+ if ( (the_thread = _Thread_queue_Dequeue(&the_semaphore->Wait_queue)) ) {
+
+ if ( !_Objects_Is_local_id( the_thread->Object.id ) )
+ (*api_semaphore_mp_support) ( the_thread, id );
+
+ } else
+ the_semaphore->count += 1;
+
+ return( CORE_SEMAPHORE_STATUS_SUCCESSFUL );
+}
+
+/*PAGE
+ *
+ * _CORE_semaphore_Seize
+ *
+ * This routine attempts to allocate a core semaphore to the calling thread.
+ *
+ * Input parameters:
+ * the_semaphore - pointer to semaphore control block
+ * id - id of object to wait on
+ * wait - TRUE if wait is allowed, FALSE otherwise
+ * timeout - number of ticks to wait (0 means forever)
+ *
+ * Output parameters: NONE
+ *
+ * INTERRUPT LATENCY:
+ * available
+ * wait
+ */
+
+void _CORE_semaphore_Seize(
+ CORE_semaphore_Control *the_semaphore,
+ Objects_Id id,
+ boolean wait,
+ Watchdog_Interval timeout
+)
+{
+ Thread_Control *executing;
+ ISR_Level level;
+
+ executing = _Thread_Executing;
+ executing->Wait.return_code = CORE_SEMAPHORE_STATUS_SUCCESSFUL;
+ _ISR_Disable( level );
+ if ( the_semaphore->count != 0 ) {
+ the_semaphore->count -= 1;
+ executing->resource_count++;
+ _ISR_Enable( level );
+ return;
+ }
+
+ if ( !wait ) {
+ _ISR_Enable( level );
+ executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT;
+ return;
+ }
+
+ the_semaphore->Wait_queue.sync = TRUE;
+ executing->Wait.queue = &the_semaphore->Wait_queue;
+ executing->Wait.id = id;
+ _ISR_Enable( level );
+
+ _Thread_queue_Enqueue( &the_semaphore->Wait_queue, timeout );
+}
+
+
+/*PAGE
+ *
+ * _CORE_semaphore_Flush
+ *
+ * This function a flushes the semaphore's task wait queue.
+ *
+ * Input parameters:
+ * the_semaphore - the semaphore to be flushed
+ * remote_extract_callout - function to invoke remotely
+ * status - status to pass to thread
+ *
+ * Output parameters: NONE
+ */
+
+void _CORE_semaphore_Flush(
+ CORE_semaphore_Control *the_semaphore,
+ Thread_queue_Flush_callout remote_extract_callout,
+ unsigned32 status
+)
+{
+
+ _Thread_queue_Flush(
+ &the_semaphore->Wait_queue,
+ remote_extract_callout,
+ status
+ );
+
+}
diff --git a/cpukit/score/src/coretod.c b/cpukit/score/src/coretod.c
index 4689c637d7..ab464664f6 100644
--- a/cpukit/score/src/coretod.c
+++ b/cpukit/score/src/coretod.c
@@ -14,10 +14,10 @@
*/
#include <rtems/system.h>
-#include <rtems/object.h>
-#include <rtems/thread.h>
-#include <rtems/tod.h>
-#include <rtems/watchdog.h>
+#include <rtems/core/object.h>
+#include <rtems/core/thread.h>
+#include <rtems/core/tod.h>
+#include <rtems/core/watchdog.h>
/*PAGE
*
@@ -72,11 +72,11 @@ void _TOD_Handler_initialization(
*/
void _TOD_Set(
- rtems_time_of_day *the_tod,
- rtems_interval seconds_since_epoch
+ TOD_Control *the_tod,
+ Watchdog_Interval seconds_since_epoch
)
{
- rtems_interval ticks_until_next_second;
+ Watchdog_Interval ticks_until_next_second;
_Thread_Disable_dispatch();
_TOD_Deactivate();
@@ -109,14 +109,14 @@ void _TOD_Set(
* the_tod - pointer to a time and date structure
*
* Output parameters:
- * RTEMS_SUCCESSFUL - if the date, time, and tick are valid
- * RTEMS_INVALID_CLOCK - if the the_tod is invalid
+ * TRUE - if the date, time, and tick are valid
+ * FALSE - if the the_tod is invalid
*
* NOTE: This routine only works for leap-years through 2099.
*/
-rtems_status_code _TOD_Validate(
- rtems_time_of_day *the_tod
+boolean _TOD_Validate(
+ TOD_Control *the_tod
)
{
unsigned32 days_in_month;
@@ -129,7 +129,7 @@ rtems_status_code _TOD_Validate(
(the_tod->month > TOD_MONTHS_PER_YEAR) ||
(the_tod->year < TOD_BASE_YEAR) ||
(the_tod->day == 0) )
- return RTEMS_INVALID_CLOCK;
+ return FALSE;
if ( (the_tod->year % 4) == 0 )
days_in_month = _TOD_Days_per_month[ 1 ][ the_tod->month ];
@@ -137,9 +137,9 @@ rtems_status_code _TOD_Validate(
days_in_month = _TOD_Days_per_month[ 0 ][ the_tod->month ];
if ( the_tod->day > days_in_month )
- return RTEMS_INVALID_CLOCK;
+ return FALSE;
- return RTEMS_SUCCESSFUL;
+ return TRUE;
}
/*PAGE
@@ -157,7 +157,7 @@ rtems_status_code _TOD_Validate(
*/
unsigned32 _TOD_To_seconds(
- rtems_time_of_day *the_tod
+ TOD_Control *the_tod
)
{
unsigned32 time;
diff --git a/cpukit/score/src/heap.c b/cpukit/score/src/heap.c
index eb1c5d769e..b16cfde9de 100644
--- a/cpukit/score/src/heap.c
+++ b/cpukit/score/src/heap.c
@@ -14,7 +14,7 @@
#include <rtems/system.h>
-#include <rtems/heap.h>
+#include <rtems/core/heap.h>
#include <rtems/sysstate.h>
/*PAGE
@@ -30,7 +30,7 @@
* page_size - allocatable unit of memory
*
* Output parameters:
- * returns - maximum memory available if RTEMS_SUCCESSFUL
+ * returns - maximum memory available if successfully initialized
* 0 - otherwise
*
* This is what a heap looks like in memory immediately
diff --git a/cpukit/score/src/interr.c b/cpukit/score/src/interr.c
new file mode 100644
index 0000000000..3eb2bc1746
--- /dev/null
+++ b/cpukit/score/src/interr.c
@@ -0,0 +1,61 @@
+/*
+ * Internal Error Handler
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/core/interr.h>
+#include <rtems/sysstate.h>
+#include <rtems/core/userext.h>
+
+/*PAGE
+ *
+ * _Internal_error_Occurred
+ *
+ * This routine will invoke the fatal error handler supplied by the user
+ * followed by the the default one provided by the executive. The default
+ * error handler assumes no hardware is present to help inform the user
+ * of the problem. Halt stores the error code in a known register,
+ * disables interrupts, and halts the CPU. If the CPU does not have a
+ * halt instruction, it will loop to itself.
+ *
+ * Input parameters:
+ * the_source - what subsystem the error originated in
+ * is_internal - if the error was internally generated
+ * the_error - fatal error status code
+ *
+ * Output parameters:
+ * As much information as possible is stored in a CPU dependent fashion.
+ * See the CPU dependent code for more information.
+ *
+ * NOTE: The the_error is not necessarily a directive status code.
+ */
+
+void volatile _Internal_error_Occurred(
+ Internal_errors_Source the_source,
+ boolean is_internal,
+ unsigned32 the_error
+)
+{
+
+ Internal_errors_What_happened.the_source = the_source;
+ Internal_errors_What_happened.is_internal = is_internal;
+ Internal_errors_What_happened.the_error = the_error;
+
+ _User_extensions_Fatal( the_source, is_internal, the_error );
+
+ _System_state_Set( SYSTEM_STATE_FAILED );
+
+ _CPU_Fatal_halt( the_error );
+
+ /* will not return from this routine */
+}
diff --git a/cpukit/score/src/isr.c b/cpukit/score/src/isr.c
new file mode 100644
index 0000000000..b87bf9f249
--- /dev/null
+++ b/cpukit/score/src/isr.c
@@ -0,0 +1,60 @@
+/*
+ * ISR Handler
+ *
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/core/isr.h>
+#include <rtems/core/stack.h>
+#include <rtems/core/interr.h>
+#include <rtems/core/wkspace.h>
+
+/* _ISR_Handler_initialization
+ *
+ * This routine initializes the ISR handler.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void _ISR_Handler_initialization( void )
+{
+ _ISR_Signals_to_thread_executing = FALSE;
+
+ _ISR_Nest_level = 0;
+
+#if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE )
+
+ if ( _CPU_Table.interrupt_stack_size < STACK_MINIMUM_SIZE )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL
+ );
+
+ _CPU_Interrupt_stack_low =
+ _Workspace_Allocate_or_fatal_error( _CPU_Table.interrupt_stack_size );
+
+ _CPU_Interrupt_stack_high = _Addresses_Add_offset(
+ _CPU_Interrupt_stack_low,
+ _CPU_Table.interrupt_stack_size
+ );
+
+#endif
+
+#if ( CPU_HAS_HARDWARE_INTERRUPT_STACK == TRUE )
+ _CPU_Install_interrupt_stack();
+#endif
+
+}
diff --git a/cpukit/score/src/mpci.c b/cpukit/score/src/mpci.c
index 26c27ae733..ee72d6c396 100644
--- a/cpukit/score/src/mpci.c
+++ b/cpukit/score/src/mpci.c
@@ -14,16 +14,20 @@
*/
#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/cpu.h>
-#include <rtems/fatal.h>
-#include <rtems/mpci.h>
-#include <rtems/mppkt.h>
-#include <rtems/states.h>
-#include <rtems/thread.h>
-#include <rtems/threadq.h>
-#include <rtems/tqdata.h>
-#include <rtems/watchdog.h>
+#include <rtems/core/cpu.h>
+#include <rtems/core/interr.h>
+#include <rtems/core/mpci.h>
+#include <rtems/core/mppkt.h>
+#include <rtems/core/states.h>
+#include <rtems/core/thread.h>
+#include <rtems/core/threadq.h>
+#include <rtems/core/tqdata.h>
+#include <rtems/core/watchdog.h>
+#include <rtems/sysstate.h>
+
+#include <rtems/core/coresem.h>
+
+#include <rtems/rtems/status.h> /* XXX for TIMEOUT */
/*PAGE
*
@@ -32,14 +36,38 @@
* This subprogram performs the initialization necessary for this handler.
*/
-void _MPCI_Handler_initialization ( void )
+void _MPCI_Handler_initialization(
+ MPCI_Control *users_mpci_table
+)
{
+ CORE_semaphore_Attributes attributes;
+
+ if ( _System_state_Is_multiprocessing && !users_mpci_table )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_NO_MPCI
+ );
+
+ _MPCI_table = users_mpci_table;
+
+ attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_FIFO;
+
+ _CORE_semaphore_Initialize(
+ &_MPCI_Semaphore,
+ OBJECTS_NO_CLASS, /* free floating semaphore */
+ &attributes, /* the_semaphore_attributes */
+ 0, /* initial_value */
+ NULL /* proxy_extract_callout */
+ );
+
_Thread_queue_Initialize(
&_MPCI_Remote_blocked_threads,
OBJECTS_NO_CLASS,
THREAD_QUEUE_DISCIPLINE_FIFO,
STATES_WAITING_FOR_RPC_REPLY,
- NULL
+ NULL,
+ RTEMS_TIMEOUT
);
}
@@ -53,11 +81,24 @@ void _MPCI_Handler_initialization ( void )
void _MPCI_Initialization ( void )
{
- (*_Configuration_MPCI_table->initialization)(
- _Configuration_Table,
- &_CPU_Table,
- _Configuration_MP_table
- );
+ (*_MPCI_table->initialization)();
+}
+
+/*PAGE
+ *
+ * _MPCI_Register_packet_processor
+ *
+ * This routine registers the MPCI packet processor for the
+ * designated object class.
+ */
+
+void _MPCI_Register_packet_processor(
+ Objects_Classes the_class,
+ MPCI_Packet_processor the_packet_processor
+
+)
+{
+ _MPCI_Packet_processors[ the_class ] = the_packet_processor;
}
/*PAGE
@@ -68,14 +109,18 @@ void _MPCI_Initialization ( void )
* MPCI get packet callout.
*/
-rtems_packet_prefix *_MPCI_Get_packet ( void )
+MP_packet_Prefix *_MPCI_Get_packet ( void )
{
- rtems_packet_prefix *the_packet;
+ MP_packet_Prefix *the_packet;
- (*_Configuration_MPCI_table->get_packet)( &the_packet );
+ (*_MPCI_table->get_packet)( &the_packet );
if ( the_packet == NULL )
- rtems_fatal_error_occurred( RTEMS_UNSATISFIED );
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_OUT_OF_PACKETS
+ );
/*
* Put in a default timeout that will be used for
@@ -96,10 +141,10 @@ rtems_packet_prefix *_MPCI_Get_packet ( void )
*/
void _MPCI_Return_packet (
- rtems_packet_prefix *the_packet
+ MP_packet_Prefix *the_packet
)
{
- (*_Configuration_MPCI_table->return_packet)( the_packet );
+ (*_MPCI_table->return_packet)( the_packet );
}
/*PAGE
@@ -112,15 +157,15 @@ void _MPCI_Return_packet (
void _MPCI_Send_process_packet (
unsigned32 destination,
- rtems_packet_prefix *the_packet
+ MP_packet_Prefix *the_packet
)
{
the_packet->source_tid = _Thread_Executing->Object.id;
the_packet->to_convert =
- ( the_packet->to_convert - sizeof(rtems_packet_prefix) ) /
+ ( the_packet->to_convert - sizeof(MP_packet_Prefix) ) /
sizeof(unsigned32);
- (*_Configuration_MPCI_table->send_packet)( destination, the_packet );
+ (*_MPCI_table->send_packet)( destination, the_packet );
}
/*PAGE
@@ -131,16 +176,16 @@ void _MPCI_Send_process_packet (
* MPCI send callout.
*/
-rtems_status_code _MPCI_Send_request_packet (
+unsigned32 _MPCI_Send_request_packet (
unsigned32 destination,
- rtems_packet_prefix *the_packet,
+ MP_packet_Prefix *the_packet,
States_Control extra_state
)
{
the_packet->source_tid = _Thread_Executing->Object.id;
the_packet->source_priority = _Thread_Executing->current_priority;
the_packet->to_convert =
- ( the_packet->to_convert - sizeof(rtems_packet_prefix) ) /
+ ( the_packet->to_convert - sizeof(MP_packet_Prefix) ) /
sizeof(unsigned32);
_Thread_Executing->Wait.id = the_packet->id;
@@ -149,7 +194,7 @@ rtems_status_code _MPCI_Send_request_packet (
_Thread_Disable_dispatch();
- (*_Configuration_MPCI_table->send_packet)( destination, the_packet );
+ (*_MPCI_table->send_packet)( destination, the_packet );
_MPCI_Remote_blocked_threads.sync = TRUE;
@@ -158,7 +203,7 @@ rtems_status_code _MPCI_Send_request_packet (
*/
if (the_packet->timeout == MPCI_DEFAULT_TIMEOUT)
- the_packet->timeout = _Configuration_MPCI_table->default_timeout;
+ the_packet->timeout = _MPCI_table->default_timeout;
_Thread_queue_Enqueue( &_MPCI_Remote_blocked_threads, the_packet->timeout );
@@ -180,12 +225,12 @@ rtems_status_code _MPCI_Send_request_packet (
void _MPCI_Send_response_packet (
unsigned32 destination,
- rtems_packet_prefix *the_packet
+ MP_packet_Prefix *the_packet
)
{
the_packet->source_tid = _Thread_Executing->Object.id;
- (*_Configuration_MPCI_table->send_packet)( destination, the_packet );
+ (*_MPCI_table->send_packet)( destination, the_packet );
}
/*PAGE
@@ -196,11 +241,11 @@ void _MPCI_Send_response_packet (
* MPCI receive callout.
*/
-rtems_packet_prefix *_MPCI_Receive_packet ( void )
+MP_packet_Prefix *_MPCI_Receive_packet ( void )
{
- rtems_packet_prefix *the_packet;
+ MP_packet_Prefix *the_packet;
- (*_Configuration_MPCI_table->receive_packet)( &the_packet );
+ (*_MPCI_table->receive_packet)( &the_packet );
return the_packet;
}
@@ -214,7 +259,7 @@ rtems_packet_prefix *_MPCI_Receive_packet ( void )
*/
Thread_Control *_MPCI_Process_response (
- rtems_packet_prefix *the_packet
+ MP_packet_Prefix *the_packet
)
{
Thread_Control *the_thread;
@@ -236,4 +281,66 @@ Thread_Control *_MPCI_Process_response (
return the_thread;
}
+/*PAGE
+ *
+ * _MPCI_Receive_server
+ *
+ */
+
+void _MPCI_Receive_server( void )
+{
+
+ MP_packet_Prefix *the_packet;
+ MPCI_Packet_processor the_function;
+ Thread_Control *executing;
+
+ executing = _Thread_Executing;
+ _MPCI_Receive_server_tcb = executing;
+
+ for ( ; ; ) {
+
+ executing->receive_packet = NULL;
+
+ _Thread_Disable_dispatch();
+ _CORE_semaphore_Seize( &_MPCI_Semaphore, 0, TRUE, WATCHDOG_NO_TIMEOUT );
+ _Thread_Enable_dispatch();
+
+ for ( ; ; ) {
+ the_packet = _MPCI_Receive_packet();
+
+ if ( !the_packet )
+ break;
+
+ executing->receive_packet = the_packet;
+
+ if ( !_Mp_packet_Is_valid_packet_class ( the_packet->the_class ) )
+ break;
+
+ the_function = _MPCI_Packet_processors[ the_packet->the_class ];
+
+ if ( !the_function )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_BAD_PACKET
+ );
+
+ (*the_function)( the_packet );
+ }
+ }
+}
+
+/*PAGE
+ *
+ * _MPCI_Announce
+ *
+ */
+
+void _MPCI_Announce ( void )
+{
+ _Thread_Disable_dispatch();
+ (void) _CORE_semaphore_Surrender( &_MPCI_Semaphore, 0, 0 );
+ _Thread_Enable_dispatch();
+}
+
/* end of file */
diff --git a/cpukit/score/src/object.c b/cpukit/score/src/object.c
index b274579736..7ff6aa5204 100644
--- a/cpukit/score/src/object.c
+++ b/cpukit/score/src/object.c
@@ -14,12 +14,12 @@
*/
#include <rtems/system.h>
-#include <rtems/chain.h>
-#include <rtems/config.h>
-#include <rtems/object.h>
+#include <rtems/core/chain.h>
+#include <rtems/core/object.h>
#include <rtems/objectmp.h>
-#include <rtems/thread.h>
-#include <rtems/wkspace.h>
+#include <rtems/core/thread.h>
+#include <rtems/core/wkspace.h>
+#include <rtems/sysstate.h>
/*PAGE
*
@@ -29,6 +29,7 @@
*
* Input parameters:
* node - local node
+ * maximum_nodes - number of nodes in the system
* maximum_global_objects - number of configured global objects
*
* Output parameters: NONE
@@ -36,12 +37,25 @@
void _Objects_Handler_initialization(
unsigned32 node,
+ unsigned32 maximum_nodes,
unsigned32 maximum_global_objects
)
{
- _Objects_Local_node = node;
+ if ( node < 1 || node > maximum_nodes )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_INVALID_NODE
+ );
+
+ _Objects_Local_node = node;
+ _Objects_Maximum_nodes = maximum_nodes;
- _Objects_MP_Handler_initialization( maximum_global_objects );
+ _Objects_MP_Handler_initialization(
+ node,
+ maximum_nodes,
+ maximum_global_objects
+ );
}
/*PAGE
@@ -166,15 +180,13 @@ void _Objects_Initialize_information(
* Take care of multiprocessing
*/
- if ( supports_global == TRUE && _Configuration_Is_multiprocessing() ) {
+ if ( supports_global == TRUE && _System_state_Is_multiprocessing ) {
information->global_table = _Workspace_Allocate_or_fatal_error(
- (_Configuration_MP_table->maximum_nodes + 1) * sizeof(Chain_Control)
+ (_Objects_Maximum_nodes + 1) * sizeof(Chain_Control)
);
- for ( index=1;
- index <= _Configuration_MP_table->maximum_nodes ;
- index++ )
+ for ( index=1; index <= _Objects_Maximum_nodes ; index++ )
_Chain_Initialize_empty( &information->global_table[ index ] );
}
else
@@ -308,12 +320,12 @@ boolean _Objects_Compare_name_raw(
* id - address of return ID
*
* Output parameters:
- * obj_id - object id
- * RTEMS_SUCCESSFUL - if successful
- * error code - if unsuccessful
+ * id - object id
+ * OBJECTS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
*/
-rtems_status_code _Objects_Name_to_id(
+Objects_Name_to_id_errors _Objects_Name_to_id(
Objects_Information *information,
Objects_Name name,
unsigned32 node,
@@ -328,12 +340,12 @@ rtems_status_code _Objects_Name_to_id(
Objects_Name_comparators compare_them;
if ( name == 0 )
- return( RTEMS_INVALID_NAME );
+ return OBJECTS_INVALID_NAME;
search_local_node = FALSE;
if ( information->maximum != 0 &&
- (node == RTEMS_SEARCH_ALL_NODES || node == RTEMS_SEARCH_LOCAL_NODE ||
+ (node == OBJECTS_SEARCH_ALL_NODES || node == OBJECTS_SEARCH_LOCAL_NODE ||
_Objects_Is_local_node( node ) ) )
search_local_node = TRUE;
@@ -354,13 +366,13 @@ rtems_status_code _Objects_Name_to_id(
if ( (*compare_them)( name, the_object->name, name_length ) ) {
*id = the_object->id;
- return( RTEMS_SUCCESSFUL );
+ return OBJECTS_SUCCESSFUL;
}
}
}
- if ( _Objects_Is_local_node( node ) || node == RTEMS_SEARCH_LOCAL_NODE )
- return( RTEMS_INVALID_NAME );
+ if ( _Objects_Is_local_node( node ) || node == OBJECTS_SEARCH_LOCAL_NODE )
+ return OBJECTS_INVALID_NAME;
return ( _Objects_MP_Global_name_search( information, name, node, id ) );
}
@@ -449,14 +461,14 @@ _Objects_Get_next(
Objects_Control *object;
Objects_Id next_id;
- if (rtems_get_index(id) == RTEMS_OBJECT_ID_INITIAL_INDEX)
+ if (_Objects_Get_index(id) == OBJECTS_ID_INITIAL_INDEX)
next_id = information->minimum_id;
else
next_id = id;
do {
/* walked off end of list? */
- if (rtems_get_index(next_id) > information->maximum)
+ if (_Objects_Get_index(next_id) > information->maximum)
{
*location_p = OBJECTS_ERROR;
goto final;
@@ -473,7 +485,7 @@ _Objects_Get_next(
return object;
final:
- *next_id_p = RTEMS_OBJECT_ID_FINAL;
+ *next_id_p = OBJECTS_ID_FINAL;
return 0;
}
@@ -490,7 +502,7 @@ Objects_Information *_Objects_Get_information(
{
Objects_Classes the_class;
- the_class = rtems_get_class( id );
+ the_class = _Objects_Get_class( id );
if ( !_Objects_Is_class_valid( the_class ) )
return NULL;
diff --git a/cpukit/score/src/objectmp.c b/cpukit/score/src/objectmp.c
index 9752aadbc6..a7c1eff58c 100644
--- a/cpukit/score/src/objectmp.c
+++ b/cpukit/score/src/objectmp.c
@@ -14,9 +14,10 @@
*/
#include <rtems/system.h>
-#include <rtems/object.h>
-#include <rtems/wkspace.h>
-#include <rtems/config.h>
+#include <rtems/core/interr.h>
+#include <rtems/core/object.h>
+#include <rtems/core/wkspace.h>
+#include <rtems/rtems/support.h>
/*PAGE
*
@@ -25,9 +26,12 @@
*/
void _Objects_MP_Handler_initialization (
- unsigned32 maximum_global_objects
+ unsigned32 node,
+ unsigned32 maximum_nodes,
+ unsigned32 maximum_global_objects
)
{
+ _Objects_MP_Maximum_global_objects = maximum_global_objects;
if ( maximum_global_objects == 0 ) {
_Chain_Initialize_empty( &_Objects_MP_Inactive_global_objects );
@@ -62,7 +66,7 @@ void _Objects_MP_Open (
the_global_object->name = the_name;
_Chain_Prepend(
- &information->global_table[ rtems_get_node( the_id ) ],
+ &information->global_table[ _Objects_Get_node( the_id ) ],
&the_global_object->Object.Node
);
@@ -89,7 +93,11 @@ boolean _Objects_MP_Allocate_and_open (
if ( is_fatal_error == FALSE )
return FALSE;
- rtems_fatal_error_occurred( RTEMS_TOO_MANY );
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS
+ );
}
@@ -113,7 +121,7 @@ void _Objects_MP_Close (
Chain_Node *the_node;
Objects_MP_Control *the_object;
- the_chain = &information->global_table[ rtems_get_node( the_id ) ];
+ the_chain = &information->global_table[ _Objects_Get_node( the_id ) ];
for ( the_node = the_chain->first ;
!_Chain_Is_tail( the_chain, the_node ) ;
@@ -132,9 +140,11 @@ void _Objects_MP_Close (
}
- rtems_fatal_error_occurred( RTEMS_INVALID_ID );
-
-
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_INVALID_GLOBAL_ID
+ );
}
/*PAGE
@@ -143,7 +153,7 @@ void _Objects_MP_Close (
*
*/
-rtems_status_code _Objects_MP_Global_name_search (
+Objects_Name_to_id_errors _Objects_MP_Global_name_search (
Objects_Information *information,
Objects_Name the_name,
unsigned32 nodes_to_search,
@@ -158,17 +168,16 @@ rtems_status_code _Objects_MP_Global_name_search (
Objects_MP_Control *the_object;
unsigned32 name_to_use = *(unsigned32 *)the_name; /* XXX variable */
-
- if ( nodes_to_search > _Configuration_MP_table->maximum_nodes )
- return ( RTEMS_INVALID_NODE );
+ if ( nodes_to_search > _Objects_Maximum_nodes )
+ return OBJECTS_INVALID_NODE;
if ( information->global_table == NULL )
- return ( RTEMS_INVALID_NAME );
+ return OBJECTS_INVALID_NAME;
- if ( nodes_to_search == RTEMS_SEARCH_ALL_NODES ||
- nodes_to_search == RTEMS_SEARCH_OTHER_NODES ) {
+ if ( nodes_to_search == OBJECTS_SEARCH_ALL_NODES ||
+ nodes_to_search == OBJECTS_SEARCH_OTHER_NODES ) {
low_node = 1;
- high_node = _Configuration_MP_table->maximum_nodes;
+ high_node = _Objects_Maximum_nodes;
} else {
low_node =
high_node = nodes_to_search;
@@ -195,14 +204,14 @@ rtems_status_code _Objects_MP_Global_name_search (
if ( the_object->name == name_to_use ) {
*the_id = the_object->Object.id;
_Thread_Enable_dispatch();
- return ( RTEMS_SUCCESSFUL );
+ return OBJECTS_SUCCESSFUL;
}
}
}
}
_Thread_Enable_dispatch();
- return ( RTEMS_INVALID_NAME );
+ return OBJECTS_INVALID_NAME;
}
/*PAGE
@@ -223,7 +232,7 @@ void _Objects_MP_Is_remote (
Chain_Node *the_node;
Objects_MP_Control *the_global_object;
- node = rtems_get_node( the_id );
+ node = _Objects_Get_node( the_id );
/*
* NOTE: The local node was search (if necessary) by
@@ -235,7 +244,7 @@ void _Objects_MP_Is_remote (
if ( node == 0 ||
_Objects_Is_local_node( node ) ||
- node > _Configuration_MP_table->maximum_nodes ||
+ node > _Objects_Maximum_nodes ||
information->global_table == NULL ) {
*location = OBJECTS_ERROR;
diff --git a/cpukit/score/src/thread.c b/cpukit/score/src/thread.c
index dfc5324cb8..d507e8e075 100644
--- a/cpukit/score/src/thread.c
+++ b/cpukit/score/src/thread.c
@@ -14,19 +14,17 @@
*/
#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/context.h>
-#include <rtems/fatal.h>
-#include <rtems/init.h>
-#include <rtems/intthrd.h>
-#include <rtems/isr.h>
-#include <rtems/modes.h>
-#include <rtems/object.h>
-#include <rtems/priority.h>
-#include <rtems/states.h>
-#include <rtems/thread.h>
-#include <rtems/userext.h>
-#include <rtems/wkspace.h>
+#include <rtems/core/context.h>
+#include <rtems/core/interr.h>
+#include <rtems/core/intthrd.h>
+#include <rtems/core/isr.h>
+#include <rtems/core/object.h>
+#include <rtems/core/priority.h>
+#include <rtems/core/states.h>
+#include <rtems/core/thread.h>
+#include <rtems/core/threadq.h>
+#include <rtems/core/userext.h>
+#include <rtems/core/wkspace.h>
/*PAGE
*
@@ -43,6 +41,7 @@
void _Thread_Handler_initialization(
unsigned32 ticks_per_timeslice,
+ unsigned32 maximum_extensions,
unsigned32 maximum_proxies
)
{
@@ -53,14 +52,16 @@ void _Thread_Handler_initialization(
_Thread_Heir = NULL;
_Thread_Allocated_fp = NULL;
+ _Thread_Maximum_extensions = maximum_extensions;
+
_Thread_Ticks_remaining_in_timeslice = ticks_per_timeslice;
_Thread_Ticks_per_timeslice = ticks_per_timeslice;
_Thread_Ready_chain = _Workspace_Allocate_or_fatal_error(
- (RTEMS_MAXIMUM_PRIORITY + 1) * sizeof(Chain_Control)
+ (PRIORITY_MAXIMUM + 1) * sizeof(Chain_Control)
);
- for ( index=0; index <= RTEMS_MAXIMUM_PRIORITY ; index++ )
+ for ( index=0; index <= PRIORITY_MAXIMUM ; index++ )
_Chain_Initialize_empty( &_Thread_Ready_chain[ index ] );
_Thread_MP_Handler_initialization( maximum_proxies );
@@ -145,8 +146,6 @@ void _Thread_Dispatch( void )
Thread_Control *executing;
Thread_Control *heir;
ISR_Level level;
- rtems_signal_set signal_set;
- Modes_Control previous_mode;
executing = _Thread_Executing;
_ISR_Disable( level );
@@ -157,7 +156,7 @@ void _Thread_Dispatch( void )
_Thread_Executing = heir;
_ISR_Enable( level );
- _User_extensions_Task_switch( executing, heir );
+ _User_extensions_Thread_switch( executing, heir );
_Thread_Ticks_remaining_in_timeslice = _Thread_Ticks_per_timeslice;
@@ -194,30 +193,16 @@ void _Thread_Dispatch( void )
_Context_Switch( &executing->Registers, &heir->Registers );
executing = _Thread_Executing;
+
_ISR_Disable( level );
}
_Thread_Dispatch_disable_level = 0;
- if ( _ASR_Are_signals_pending( &executing->RTEMS_API->Signal ) ) {
- signal_set = executing->RTEMS_API->Signal.signals_posted;
- executing->RTEMS_API->Signal.signals_posted = 0;
- _ISR_Enable( level );
-
- executing->RTEMS_API->Signal.nest_level += 1;
- if (_Thread_Change_mode( executing->RTEMS_API->Signal.mode_set,
- RTEMS_ALL_MODE_MASKS, &previous_mode ))
- _Thread_Dispatch();
-
- (*executing->RTEMS_API->Signal.handler)( signal_set );
+ _ISR_Enable( level );
- executing->RTEMS_API->Signal.nest_level -= 1;
- if (_Thread_Change_mode( previous_mode,
- RTEMS_ALL_MODE_MASKS, &previous_mode ))
- _Thread_Dispatch();
- }
- else
- _ISR_Enable( level );
+ _User_extensions_Thread_post_switch( executing );
+
}
/*PAGE
@@ -234,7 +219,9 @@ boolean _Thread_Initialize(
unsigned32 stack_size, /* insure it is >= min */
boolean is_fp, /* TRUE if thread uses FP */
Priority_Control priority,
- Modes_Control mode,
+ boolean is_preemptible,
+ boolean is_timeslice,
+ unsigned32 isr_level,
Objects_Name name
)
@@ -242,13 +229,14 @@ boolean _Thread_Initialize(
unsigned32 actual_stack_size;
void *stack;
void *fp_area;
+ void *extensions_area;
/*
* Allocate and Initialize the stack for this thread.
*/
if ( !_Stack_Is_enough( stack_size ) )
- actual_stack_size = RTEMS_MINIMUM_STACK_SIZE;
+ actual_stack_size = STACK_MINIMUM_SIZE;
else
actual_stack_size = stack_size;
@@ -279,7 +267,8 @@ boolean _Thread_Initialize(
fp_area = _Workspace_Allocate( CONTEXT_FP_SIZE );
if ( !fp_area ) {
- (void) _Workspace_Free( stack );
+ if ( the_thread->Start.stack )
+ (void) _Workspace_Free( the_thread->Start.stack );
return FALSE;
}
fp_area = _Context_Fp_start( fp_area, 0 );
@@ -290,45 +279,42 @@ boolean _Thread_Initialize(
the_thread->fp_context = fp_area;
the_thread->Start.fp_context = fp_area;
-/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
+
/*
- * Allocate and initialize the RTEMS API specific information
+ * Allocate the floating point area for this thread
*/
-
- the_thread->RTEMS_API = _Workspace_Allocate( sizeof( RTEMS_API_Control ) );
-
- if ( !the_thread->RTEMS_API ) {
-/* XXX when in task_create
- _RTEMS_tasks_Free( the_thread );
- _Objects_MP_Free_global_object( the_global_object );
-
- _Thread_Enable_dispatch();
- return( RTEMS_UNSATISFIED );
-*/
- (void) _Workspace_Free( stack );
- (void) _Workspace_Free( fp_area );
- return FALSE;
-
- }
-
- the_thread->RTEMS_API->is_global = FALSE;
- the_thread->RTEMS_API->pending_events = EVENT_SETS_NONE_PENDING;
- _ASR_Initialize( &the_thread->RTEMS_API->Signal );
- /* XXX should not be here .... */
-
-/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
+ if ( _Thread_Maximum_extensions ) {
+ extensions_area = _Workspace_Allocate(
+ (_Thread_Maximum_extensions + 1) * sizeof( void * )
+ );
+
+ if ( !extensions_area ) {
+ if ( fp_area )
+ (void) _Workspace_Free( fp_area );
+
+ if ( the_thread->Start.stack )
+ (void) _Workspace_Free( the_thread->Start.stack );
+
+ return FALSE;
+ }
+ } else
+ extensions_area = NULL;
+
+ the_thread->extensions = extensions_area;
/*
* General initialization
*/
+ the_thread->Start.is_preemptible = is_preemptible;
+ the_thread->Start.is_timeslice = is_timeslice;
+ the_thread->Start.isr_level = isr_level;
+
the_thread->current_state = STATES_DORMANT;
- the_thread->current_modes = mode;
the_thread->resource_count = 0;
the_thread->real_priority = priority;
the_thread->Start.initial_priority = priority;
- the_thread->Start.initial_modes = mode;
_Thread_Set_priority( the_thread, priority );
@@ -342,10 +328,22 @@ boolean _Thread_Initialize(
* Invoke create extensions
*/
- _User_extensions_Task_create( the_thread );
- /* XXX if this fails ... */
+ if ( !_User_extensions_Thread_create( the_thread ) ) {
+
+ if ( extensions_area )
+ (void) _Workspace_Free( extensions_area );
+
+ if ( fp_area )
+ (void) _Workspace_Free( fp_area );
+
+ if ( the_thread->Start.stack )
+ (void) _Workspace_Free( the_thread->Start.stack );
+
+ return FALSE;
+ }
return TRUE;
+
}
/*
@@ -376,7 +374,7 @@ boolean _Thread_Start(
_Thread_Ready( the_thread );
- _User_extensions_Task_start( the_thread );
+ _User_extensions_Thread_start( the_thread );
return TRUE;
}
@@ -403,7 +401,8 @@ boolean _Thread_Restart(
_Thread_Set_transient( the_thread );
the_thread->resource_count = 0;
- the_thread->current_modes = the_thread->Start.initial_modes;
+ the_thread->is_preemptible = the_thread->Start.is_preemptible;
+ the_thread->is_timeslice = the_thread->Start.is_timeslice;
the_thread->Start.pointer_argument = pointer_argument;
the_thread->Start.numeric_argument = numeric_argument;
@@ -423,7 +422,7 @@ boolean _Thread_Restart(
_Thread_Ready( the_thread );
- _User_extensions_Task_restart( the_thread );
+ _User_extensions_Thread_restart( the_thread );
if ( _Thread_Is_executing ( the_thread ) )
_Thread_Restart_self();
@@ -457,7 +456,7 @@ void _Thread_Close(
(void) _Watchdog_Remove( &the_thread->Timer );
}
- _User_extensions_Task_delete( the_thread );
+ _User_extensions_Thread_delete( the_thread );
#if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE )
if ( _Thread_Is_allocated_fp( the_thread ) )
@@ -469,6 +468,9 @@ void _Thread_Close(
if ( the_thread->Start.stack )
(void) _Workspace_Free( the_thread->Start.stack );
+
+ if ( the_thread->extensions )
+ (void) _Workspace_Free( the_thread->extensions );
}
/*PAGE
@@ -512,8 +514,7 @@ void _Thread_Ready(
heir = _Thread_Heir;
- if ( !_Thread_Is_executing( heir ) &&
- _Modes_Is_preempt( _Thread_Executing->current_modes ) )
+ if ( !_Thread_Is_executing( heir ) && _Thread_Executing->is_preemptible )
_Context_Switch_necessary = TRUE;
_ISR_Enable( level );
@@ -559,7 +560,7 @@ void _Thread_Clear_state(
if ( the_thread->current_priority < _Thread_Heir->current_priority ) {
_Thread_Heir = the_thread;
- if ( _Modes_Is_preempt( _Thread_Executing->current_modes ) ||
+ if ( _Thread_Executing->is_preemptible ||
the_thread->current_priority == 0 )
_Context_Switch_necessary = TRUE;
}
@@ -729,9 +730,12 @@ void _Thread_Reset_timeslice( void )
void _Thread_Tickle_timeslice( void )
{
- if ( ( _Modes_Is_timeslice(_Thread_Executing->current_modes) ) &&
- ( _States_Is_ready( _Thread_Executing->current_state ) ) &&
- ( --_Thread_Ticks_remaining_in_timeslice == 0 ) ) {
+ if ( !_Thread_Executing->is_timeslice ||
+ !_Thread_Executing->is_preemptible ||
+ !_States_Is_ready( _Thread_Executing->current_state ) )
+ return;
+
+ if ( --_Thread_Ticks_remaining_in_timeslice == 0 ) {
_Thread_Reset_timeslice();
}
}
@@ -803,11 +807,14 @@ void _Thread_Load_environment(
_Context_Initialize_fp( &the_thread->fp_context );
}
+ the_thread->is_preemptible = the_thread->Start.is_preemptible;
+ the_thread->is_timeslice = the_thread->Start.is_timeslice;
+
_Context_Initialize(
&the_thread->Registers,
the_thread->Start.Initial_stack.area,
the_thread->Start.Initial_stack.size,
- _Modes_Get_interrupt_level( the_thread->Start.initial_modes ),
+ the_thread->Start.isr_level,
_Thread_Handler
);
@@ -838,7 +845,7 @@ void _Thread_Handler( void )
* disabled until all 'begin' extensions complete.
*/
- _User_extensions_Task_begin( executing );
+ _User_extensions_Thread_begin( executing );
/*
* At this point, the dispatch disable level BETTER be 1.
@@ -846,7 +853,7 @@ void _Thread_Handler( void )
_Thread_Enable_dispatch();
- switch ( executing->Start.prototype ) {
+ switch ( executing->Start.prototype ) {
case THREAD_START_NUMERIC:
(*executing->Start.entry_point)( executing->Start.numeric_argument );
break;
@@ -867,9 +874,13 @@ void _Thread_Handler( void )
break;
}
- _User_extensions_Task_exitted( executing );
+ _User_extensions_Thread_exitted( executing );
- rtems_fatal_error_occurred( RTEMS_TASK_EXITTED );
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_THREAD_EXITTED
+ );
}
/*PAGE
@@ -953,7 +964,7 @@ void _Thread_Change_priority(
_Thread_Calculate_heir();
if ( !_Thread_Is_executing_also_the_heir() &&
- _Modes_Is_preempt(_Thread_Executing->current_modes) )
+ _Thread_Executing->is_preemptible )
_Context_Switch_necessary = TRUE;
_ISR_Enable( level );
@@ -986,60 +997,24 @@ void _Thread_Set_priority(
/*PAGE
*
- * _Thread_Change_mode
- *
- * This routine enables and disables several modes of
- * execution for the requesting thread.
- *
- * Input parameters:
- * mode - new mode
- * mask - mask
- * old_mode_set - address of previous mode
+ * _Thread_Evaluate_mode
*
- * Output:
- * *old_mode_set - previous mode
- * returns TRUE if scheduling necessary
- *
- * INTERRUPT LATENCY:
- * only one case
+ * XXX
*/
-boolean _Thread_Change_mode(
- Modes_Control new_mode_set,
- Modes_Control mask,
- Modes_Control *old_mode_set
-)
+boolean _Thread_Evaluate_mode( void )
{
- Modes_Control changed;
- Modes_Control threads_new_mode_set;
- Thread_Control *executing;
- boolean need_dispatch;
-
- executing = _Thread_Executing;
- *old_mode_set = executing->current_modes;
-
- _Modes_Change( executing->current_modes,
- new_mode_set, mask, &threads_new_mode_set, &changed );
+ Thread_Control *executing;
- _Modes_Set_interrupt_level( threads_new_mode_set );
-
- if ( _Modes_Mask_changed( changed, RTEMS_ASR_MASK ) )
- _ASR_Swap_signals( &executing->RTEMS_API->Signal );
-
- executing->current_modes = threads_new_mode_set;
- need_dispatch = TRUE;
+ executing = _Thread_Executing;
if ( !_States_Is_ready( executing->current_state ) ||
- ( !_Thread_Is_heir( executing ) &&
- _Modes_Is_preempt(threads_new_mode_set) ) )
-
- _Context_Switch_necessary = TRUE;
-
- else if ( !_ASR_Are_signals_pending( &executing->RTEMS_API->Signal ) )
-
- need_dispatch = FALSE;
+ ( !_Thread_Is_heir( executing ) && executing->is_preemptible ) ) {
+ _Context_Switch_necessary = TRUE;
+ return TRUE;
+ }
- return need_dispatch;
+ return FALSE;
}
/*PAGE
@@ -1068,7 +1043,7 @@ STATIC INLINE Thread_Control *_Thread_Get (
return( _Thread_Executing );
}
- the_class = rtems_get_class( id );
+ the_class = _Objects_Get_class( id );
if ( the_class > OBJECTS_CLASSES_LAST ) {
*location = OBJECTS_ERROR;
diff --git a/cpukit/score/src/threadmp.c b/cpukit/score/src/threadmp.c
index f2b78cd8cd..fe346c0b9c 100644
--- a/cpukit/score/src/threadmp.c
+++ b/cpukit/score/src/threadmp.c
@@ -14,9 +14,10 @@
*/
#include <rtems/system.h>
-#include <rtems/priority.h>
-#include <rtems/thread.h>
-#include <rtems/wkspace.h>
+#include <rtems/core/priority.h>
+#include <rtems/core/thread.h>
+#include <rtems/core/wkspace.h>
+#include <rtems/core/isr.h>
/*PAGE
*
@@ -67,7 +68,7 @@ Thread_Control *_Thread_MP_Allocate_proxy (
the_proxy = (Thread_Proxy_control *) the_thread;
- _Thread_Executing->Wait.return_code = RTEMS_PROXY_BLOCKING;
+ _Thread_Executing->Wait.return_code = THREAD_STATUS_PROXY_BLOCKING;
the_proxy->receive_packet = _Thread_MP_Receive->receive_packet;
@@ -85,7 +86,11 @@ Thread_Control *_Thread_MP_Allocate_proxy (
return the_thread;
}
- rtems_fatal_error_occurred( RTEMS_TOO_MANY );
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_OUT_OF_PROXIES
+ );
/*
* NOTE: The following return insures that the compiler will
diff --git a/cpukit/score/src/threadq.c b/cpukit/score/src/threadq.c
index 7b4647bb7f..ec6f8cc242 100644
--- a/cpukit/score/src/threadq.c
+++ b/cpukit/score/src/threadq.c
@@ -14,13 +14,15 @@
*/
#include <rtems/system.h>
-#include <rtems/chain.h>
-#include <rtems/isr.h>
-#include <rtems/object.h>
-#include <rtems/states.h>
-#include <rtems/thread.h>
-#include <rtems/threadq.h>
-#include <rtems/tqdata.h>
+#include <rtems/core/chain.h>
+#include <rtems/core/isr.h>
+#include <rtems/core/object.h>
+#include <rtems/core/states.h>
+#include <rtems/core/thread.h>
+#include <rtems/core/threadq.h>
+#include <rtems/core/tqdata.h>
+
+#include <rtems/rtems/status.h>
/*PAGE
*
@@ -29,10 +31,12 @@
* This routine initializes the specified threadq.
*
* Input parameters:
- * the_thread_queue - pointer to a threadq header
- * the_class - class of the object to which this belongs
- * discipline - queueing discipline
- * state - state of waiting threads
+ * the_thread_queue - pointer to a threadq header
+ * the_class - class of the object to which this belongs
+ * discipline - queueing discipline
+ * state - state of waiting threads
+ * proxy_extract_callout - MP specific callout
+ * timeout_status - return on a timeout
*
* Output parameters: NONE
*/
@@ -42,15 +46,17 @@ void _Thread_queue_Initialize(
Objects_Classes the_class,
Thread_queue_Disciplines the_discipline,
States_Control state,
- Thread_queue_Extract_callout proxy_extract_callout
+ Thread_queue_Extract_callout proxy_extract_callout,
+ unsigned32 timeout_status
)
{
unsigned32 index;
_Thread_queue_Extract_table[ the_class ] = proxy_extract_callout;
- the_thread_queue->state = state;
- the_thread_queue->discipline = the_discipline;
+ the_thread_queue->state = state;
+ the_thread_queue->discipline = the_discipline;
+ the_thread_queue->timeout_status = timeout_status;
switch ( the_discipline ) {
case THREAD_QUEUE_DISCIPLINE_FIFO:
@@ -85,14 +91,14 @@ void _Thread_queue_Initialize(
void _Thread_queue_Enqueue(
Thread_queue_Control *the_thread_queue,
- rtems_interval timeout
+ Watchdog_Interval timeout
)
{
Thread_Control *the_thread;
the_thread = _Thread_Executing;
- if ( _Thread_MP_Is_receive( the_thread ) )
+ if ( _Thread_MP_Is_receive( the_thread ) && the_thread->receive_packet )
the_thread = _Thread_MP_Allocate_proxy( the_thread_queue->state );
else
_Thread_Set_state( the_thread, the_thread_queue->state );
@@ -128,7 +134,7 @@ void _Thread_queue_Enqueue(
* _Thread_queue_Dequeue
*
* This routine removes a thread from the specified threadq. If the
- * threadq discipline is RTEMS_FIFO, it unblocks a thread, and cancels its
+ * threadq discipline is FIFO, it unblocks a thread, and cancels its
* timeout timer. Priority discipline is processed elsewhere.
*
* Input parameters:
@@ -139,7 +145,6 @@ void _Thread_queue_Enqueue(
*
* INTERRUPT LATENCY:
* check sync
- * RTEMS_FIFO
*/
Thread_Control *_Thread_queue_Dequeue(
@@ -200,7 +205,7 @@ boolean _Thread_queue_Extract_with_proxy(
if ( _States_Is_waiting_for_rpc_reply( state ) &&
_States_Is_locally_blocked( state ) ) {
- the_class = rtems_get_class( the_thread->Wait.id );
+ the_class = _Objects_Get_class( the_thread->Wait.id );
proxy_extract_callout = _Thread_queue_Extract_table[ the_class ];
@@ -252,21 +257,24 @@ void _Thread_queue_Extract(
* This kernel routine flushes the given thread queue.
*
* Input parameters:
- * the_thread_queue - pointer to threadq to be flushed
+ * the_thread_queue - pointer to threadq to be flushed
+ * remote_extract_callout - pointer to routine which extracts a remote thread
+ * status - status to return to the thread
*
* Output parameters: NONE
*/
void _Thread_queue_Flush(
Thread_queue_Control *the_thread_queue,
- Thread_queue_Flush_callout remote_extract_callout
+ Thread_queue_Flush_callout remote_extract_callout,
+ unsigned32 status
)
{
Thread_Control *the_thread;
while ( (the_thread = _Thread_queue_Dequeue( the_thread_queue )) ) {
if ( _Objects_Is_local_id( the_thread->Object.id ) )
- the_thread->Wait.return_code = RTEMS_OBJECT_WAS_DELETED;
+ the_thread->Wait.return_code = status;
else
( *remote_extract_callout )( the_thread );
}
@@ -334,7 +342,7 @@ void _Thread_queue_Timeout(
case OBJECTS_REMOTE: /* impossible */
break;
case OBJECTS_LOCAL:
- the_thread->Wait.return_code = RTEMS_TIMEOUT;
+ the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status;
_Thread_queue_Extract( the_thread->Wait.queue, the_thread );
_Thread_Unnest_dispatch();
break;
@@ -362,7 +370,7 @@ void _Thread_queue_Timeout(
void _Thread_queue_Enqueue_fifo (
Thread_queue_Control *the_thread_queue,
Thread_Control *the_thread,
- rtems_interval timeout
+ Watchdog_Interval timeout
)
{
ISR_Level level;
@@ -376,7 +384,7 @@ void _Thread_queue_Enqueue_fifo (
&the_thread->Object.Node
);
- if ( timeout != RTEMS_NO_TIMEOUT )
+ if ( timeout != WATCHDOG_NO_TIMEOUT )
_Watchdog_Activate( &the_thread->Timer );
_ISR_Enable( level );
@@ -412,7 +420,7 @@ void _Thread_queue_Enqueue_fifo (
*
* INTERRUPT LATENCY:
* check sync
- * RTEMS_FIFO
+ * FIFO
*/
Thread_Control *_Thread_queue_Dequeue_fifo(
@@ -541,7 +549,7 @@ Thread_Control *_Thread_queue_First_fifo(
void _Thread_queue_Enqueue_priority(
Thread_queue_Control *the_thread_queue,
Thread_Control *the_thread,
- rtems_interval timeout
+ Watchdog_Interval timeout
)
{
Priority_Control search_priority;
@@ -567,7 +575,7 @@ void _Thread_queue_Enqueue_priority(
goto restart_reverse_search;
restart_forward_search:
- search_priority = RTEMS_MINIMUM_PRIORITY - 1;
+ search_priority = PRIORITY_MINIMUM - 1;
_ISR_Disable( level );
search_thread = (Thread_Control *) header->first;
while ( !_Chain_Is_tail( header, (Chain_Node *)search_thread ) ) {
@@ -595,7 +603,7 @@ restart_forward_search:
goto syncronize;
the_thread_queue->sync = FALSE;
- if ( timeout != RTEMS_NO_TIMEOUT )
+ if ( timeout != WATCHDOG_NO_TIMEOUT )
_Watchdog_Activate( &the_thread->Timer );
if ( priority == search_priority )
@@ -613,7 +621,7 @@ restart_forward_search:
return;
restart_reverse_search:
- search_priority = RTEMS_MAXIMUM_PRIORITY + 1;
+ search_priority = PRIORITY_MAXIMUM + 1;
_ISR_Disable( level );
search_thread = (Thread_Control *) header->last;
@@ -641,7 +649,7 @@ restart_reverse_search:
goto syncronize;
the_thread_queue->sync = FALSE;
- if ( timeout != RTEMS_NO_TIMEOUT )
+ if ( timeout != WATCHDOG_NO_TIMEOUT )
_Watchdog_Activate( &the_thread->Timer );
if ( priority == search_priority )
@@ -688,7 +696,7 @@ syncronize:
*
* _Thread_queue_Dequeue_priority
*
- * This routine removes a thread from the specified RTEMS_PRIORITY based
+ * This routine removes a thread from the specified PRIORITY based
* threadq, unblocks it, and cancels its timeout timer.
*
* Input parameters:
diff --git a/cpukit/score/src/userext.c b/cpukit/score/src/userext.c
index 7886dbd900..6730e81219 100644
--- a/cpukit/score/src/userext.c
+++ b/cpukit/score/src/userext.c
@@ -15,14 +15,14 @@
*/
#include <rtems/system.h>
-#include <rtems/userext.h>
+#include <rtems/core/userext.h>
/*PAGE
*
- * _User_extensions_Task_create
+ * _User_extensions_Thread_create
*/
-boolean _User_extensions_Task_create (
+boolean _User_extensions_Thread_create (
Thread_Control *the_thread
)
{
@@ -36,8 +36,8 @@ boolean _User_extensions_Task_create (
the_extension = (User_extensions_Control *) the_node;
- if ( the_extension->Callouts.rtems_task_create != NULL ) {
- status = (*the_extension->Callouts.rtems_task_create)(
+ if ( the_extension->Callouts.thread_create != NULL ) {
+ status = (*the_extension->Callouts.thread_create)(
_Thread_Executing,
the_thread
);
@@ -51,10 +51,10 @@ boolean _User_extensions_Task_create (
/*PAGE
*
- * _User_extensions_Task_delete
+ * _User_extensions_Thread_delete
*/
-void _User_extensions_Task_delete (
+void _User_extensions_Thread_delete (
Thread_Control *the_thread
)
{
@@ -67,8 +67,8 @@ void _User_extensions_Task_delete (
the_extension = (User_extensions_Control *) the_node;
- if ( the_extension->Callouts.rtems_task_delete != NULL )
- (*the_extension->Callouts.rtems_task_delete)(
+ if ( the_extension->Callouts.thread_delete != NULL )
+ (*the_extension->Callouts.thread_delete)(
_Thread_Executing,
the_thread
);
@@ -77,11 +77,11 @@ void _User_extensions_Task_delete (
/*PAGE
*
- * _User_extensions_Task_start
+ * _User_extensions_Thread_start
*
*/
-void _User_extensions_Task_start (
+void _User_extensions_Thread_start (
Thread_Control *the_thread
)
{
@@ -94,8 +94,8 @@ void _User_extensions_Task_start (
the_extension = (User_extensions_Control *) the_node;
- if ( the_extension->Callouts.rtems_task_start != NULL )
- (*the_extension->Callouts.rtems_task_start)(
+ if ( the_extension->Callouts.thread_start != NULL )
+ (*the_extension->Callouts.thread_start)(
_Thread_Executing,
the_thread
);
@@ -104,11 +104,11 @@ void _User_extensions_Task_start (
/*PAGE
*
- * _User_extensions_Task_restart
+ * _User_extensions_Thread_restart
*
*/
-void _User_extensions_Task_restart (
+void _User_extensions_Thread_restart (
Thread_Control *the_thread
)
{
@@ -121,8 +121,8 @@ void _User_extensions_Task_restart (
the_extension = (User_extensions_Control *) the_node;
- if ( the_extension->Callouts.rtems_task_restart != NULL )
- (*the_extension->Callouts.rtems_task_restart)(
+ if ( the_extension->Callouts.thread_restart != NULL )
+ (*the_extension->Callouts.thread_restart)(
_Thread_Executing,
the_thread
);
@@ -131,11 +131,11 @@ void _User_extensions_Task_restart (
/*PAGE
*
- * _User_extensions_Task_begin
+ * _User_extensions_Thread_begin
*
*/
-void _User_extensions_Task_begin (
+void _User_extensions_Thread_begin (
Thread_Control *executing
)
{
@@ -148,17 +148,17 @@ void _User_extensions_Task_begin (
the_extension = (User_extensions_Control *) the_node;
- if ( the_extension->Callouts.task_begin != NULL )
- (*the_extension->Callouts.task_begin)( executing );
+ if ( the_extension->Callouts.thread_begin != NULL )
+ (*the_extension->Callouts.thread_begin)( executing );
}
}
/*PAGE
*
- * _User_extensions_Task_exitted
+ * _User_extensions_Thread_exitted
*/
-void _User_extensions_Task_exitted (
+void _User_extensions_Thread_exitted (
Thread_Control *executing
)
{
@@ -171,8 +171,8 @@ void _User_extensions_Task_exitted (
the_extension = (User_extensions_Control *) the_node;
- if ( the_extension->Callouts.task_exitted != NULL )
- (*the_extension->Callouts.task_exitted)( executing );
+ if ( the_extension->Callouts.thread_exitted != NULL )
+ (*the_extension->Callouts.thread_exitted)( executing );
}
}
@@ -182,7 +182,9 @@ void _User_extensions_Task_exitted (
*/
void _User_extensions_Fatal (
- unsigned32 the_error
+ Internal_errors_Source the_source,
+ boolean is_internal,
+ unsigned32 the_error
)
{
Chain_Node *the_node;
@@ -195,7 +197,7 @@ void _User_extensions_Fatal (
the_extension = (User_extensions_Control *) the_node;
if ( the_extension->Callouts.fatal != NULL )
- (*the_extension->Callouts.fatal)( the_error );
+ (*the_extension->Callouts.fatal)( the_source, is_internal, the_error );
}
}
diff --git a/cpukit/score/src/watchdog.c b/cpukit/score/src/watchdog.c
index 3c46f9b535..53a405d725 100644
--- a/cpukit/score/src/watchdog.c
+++ b/cpukit/score/src/watchdog.c
@@ -14,8 +14,8 @@
*/
#include <rtems/system.h>
-#include <rtems/isr.h>
-#include <rtems/watchdog.h>
+#include <rtems/core/isr.h>
+#include <rtems/core/watchdog.h>
/*PAGE
*
@@ -104,7 +104,7 @@ Watchdog_States _Watchdog_Remove(
void _Watchdog_Adjust(
Chain_Control *header,
Watchdog_Adjust_directions direction,
- rtems_interval units
+ Watchdog_Interval units
)
{
if ( !_Chain_Is_empty( header ) ) {
@@ -144,10 +144,10 @@ void _Watchdog_Insert(
Watchdog_Insert_modes insert_mode
)
{
- ISR_Level level;
- Watchdog_Control *after;
- unsigned32 insert_isr_nest_level;
- rtems_interval delta_interval;
+ ISR_Level level;
+ Watchdog_Control *after;
+ unsigned32 insert_isr_nest_level;
+ Watchdog_Interval delta_interval;
insert_isr_nest_level = _ISR_Nest_level;
diff --git a/cpukit/score/src/wkspace.c b/cpukit/score/src/wkspace.c
index 97299540f8..f4be68651c 100644
--- a/cpukit/score/src/wkspace.c
+++ b/cpukit/score/src/wkspace.c
@@ -17,8 +17,8 @@
*/
#include <rtems/system.h>
-#include <rtems/wkspace.h>
-#include <rtems/fatal.h>
+#include <rtems/core/wkspace.h>
+#include <rtems/core/interr.h>
/*PAGE
*
@@ -35,7 +35,11 @@ void *_Workspace_Allocate_or_fatal_error(
memory = _Workspace_Allocate( size );
if ( memory == NULL )
- rtems_fatal_error_occurred( RTEMS_UNSATISFIED );
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_WORKSPACE_ALLOCATION
+ );
return memory;
}