More registry-related changes, removed some complexity from asm port modules thanks to registry changes.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14170 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2021-04-13 08:42:51 +00:00
parent 0b1cc7db27
commit 42d5fca126
19 changed files with 17 additions and 111 deletions

View File

@ -39,16 +39,9 @@
* RTOS-specific context offset.
*/
#if defined(_CHIBIOS_RT_CONF_)
#if CH_CFG_USE_REGISTRY
#define CURRENT_OFFSET 20 /* ch.rlist.current */
#define CONTEXT_OFFSET 20
#else
#define CURRENT_OFFSET 12
#define CONTEXT_OFFSET 12
#endif
#elif defined(_CHIBIOS_NIL_CONF_)
#define CURRENT_OFFSET 0 /* nil.current */
#define CONTEXT_OFFSET 0
#else

View File

@ -44,16 +44,9 @@
* RTOS-specific context offset.
*/
#if defined(_CHIBIOS_RT_CONF_)
#if CH_CFG_USE_REGISTRY
#define CURRENT_OFFSET 20 /* ch.rlist.current */
#define CONTEXT_OFFSET 20
#else
#define CURRENT_OFFSET 12
#define CONTEXT_OFFSET 12
#endif
#elif defined(_CHIBIOS_NIL_CONF_)
#define CURRENT_OFFSET 0 /* nil.current */
#define CONTEXT_OFFSET 0
#else

View File

@ -44,16 +44,9 @@
* RTOS-specific context offset.
*/
#if defined(_CHIBIOS_RT_CONF_)
#if CH_CFG_USE_REGISTRY
#define CURRENT_OFFSET 20 /* ch.rlist.current */
#define CONTEXT_OFFSET 20
#else
#define CURRENT_OFFSET 12
#define CONTEXT_OFFSET 12
#endif
#elif defined(_CHIBIOS_NIL_CONF_)
#define CURRENT_OFFSET 0 /* nil.current */
#define CONTEXT_OFFSET 0
#else

View File

@ -44,16 +44,9 @@
* RTOS-specific context offset.
*/
#if defined(_CHIBIOS_RT_CONF_)
#if CH_CFG_USE_REGISTRY
#define CURRENT_OFFSET 20 /* ch.rlist.current */
#define CONTEXT_OFFSET 20
#else
#define CURRENT_OFFSET 12
#define CONTEXT_OFFSET 12
#endif
#elif defined(_CHIBIOS_NIL_CONF_)
#define CURRENT_OFFSET 0 /* nil.current */
#define CONTEXT_OFFSET 0
#else

View File

@ -44,16 +44,9 @@
* RTOS-specific context offset.
*/
#if defined(_CHIBIOS_RT_CONF_)
#if CH_CFG_USE_REGISTRY
#define CURRENT_OFFSET 20 /* ch.rlist.current */
#define CONTEXT_OFFSET 20
#else
#define CURRENT_OFFSET 12
#define CONTEXT_OFFSET 12
#endif
#elif defined(_CHIBIOS_NIL_CONF_)
#define CURRENT_OFFSET 0 /* nil.current */
#define CONTEXT_OFFSET 0
#else

View File

@ -44,16 +44,10 @@
* RTOS-specific context offset.
*/
#if defined(_CHIBIOS_RT_CONF_)
#if CH_CFG_USE_REGISTRY
#define CURRENT_OFFSET 20 /* ch.rlist.current */
#define CONTEXT_OFFSET 20
#else
#define CURRENT_OFFSET 12
#define CONTEXT_OFFSET 12
#endif
#elif defined(_CHIBIOS_NIL_CONF_)
#define CURRENT_OFFSET 0 /* nil.current */
#define CONTEXT_OFFSET 0
#else

View File

@ -44,16 +44,9 @@
* RTOS-specific context offset.
*/
#if defined(_CHIBIOS_RT_CONF_)
#if CH_CFG_USE_REGISTRY
#define CURRENT_OFFSET 20 /* ch.rlist.current */
#define CONTEXT_OFFSET 20
#else
#define CURRENT_OFFSET 12
#define CONTEXT_OFFSET 12
#endif
#elif defined(_CHIBIOS_NIL_CONF_)
#define CURRENT_OFFSET 0 /* nil.current */
#define CONTEXT_OFFSET 0
#else

View File

@ -44,16 +44,9 @@
* RTOS-specific context offset.
*/
#if defined(_CHIBIOS_RT_CONF_)
#if CH_CFG_USE_REGISTRY
#define CURRENT_OFFSET 20 /* ch.rlist.current */
#define CONTEXT_OFFSET 20
#else
#define CURRENT_OFFSET 12
#define CONTEXT_OFFSET 12
#endif
#elif defined(_CHIBIOS_NIL_CONF_)
#define CURRENT_OFFSET 0 /* nil.current */
#define CONTEXT_OFFSET 0
#else

View File

@ -44,13 +44,8 @@
* RTOS-specific context offset.
*/
#if defined(_CHIBIOS_RT_CONF_)
#if CH_CFG_USE_REGISTRY
#define CURRENT_OFFSET 20 /* ch.rlist.current */
#define CONTEXT_OFFSET 20
#else
#define CURRENT_OFFSET 12
#define CONTEXT_OFFSET 12
#endif
#elif defined(_CHIBIOS_NIL_CONF_)
#define CURRENT_OFFSET 0 /* nil.current */

View File

@ -44,16 +44,9 @@
* RTOS-specific context offset.
*/
#if defined(_CHIBIOS_RT_CONF_)
#if CH_CFG_USE_REGISTRY
#define CURRENT_OFFSET 20 /* ch.rlist.current */
#define CONTEXT_OFFSET 20
#else
#define CURRENT_OFFSET 12
#define CONTEXT_OFFSET 12
#endif
#elif defined(_CHIBIOS_NIL_CONF_)
#define CURRENT_OFFSET 0 /* nil.current */
#define CONTEXT_OFFSET 0
#else

View File

@ -41,11 +41,7 @@
* RTOS-specific context offset.
*/
#if defined(_CHIBIOS_RT_CONF_)
#if CH_CFG_USE_REGISTRY
#define CONTEXT_OFFSET "20"
#else
#define CONTEXT_OFFSET "12"
#endif
#elif defined(_CHIBIOS_NIL_CONF_)
#define CONTEXT_OFFSET "0"

View File

@ -55,16 +55,9 @@
* RTOS-specific context offset.
*/
#if defined(_CHIBIOS_RT_CONF_)
#if CH_CFG_USE_REGISTRY
#define CURRENT_OFFSET 20 /* ch.rlist.current */
#define CONTEXT_OFFSET 20
#else
#define CURRENT_OFFSET 12
#define CONTEXT_OFFSET 12
#endif
#elif defined(_CHIBIOS_NIL_CONF_)
#define CURRENT_OFFSET 0 /* nil.current */
#define CONTEXT_OFFSET 0
#else

View File

@ -56,16 +56,9 @@
* RTOS-specific context offset.
*/
#if defined(_CHIBIOS_RT_CONF_)
#if CH_CFG_USE_REGISTRY
#define CURRENT_OFFSET 20 /* ch.rlist.current */
#define CONTEXT_OFFSET 20
#else
#define CURRENT_OFFSET 12
#define CONTEXT_OFFSET 12
#endif
#elif defined(_CHIBIOS_NIL_CONF_)
#define CURRENT_OFFSET 0 /* nil.current */
#define CONTEXT_OFFSET 0
#else

View File

@ -52,16 +52,9 @@
* RTOS-specific context offset.
*/
#if defined(_CHIBIOS_RT_CONF_)
#if CH_CFG_USE_REGISTRY
#define CURRENT_OFFSET 20 /* ch.rlist.current */
#define CONTEXT_OFFSET 20
#else
#define CURRENT_OFFSET 12
#define CONTEXT_OFFSET 12
#endif
#elif defined(_CHIBIOS_NIL_CONF_)
#define CURRENT_OFFSET 0 /* nil.current */
#define CONTEXT_OFFSET 0
#else

View File

@ -122,14 +122,13 @@ struct ch_thread {
ch_priority_queue_t pqueue; /**< @brief Threads ordered queues
element. */
} hdr;
#if (CH_CFG_USE_REGISTRY == TRUE) || defined(__DOXYGEN__)
ch_queue_t rqueue; /**< @brief Registry queue element. */
#endif
/* End of the fields shared with the ReadyList structure. */
/**
* @brief Processor context.
*/
struct port_context ctx;
#if (CH_CFG_USE_REGISTRY == TRUE) || defined(__DOXYGEN__)
ch_queue_t rqueue; /**< @brief Registry queue element. */
#endif
#if (CH_CFG_SMP_MODE != FALSE) || defined(__DOXYGEN__)
/**
* @brief OS instance owner of this thread.
@ -302,13 +301,6 @@ typedef struct ch_ready_list {
* @note The priority field must be initialized to zero.
*/
ch_priority_queue_t pqueue;
#if (CH_CFG_USE_REGISTRY == TRUE) || defined(__DOXYGEN__)
/**
* @brief Registry header.
*/
ch_queue_t registry;
#endif
/* End of the fields shared with the thread_t structure.*/
/**
* @brief The currently running thread.
*/
@ -358,6 +350,12 @@ struct ch_os_instance {
* @brief Virtual timers delta list header.
*/
virtual_timers_list_t vtlist;
#if (CH_CFG_USE_REGISTRY == TRUE) || defined(__DOXYGEN__)
/**
* @brief Registry header.
*/
ch_queue_t reglist;
#endif
/**
* @brief Main thread descriptor.
*/

View File

@ -89,7 +89,7 @@ typedef struct {
* @param[in] oip pointer to the OS instance
* @param[in] tp thread to add to the registry
*/
#define REG_INSERT(oip, tp) ch_queue_insert(&(tp)->rqueue, &(oip)->rlist.registry)
#define REG_INSERT(oip, tp) ch_queue_insert(&(tp)->rqueue, &(oip)->reglist)
/*===========================================================================*/
/* External declarations. */

View File

@ -136,7 +136,7 @@ thread_t *chRegFirstThread(void) {
uint8_t *p;
chSysLock();
p = (uint8_t *)currcore->rlist.registry.next;
p = (uint8_t *)currcore->reglist.next;
tp = (thread_t *)(p - offsetof(thread_t, rqueue));
#if CH_CFG_USE_DYNAMIC == TRUE
tp->refs++;
@ -165,7 +165,7 @@ thread_t *chRegNextThread(thread_t *tp) {
/* Next element in the registry queue.*/
nqp = tp->rqueue.next;
if (nqp == &currcore->rlist.registry) {
if (nqp == &currcore->reglist) {
ntp = NULL;
}
#if CH_CFG_USE_DYNAMIC == TRUE

View File

@ -319,7 +319,7 @@ void chSchObjectInit(os_instance_t *oip,
/* Registry initialization.*/
#if CH_CFG_USE_REGISTRY == TRUE
ch_queue_init(&oip->rlist.registry);
ch_queue_init(&oip->reglist);
#endif
/* Virtual timers list initialization.*/

View File

@ -248,15 +248,15 @@ bool chSysIntegrityCheckI(unsigned testmask) {
/* Scanning the ready list forward.*/
n = (cnt_t)0;
qp = oip->rlist.registry.next;
while (qp != &oip->rlist.registry) {
qp = oip->reglist.next;
while (qp != &oip->reglist) {
n++;
qp = qp->next;
}
/* Scanning the ready list backward.*/
qp = oip->rlist.registry.prev;
while (qp != &oip->rlist.registry) {
qp = oip->reglist.prev;
while (qp != &oip->reglist) {
n--;
qp = qp->prev;
}