aboutsummaryrefslogtreecommitdiffstats
path: root/os/rt/src/chthreads.c
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2016-03-16 09:20:45 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2016-03-16 09:20:45 +0000
commitceeef3c918319996786b297b40a43e99e446e2c9 (patch)
tree54bfc13b658becedc48ec8a3fa42aff9ebfd3b3c /os/rt/src/chthreads.c
parent1a503b3dfaaeed2e430f8e530d4c3a5fd3a015bc (diff)
downloadChibiOS-ceeef3c918319996786b297b40a43e99e446e2c9.tar.gz
ChibiOS-ceeef3c918319996786b297b40a43e99e446e2c9.tar.bz2
ChibiOS-ceeef3c918319996786b297b40a43e99e446e2c9.zip
Added extra assertions to threads creation to prevent registry corruption, updated the test suite.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9121 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/rt/src/chthreads.c')
-rw-r--r--os/rt/src/chthreads.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/os/rt/src/chthreads.c b/os/rt/src/chthreads.c
index 04b8fab4c..f432aab1e 100644
--- a/os/rt/src/chthreads.c
+++ b/os/rt/src/chthreads.c
@@ -216,6 +216,11 @@ thread_t *chThdCreateSuspendedI(const thread_descriptor_t *tdp) {
thread_t *chThdCreateSuspended(const thread_descriptor_t *tdp) {
thread_t *tp;
+#if CH_CFG_USE_REGISTRY == TRUE
+ chDbgAssert(chRegFindThreadByWorkingArea(tdp->wbase) == NULL,
+ "working area in use");
+#endif
+
#if CH_DBG_FILL_THREADS == TRUE
_thread_memfill((uint8_t *)tdp->wbase,
(uint8_t *)tdp->wend,
@@ -275,6 +280,11 @@ thread_t *chThdCreateI(const thread_descriptor_t *tdp) {
thread_t *chThdCreate(const thread_descriptor_t *tdp) {
thread_t *tp;
+#if CH_CFG_USE_REGISTRY == TRUE
+ chDbgAssert(chRegFindThreadByWorkingArea(tdp->wbase) == NULL,
+ "working area in use");
+#endif
+
#if CH_DBG_FILL_THREADS == TRUE
_thread_memfill((uint8_t *)tdp->wbase,
(uint8_t *)tdp->wend,
@@ -319,6 +329,11 @@ thread_t *chThdCreateStatic(void *wsp, size_t size,
MEM_IS_ALIGNED(size, PORT_STACK_ALIGN) &&
(prio <= HIGHPRIO) && (pf != NULL));
+#if CH_CFG_USE_REGISTRY == TRUE
+ chDbgAssert(chRegFindThreadByWorkingArea(wsp) == NULL,
+ "working area in use");
+#endif
+
#if CH_DBG_FILL_THREADS == TRUE
_thread_memfill((uint8_t *)wsp,
(uint8_t *)wsp + size,