diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-01-11 18:02:20 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-01-11 18:02:20 +0000 |
commit | 58f1fe92ee9c68ffd08bccd19f67eafbbc968a71 (patch) | |
tree | fb593f55912ac98d9d82f9b5e70a3edc751b2fb6 /os/ports | |
parent | 1ed89364ca6b9b6c89d13f6d39f7b2d085c8f8e4 (diff) | |
download | ChibiOS-58f1fe92ee9c68ffd08bccd19f67eafbbc968a71.tar.gz ChibiOS-58f1fe92ee9c68ffd08bccd19f67eafbbc968a71.tar.bz2 ChibiOS-58f1fe92ee9c68ffd08bccd19f67eafbbc968a71.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3788 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/ports')
-rw-r--r-- | os/ports/GCC/SIMIA32/chcore.c | 17 | ||||
-rw-r--r-- | os/ports/GCC/SIMIA32/chcore.h | 11 |
2 files changed, 13 insertions, 15 deletions
diff --git a/os/ports/GCC/SIMIA32/chcore.c b/os/ports/GCC/SIMIA32/chcore.c index 58f079ef5..fff2b22c4 100644 --- a/os/ports/GCC/SIMIA32/chcore.c +++ b/os/ports/GCC/SIMIA32/chcore.c @@ -69,17 +69,16 @@ void port_halt(void) { }
/**
- * Threads return point, it just invokes @p chThdExit().
+ * @brief Start a thread by invoking its work function.
+ * @details If the work function returns @p chThdExit() is automatically
+ * invoked.
*/
-void threadexit(void) {
+__attribute__((cdecl, noreturn))
+void _port_thread_start(msg_t (*pf)(void *), void *p) {
-#if defined(WIN32) || defined (__APPLE__)
- asm volatile ("push %eax \n\t" \
- "call _chThdExit");
-#else
- asm volatile ("push %eax \n\t" \
- "call chThdExit");
-#endif
+ chSysUnlock();
+ chThdExit(pf(p));
+ while(1);
}
/** @} */
diff --git a/os/ports/GCC/SIMIA32/chcore.h b/os/ports/GCC/SIMIA32/chcore.h index 8bfa719f8..636ae3886 100644 --- a/os/ports/GCC/SIMIA32/chcore.h +++ b/os/ports/GCC/SIMIA32/chcore.h @@ -105,13 +105,11 @@ struct context { */
#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \
uint8_t *esp = (uint8_t *)workspace + wsize; \
- APUSH(esp, 0); \
- APUSH(esp, 0); \
- APUSH(esp, 0); \
APUSH(esp, arg); \
- APUSH(esp, threadexit); \
+ APUSH(esp, pf); \
+ APUSH(esp, 0); \
esp -= sizeof(struct intctx); \
- ((struct intctx *)esp)->eip = pf; \
+ ((struct intctx *)esp)->eip = _port_thread_start; \
((struct intctx *)esp)->ebx = 0; \
((struct intctx *)esp)->edi = 0; \
((struct intctx *)esp)->esi = 0; \
@@ -224,7 +222,8 @@ extern "C" { #endif
__attribute__((fastcall)) void port_switch(Thread *ntp, Thread *otp);
__attribute__((fastcall)) void port_halt(void);
- void threadexit(void);
+ __attribute__((cdecl, noreturn)) void _port_thread_start(msg_t (*pf)(void *),
+ void *p);
void ChkIntSources(void);
#ifdef __cplusplus
}
|