summaryrefslogtreecommitdiff
path: root/firmware/asm
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2012-06-11 21:40:05 +0200
committerFrank Gevaerts <frank@gevaerts.be>2012-06-11 22:27:41 +0200
commit268b725c405fc08d79b8e020f1fe89dfc963bf35 (patch)
tree3640a8b05197983427bd7a8f7a294258a678a91a /firmware/asm
parentcbd44f4bc4d9c49364f317df6111f5ad9c4213bf (diff)
Rearrange #ifdefs a bit, so SIGALTSTACK overrides CPU-specific threading.
Change-Id: Ie3661f53bd7576d965fcc52facb532199b87c017
Diffstat (limited to 'firmware/asm')
-rw-r--r--firmware/asm/thread.c20
-rw-r--r--firmware/asm/thread.h35
2 files changed, 26 insertions, 29 deletions
diff --git a/firmware/asm/thread.c b/firmware/asm/thread.c
index 49e71d73af..d6b881bdc5 100644
--- a/firmware/asm/thread.c
+++ b/firmware/asm/thread.c
@@ -1,4 +1,11 @@
-#if defined(CPU_ARM)
+ /* First some generic implementations */
+#if defined(HAVE_WIN32_FIBER_THREADS)
+ #include "thread-win32.c"
+#elif defined(HAVE_SIGALTSTACK_THREADS)
+ #include "thread-unix.c"
+
+ /* Now the CPU-specific implementations */
+#elif defined(CPU_ARM)
#include "arm/thread.c"
#elif defined(CPU_COLDFIRE)
#include "m68k/thread.c"
@@ -7,15 +14,6 @@
#elif defined(CPU_MIPS)
#include "mips/thread.c"
#else
-
-/* generic thread.c */
-
-#if defined(HAVE_WIN32_FIBER_THREADS)
- #include "thread-win32.c"
-#elif defined(HAVE_SIGALTSTACK_THREADS)
- #include "thread-unix.c"
-#else
+ /* Nothing? OK, give up */
#error Missing thread impl
#endif
-
-#endif
diff --git a/firmware/asm/thread.h b/firmware/asm/thread.h
index 9bdff3881e..3fa8f5625d 100644
--- a/firmware/asm/thread.h
+++ b/firmware/asm/thread.h
@@ -23,18 +23,10 @@
#define __ASM_THREAD_H__
#include "config.h"
-#if defined(CPU_ARM)
- #include "arm/thread.h"
-#elif defined(CPU_COLDFIRE)
- #include "m68k/thread.h"
-#elif CONFIG_CPU == SH7034
- #include "sh/thread.h"
-#elif defined(CPU_MIPS)
- #include "mips/thread.h"
-#else
-
/* generic thread.h */
+#if defined(HAVE_WIN32_FIBER_THREADS) || defined(HAVE_SIGALTSTACK_THREADS)
+
struct regs
{
void (*start)(void); /* thread's entry point, or NULL when started */
@@ -44,14 +36,21 @@ struct regs
uintptr_t stack; /* pointer to start of the stack buffer */
};
-#ifdef HAVE_SIGALTSTACK_THREADS
- #include <signal.h>
- /* MINSIGSTKSZ for the OS to deliver the signal + 0x3000 for us */
- #define DEFAULT_STACK_SIZE (MINSIGSTKSZ+0x3000) /* Bytes */
-#elif defined(HAVE_WIN32_FIBER_THREADS)
- #define DEFAULT_STACK_SIZE 0x1000 /* Bytes */
+ #ifdef HAVE_SIGALTSTACK_THREADS
+ #include <signal.h>
+ /* MINSIGSTKSZ for the OS to deliver the signal + 0x3000 for us */
+ #define DEFAULT_STACK_SIZE (MINSIGSTKSZ+0x3000) /* Bytes */
+ #elif defined(HAVE_WIN32_FIBER_THREADS)
+ #define DEFAULT_STACK_SIZE 0x1000 /* Bytes */
+ #endif
+#elif defined(CPU_ARM)
+ #include "arm/thread.h"
+#elif defined(CPU_COLDFIRE)
+ #include "m68k/thread.h"
+#elif CONFIG_CPU == SH7034
+ #include "sh/thread.h"
+#elif defined(CPU_MIPS)
+ #include "mips/thread.h"
#endif
-#endif /* __ASM_THREAD_H__ */
-
#endif