forked from Imagelibrary/rtems
score: Fix Thread_Control and Thread_Proxy_control
Fix layout of the common block of Thread_Control and Thread_Proxy_control. Ensure that the offsets match.
This commit is contained in:
@@ -248,6 +248,56 @@ typedef struct {
|
|||||||
void *tls_area;
|
void *tls_area;
|
||||||
} Thread_Start_information;
|
} Thread_Start_information;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Priority change handler.
|
||||||
|
*
|
||||||
|
* @param[in] the_thread The thread.
|
||||||
|
* @param[in] new_priority The new priority value.
|
||||||
|
* @param[in] context The handler context.
|
||||||
|
*
|
||||||
|
* @see _Thread_Priority_set_change_handler().
|
||||||
|
*/
|
||||||
|
typedef void (*Thread_Priority_change_handler)(
|
||||||
|
Thread_Control *the_thread,
|
||||||
|
Priority_Control new_priority,
|
||||||
|
void *context
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Thread priority control.
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
/**
|
||||||
|
* @brief Generation of the current priority value.
|
||||||
|
*
|
||||||
|
* It is used in _Thread_Change_priority() to serialize the update of
|
||||||
|
* priority related data structures.
|
||||||
|
*/
|
||||||
|
uint32_t generation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Priority change handler.
|
||||||
|
*
|
||||||
|
* Called by _Thread_Change_priority() to notify a thread about a priority
|
||||||
|
* change. In case this thread waits currently for a resource the handler
|
||||||
|
* may adjust its data structures according to the new priority value. This
|
||||||
|
* handler must not be NULL, instead the default handler
|
||||||
|
* _Thread_Priority_change_do_nothing() should be used in case nothing needs
|
||||||
|
* to be done during a priority change.
|
||||||
|
*
|
||||||
|
* @see _Thread_Priority_set_change_handler() and
|
||||||
|
* _Thread_Priority_restore_default_change_handler().
|
||||||
|
*/
|
||||||
|
Thread_Priority_change_handler change_handler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Context for priority change handler.
|
||||||
|
*
|
||||||
|
* @see _Thread_Priority_set_change_handler().
|
||||||
|
*/
|
||||||
|
void *change_handler_context;
|
||||||
|
} Thread_Priority_control;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Union type to hold a pointer to an immutable or a mutable object.
|
* @brief Union type to hold a pointer to an immutable or a mutable object.
|
||||||
*
|
*
|
||||||
@@ -339,6 +389,12 @@ typedef struct {
|
|||||||
Priority_Control current_priority;
|
Priority_Control current_priority;
|
||||||
/** This field is the base priority of this proxy. */
|
/** This field is the base priority of this proxy. */
|
||||||
Priority_Control real_priority;
|
Priority_Control real_priority;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Thread priority control.
|
||||||
|
*/
|
||||||
|
Thread_Priority_control Priority;
|
||||||
|
|
||||||
/** This field is the number of mutexes currently held by this proxy. */
|
/** This field is the number of mutexes currently held by this proxy. */
|
||||||
uint32_t resource_count;
|
uint32_t resource_count;
|
||||||
|
|
||||||
@@ -375,56 +431,6 @@ typedef enum {
|
|||||||
/** This macro defines the last API which has threads. */
|
/** This macro defines the last API which has threads. */
|
||||||
#define THREAD_API_LAST THREAD_API_POSIX
|
#define THREAD_API_LAST THREAD_API_POSIX
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Priority change handler.
|
|
||||||
*
|
|
||||||
* @param[in] the_thread The thread.
|
|
||||||
* @param[in] new_priority The new priority value.
|
|
||||||
* @param[in] context The handler context.
|
|
||||||
*
|
|
||||||
* @see _Thread_Priority_set_change_handler().
|
|
||||||
*/
|
|
||||||
typedef void (*Thread_Priority_change_handler)(
|
|
||||||
Thread_Control *the_thread,
|
|
||||||
Priority_Control new_priority,
|
|
||||||
void *context
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Thread priority control.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
/**
|
|
||||||
* @brief Generation of the current priority value.
|
|
||||||
*
|
|
||||||
* It is used in _Thread_Change_priority() to serialize the update of
|
|
||||||
* priority related data structures.
|
|
||||||
*/
|
|
||||||
uint32_t generation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Priority change handler.
|
|
||||||
*
|
|
||||||
* Called by _Thread_Change_priority() to notify a thread about a priority
|
|
||||||
* change. In case this thread waits currently for a resource the handler
|
|
||||||
* may adjust its data structures according to the new priority value. This
|
|
||||||
* handler must not be NULL, instead the default handler
|
|
||||||
* _Thread_Priority_change_do_nothing() should be used in case nothing needs
|
|
||||||
* to be done during a priority change.
|
|
||||||
*
|
|
||||||
* @see _Thread_Priority_set_change_handler() and
|
|
||||||
* _Thread_Priority_restore_default_change_handler().
|
|
||||||
*/
|
|
||||||
Thread_Priority_change_handler change_handler;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Context for priority change handler.
|
|
||||||
*
|
|
||||||
* @see _Thread_Priority_set_change_handler().
|
|
||||||
*/
|
|
||||||
void *change_handler_context;
|
|
||||||
} Thread_Priority_control;
|
|
||||||
|
|
||||||
typedef struct Thread_Action Thread_Action;
|
typedef struct Thread_Action Thread_Action;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -677,14 +683,6 @@ struct Thread_Control_struct {
|
|||||||
|
|
||||||
/** This field is the number of mutexes currently held by this thread. */
|
/** This field is the number of mutexes currently held by this thread. */
|
||||||
uint32_t resource_count;
|
uint32_t resource_count;
|
||||||
|
|
||||||
#if defined(RTEMS_SMP)
|
|
||||||
/**
|
|
||||||
* @brief Thread lock control.
|
|
||||||
*/
|
|
||||||
Thread_Lock_control Lock;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** This field is the blocking information for this thread. */
|
/** This field is the blocking information for this thread. */
|
||||||
Thread_Wait_information Wait;
|
Thread_Wait_information Wait;
|
||||||
/** This field is the Watchdog used to manage thread delays and timeouts. */
|
/** This field is the Watchdog used to manage thread delays and timeouts. */
|
||||||
@@ -693,6 +691,15 @@ struct Thread_Control_struct {
|
|||||||
/** This field is the received response packet in an MP system. */
|
/** This field is the received response packet in an MP system. */
|
||||||
MP_packet_Prefix *receive_packet;
|
MP_packet_Prefix *receive_packet;
|
||||||
#endif
|
#endif
|
||||||
|
/*================= end of common block =================*/
|
||||||
|
|
||||||
|
#if defined(RTEMS_SMP)
|
||||||
|
/**
|
||||||
|
* @brief Thread lock control.
|
||||||
|
*/
|
||||||
|
Thread_Lock_control Lock;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __RTEMS_STRICT_ORDER_MUTEX__
|
#ifdef __RTEMS_STRICT_ORDER_MUTEX__
|
||||||
/** This field is the head of queue of priority inheritance mutex
|
/** This field is the head of queue of priority inheritance mutex
|
||||||
* held by the thread.
|
* held by the thread.
|
||||||
@@ -706,7 +713,6 @@ struct Thread_Control_struct {
|
|||||||
*/
|
*/
|
||||||
Resource_Node Resource_node;
|
Resource_Node Resource_node;
|
||||||
#endif
|
#endif
|
||||||
/*================= end of common block =================*/
|
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
/** This field is true if the thread is offered globally */
|
/** This field is true if the thread is offered globally */
|
||||||
bool is_global;
|
bool is_global;
|
||||||
|
|||||||
@@ -21,6 +21,25 @@
|
|||||||
#include <rtems/score/threadimpl.h>
|
#include <rtems/score/threadimpl.h>
|
||||||
#include <rtems/score/interr.h>
|
#include <rtems/score/interr.h>
|
||||||
|
|
||||||
|
#define THREAD_OFFSET_ASSERT( field ) \
|
||||||
|
RTEMS_STATIC_ASSERT( \
|
||||||
|
offsetof( Thread_Control, field ) == offsetof( Thread_Proxy_control, field ), \
|
||||||
|
field \
|
||||||
|
)
|
||||||
|
|
||||||
|
THREAD_OFFSET_ASSERT( Object );
|
||||||
|
THREAD_OFFSET_ASSERT( RBNode );
|
||||||
|
THREAD_OFFSET_ASSERT( current_state );
|
||||||
|
THREAD_OFFSET_ASSERT( current_priority );
|
||||||
|
THREAD_OFFSET_ASSERT( real_priority );
|
||||||
|
THREAD_OFFSET_ASSERT( Priority );
|
||||||
|
THREAD_OFFSET_ASSERT( resource_count );
|
||||||
|
THREAD_OFFSET_ASSERT( Wait );
|
||||||
|
THREAD_OFFSET_ASSERT( Timer );
|
||||||
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
THREAD_OFFSET_ASSERT( receive_packet );
|
||||||
|
#endif
|
||||||
|
|
||||||
void _Thread_Handler_initialization(void)
|
void _Thread_Handler_initialization(void)
|
||||||
{
|
{
|
||||||
rtems_stack_allocate_init_hook stack_allocate_init_hook =
|
rtems_stack_allocate_init_hook stack_allocate_init_hook =
|
||||||
|
|||||||
Reference in New Issue
Block a user