Small optimizations in stack filling code.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14657 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
40405ac29c
commit
6975e6673e
|
@ -291,7 +291,7 @@ extern "C" {
|
||||||
const char *name,
|
const char *name,
|
||||||
tprio_t prio);
|
tprio_t prio);
|
||||||
#if CH_DBG_FILL_THREADS == TRUE
|
#if CH_DBG_FILL_THREADS == TRUE
|
||||||
void __thd_memfill(uint8_t *startp, uint8_t *endp, uint8_t v);
|
void __thd_stackfill(uint8_t *startp, uint8_t *endp);
|
||||||
#endif
|
#endif
|
||||||
thread_t *chThdCreateSuspendedI(const thread_descriptor_t *tdp);
|
thread_t *chThdCreateSuspendedI(const thread_descriptor_t *tdp);
|
||||||
thread_t *chThdCreateSuspended(const thread_descriptor_t *tdp);
|
thread_t *chThdCreateSuspended(const thread_descriptor_t *tdp);
|
||||||
|
|
|
@ -94,9 +94,7 @@ thread_t *chThdCreateFromHeap(memory_heap_t *heapp, size_t size,
|
||||||
thread_descriptor_t td = THD_DESCRIPTOR(name, wbase, wend, prio, pf, arg);
|
thread_descriptor_t td = THD_DESCRIPTOR(name, wbase, wend, prio, pf, arg);
|
||||||
|
|
||||||
#if CH_DBG_FILL_THREADS == TRUE
|
#if CH_DBG_FILL_THREADS == TRUE
|
||||||
__thd_memfill((uint8_t *)wbase,
|
__thd_stackfill((uint8_t *)wbase, (uint8_t *)wend);
|
||||||
(uint8_t *)wbase + size,
|
|
||||||
CH_DBG_STACK_FILL_VALUE);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
@ -152,9 +150,7 @@ thread_t *chThdCreateFromMemoryPool(memory_pool_t *mp, const char *name,
|
||||||
thread_descriptor_t td = THD_DESCRIPTOR(name, wbase, wend, prio, pf, arg);
|
thread_descriptor_t td = THD_DESCRIPTOR(name, wbase, wend, prio, pf, arg);
|
||||||
|
|
||||||
#if CH_DBG_FILL_THREADS == TRUE
|
#if CH_DBG_FILL_THREADS == TRUE
|
||||||
__thd_memfill((uint8_t *)wbase,
|
__thd_stackfill((uint8_t *)wbase, (uint8_t *)wend);
|
||||||
(uint8_t *)wbase + mp->object_size,
|
|
||||||
CH_DBG_STACK_FILL_VALUE);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
|
|
@ -174,9 +174,8 @@ void chInstanceObjectInit(os_instance_t *oip,
|
||||||
};
|
};
|
||||||
|
|
||||||
#if CH_DBG_FILL_THREADS == TRUE
|
#if CH_DBG_FILL_THREADS == TRUE
|
||||||
__thd_memfill((uint8_t *)idle_descriptor.wbase,
|
__thd_stackfill((uint8_t *)idle_descriptor.wbase,
|
||||||
(uint8_t *)idle_descriptor.wend,
|
(uint8_t *)idle_descriptor.wend);
|
||||||
CH_DBG_STACK_FILL_VALUE);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This thread has the lowest priority in the system, its role is just to
|
/* This thread has the lowest priority in the system, its role is just to
|
||||||
|
|
|
@ -130,20 +130,18 @@ thread_t *__thd_object_init(os_instance_t *oip,
|
||||||
|
|
||||||
#if (CH_DBG_FILL_THREADS == TRUE) || defined(__DOXYGEN__)
|
#if (CH_DBG_FILL_THREADS == TRUE) || defined(__DOXYGEN__)
|
||||||
/**
|
/**
|
||||||
* @brief Memory fill utility.
|
* @brief Stack fill utility.
|
||||||
* @todo Optimize using the stack align type instead of uint8_t.
|
|
||||||
*
|
*
|
||||||
* @param[in] startp first address to fill
|
* @param[in] startp first address to fill
|
||||||
* @param[in] endp last address to fill +1
|
* @param[in] endp last address to fill +1
|
||||||
* @param[in] v filler value
|
|
||||||
*
|
*
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
void __thd_memfill(uint8_t *startp, uint8_t *endp, uint8_t v) {
|
void __thd_stackfill(uint8_t *startp, uint8_t *endp) {
|
||||||
|
|
||||||
while (startp < endp) {
|
do {
|
||||||
*startp++ = v;
|
*startp++ = CH_DBG_STACK_FILL_VALUE;
|
||||||
}
|
} while (likely(startp < endp));
|
||||||
}
|
}
|
||||||
#endif /* CH_DBG_FILL_THREADS */
|
#endif /* CH_DBG_FILL_THREADS */
|
||||||
|
|
||||||
|
@ -234,9 +232,7 @@ thread_t *chThdCreateSuspended(const thread_descriptor_t *tdp) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CH_DBG_FILL_THREADS == TRUE
|
#if CH_DBG_FILL_THREADS == TRUE
|
||||||
__thd_memfill((uint8_t *)tdp->wbase,
|
__thd_stackfill((uint8_t *)tdp->wbase, (uint8_t *)tdp->wend);
|
||||||
(uint8_t *)tdp->wend,
|
|
||||||
CH_DBG_STACK_FILL_VALUE);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
@ -299,9 +295,7 @@ thread_t *chThdCreate(const thread_descriptor_t *tdp) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CH_DBG_FILL_THREADS == TRUE
|
#if CH_DBG_FILL_THREADS == TRUE
|
||||||
__thd_memfill((uint8_t *)tdp->wbase,
|
__thd_stackfill((uint8_t *)tdp->wbase, (uint8_t *)tdp->wend);
|
||||||
(uint8_t *)tdp->wend,
|
|
||||||
CH_DBG_STACK_FILL_VALUE);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
@ -349,9 +343,7 @@ thread_t *chThdCreateStatic(void *wsp, size_t size,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CH_DBG_FILL_THREADS == TRUE
|
#if CH_DBG_FILL_THREADS == TRUE
|
||||||
__thd_memfill((uint8_t *)wsp,
|
__thd_stackfill((uint8_t *)wsp, (uint8_t *)wsp + size);
|
||||||
(uint8_t *)wsp + size,
|
|
||||||
CH_DBG_STACK_FILL_VALUE);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
|
Loading…
Reference in New Issue