diff options
Diffstat (limited to 'firmware/export/thread.h')
-rw-r--r-- | firmware/export/thread.h | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/firmware/export/thread.h b/firmware/export/thread.h index 3cce78444c..4f7631cebd 100644 --- a/firmware/export/thread.h +++ b/firmware/export/thread.h | |||
@@ -84,15 +84,19 @@ | |||
84 | * We need more stack when we run under a host | 84 | * We need more stack when we run under a host |
85 | * maybe more expensive C lib functions? | 85 | * maybe more expensive C lib functions? |
86 | * | 86 | * |
87 | * simulator doesn't simulate stack usage anyway but well ... */ | 87 | * simulator (possibly) doesn't simulate stack usage anyway but well ... */ |
88 | #if ((CONFIG_PLATFORM & PLATFORM_NATIVE) || defined(SIMULATOR)) | 88 | #ifdef HAVE_SIGALTSTACK_THREADS |
89 | #define DEFAULT_STACK_SIZE 0x400 /* Bytes */ | 89 | #include <signal.h> |
90 | #else | 90 | /* MINSIGSTKSZ for the OS to deliver the signal + 0x3000 for us */ |
91 | #define DEFAULT_STACK_SIZE (MINSIGSTKSZ+0x3000) /* Bytes */ | ||
92 | #elif (CONFIG_PLATFORM & PLATFORM_ANDROID) || defined(HAVE_WIN32_FIBER_THREADS) | ||
91 | #define DEFAULT_STACK_SIZE 0x1000 /* Bytes */ | 93 | #define DEFAULT_STACK_SIZE 0x1000 /* Bytes */ |
94 | #else /* native threads, sdl threads */ | ||
95 | #define DEFAULT_STACK_SIZE 0x400 /* Bytes */ | ||
92 | #endif | 96 | #endif |
93 | 97 | ||
94 | 98 | ||
95 | #if (CONFIG_PLATFORM & (PLATFORM_NATIVE|PLATFORM_ANDROID)) | 99 | #if defined(ASSEMBLER_THREADS) |
96 | /* Need to keep structures inside the header file because debug_menu | 100 | /* Need to keep structures inside the header file because debug_menu |
97 | * needs them. */ | 101 | * needs them. */ |
98 | #ifdef CPU_COLDFIRE | 102 | #ifdef CPU_COLDFIRE |
@@ -112,7 +116,7 @@ struct regs | |||
112 | uint32_t pr; /* 32 - Procedure register */ | 116 | uint32_t pr; /* 32 - Procedure register */ |
113 | uint32_t start; /* 36 - Thread start address, or NULL when started */ | 117 | uint32_t start; /* 36 - Thread start address, or NULL when started */ |
114 | }; | 118 | }; |
115 | #elif defined(CPU_ARM) || (CONFIG_PLATFORM & PLATFORM_ANDROID) | 119 | #elif defined(CPU_ARM) |
116 | struct regs | 120 | struct regs |
117 | { | 121 | { |
118 | uint32_t r[8]; /* 0-28 - Registers r4-r11 */ | 122 | uint32_t r[8]; /* 0-28 - Registers r4-r11 */ |
@@ -147,6 +151,16 @@ struct regs | |||
147 | }; | 151 | }; |
148 | #endif /* CONFIG_CPU */ | 152 | #endif /* CONFIG_CPU */ |
149 | #elif (CONFIG_PLATFORM & PLATFORM_HOSTED) | 153 | #elif (CONFIG_PLATFORM & PLATFORM_HOSTED) |
154 | #ifndef HAVE_SDL_THREADS | ||
155 | struct regs | ||
156 | { | ||
157 | void (*start)(void); /* thread's entry point, or NULL when started */ | ||
158 | void* uc; /* host thread handle */ | ||
159 | uintptr_t sp; /* Stack pointer, unused */ | ||
160 | size_t stack_size; /* stack size, not always used */ | ||
161 | uintptr_t stack; /* pointer to start of the stack buffer */ | ||
162 | }; | ||
163 | #else /* SDL threads */ | ||
150 | struct regs | 164 | struct regs |
151 | { | 165 | { |
152 | void *t; /* OS thread */ | 166 | void *t; /* OS thread */ |
@@ -154,6 +168,7 @@ struct regs | |||
154 | void *s; /* Semaphore for blocking and wakeup */ | 168 | void *s; /* Semaphore for blocking and wakeup */ |
155 | void (*start)(void); /* Start function */ | 169 | void (*start)(void); /* Start function */ |
156 | }; | 170 | }; |
171 | #endif | ||
157 | #endif /* PLATFORM_NATIVE */ | 172 | #endif /* PLATFORM_NATIVE */ |
158 | 173 | ||
159 | /* NOTE: The use of the word "queue" may also refer to a linked list of | 174 | /* NOTE: The use of the word "queue" may also refer to a linked list of |