Module: xenomai-head Branch: master Commit: 2eee833ac1d1a25a9b347894a71a893d58d7740a URL: http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=2eee833ac1d1a25a9b347894a71a893d58d7740a
Author: Philippe Gerum <r...@xenomai.org> Date: Mon Sep 5 18:47:41 2011 +0200 native, psos+, vxworks: prevent optimizer to trash inline syscall args --- src/skins/native/task.c | 4 +++- src/skins/psos+/task.c | 3 ++- src/skins/vxworks/taskLib.c | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/skins/native/task.c b/src/skins/native/task.c index 5e7be9f..053048f 100644 --- a/src/skins/native/task.c +++ b/src/skins/native/task.c @@ -56,6 +56,7 @@ struct rt_task_iargs { static void *rt_task_trampoline(void *cookie) { struct rt_task_iargs *iargs = (struct rt_task_iargs *)cookie; + volatile pthread_t tid = pthread_self(); void (*entry) (void *cookie); unsigned long mode_offset; struct rt_arg_bulk bulk; @@ -79,11 +80,12 @@ static void *rt_task_trampoline(void *cookie) bulk.a2 = (u_long)iargs->name; bulk.a3 = (u_long)iargs->prio; bulk.a4 = (u_long)iargs->mode; - bulk.a5 = (u_long)pthread_self(); + bulk.a5 = (u_long)tid; /* Signal allocation failures by setting bulk.a6 to 0, they will be propagated to the thread waiting in xn_sys_completion. */ bulk.a6 = !self ? 0UL : (u_long)&mode_offset; + asm volatile("nop;nop;nop"); err = XENOMAI_SKINCALL2(__native_muxid, __native_task_create, &bulk, iargs->completionp); diff --git a/src/skins/psos+/task.c b/src/skins/psos+/task.c index 40d0f04..a43f7fb 100644 --- a/src/skins/psos+/task.c +++ b/src/skins/psos+/task.c @@ -62,6 +62,7 @@ static void *psos_task_trampoline(void *cookie) { struct psos_task_iargs *iargs = (struct psos_task_iargs *)cookie; void (*entry)(u_long, u_long, u_long, u_long); + volatile pthread_t tid = pthread_self(); struct psos_arg_bulk bulk; unsigned long mode_offset; u_long handle, targs[4]; @@ -74,7 +75,7 @@ static void *psos_task_trampoline(void *cookie) bulk.a2 = (u_long)iargs->prio; bulk.a3 = (u_long)iargs->flags; bulk.a4 = (u_long)&mode_offset; - bulk.a5 = (u_long)pthread_self(); + bulk.a5 = (u_long)tid; if (!bulk.a4) { err = -ENOMEM; diff --git a/src/skins/vxworks/taskLib.c b/src/skins/vxworks/taskLib.c index f751788..7d318ae 100644 --- a/src/skins/vxworks/taskLib.c +++ b/src/skins/vxworks/taskLib.c @@ -86,6 +86,7 @@ static void *wind_task_trampoline(void *cookie) { struct wind_task_iargs *iargs = (struct wind_task_iargs *)cookie, _iargs; + volatile pthread_t tid = pthread_self(); struct wind_arg_bulk bulk; unsigned long mode_offset; WIND_TCB *pTcb; @@ -101,7 +102,7 @@ static void *wind_task_trampoline(void *cookie) bulk.a1 = (u_long)iargs->name; bulk.a2 = (u_long)iargs->prio; bulk.a3 = (u_long)iargs->flags; - bulk.a4 = (u_long)pthread_self(); + bulk.a4 = (u_long)tid; bulk.a5 = (u_long)&mode_offset; pTcb = iargs->pTcb; _______________________________________________ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git