summaryrefslogtreecommitdiff
path: root/firmware/thread.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-08-02 20:34:47 +0000
committerThomas Martitz <kugel@rockbox.org>2010-08-02 20:34:47 +0000
commit240923a801382c86545d10be167a15892a556fb6 (patch)
tree3c0e07ec3abf0c493a0b24b0b57e8bbd0200f7f6 /firmware/thread.c
parent850efead04f10488b478a0f255a2464a01156a7f (diff)
Rockbox as an application: Commit current Android port progress.
General state is: Rockbox is usable (plays music, saves configuration, touchscreen works too). Problems: - Playing music in the background (i.e. when switching to another app) doesn't work reliably, but I'm working on that now. - no cabbiev2 (only some preliminary files for it), no other default theme. - screen flickers sometimes if the updates are too frequent - no multi screen apk/package - strange behavior when a phone call comes in The java files (and the eclipse project) resides in android/, which is also supposed to be the build folder. I've put a small README in there for instructions. There are some steps needed after the make part, which are described there, and which eclipse mostly handles. But there ought to be some script/makefile rules which do that instead in the future. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27668 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/thread.c')
-rw-r--r--firmware/thread.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/firmware/thread.c b/firmware/thread.c
index c00fc36e3f..b3d8ec3970 100644
--- a/firmware/thread.c
+++ b/firmware/thread.c
@@ -123,8 +123,13 @@ static struct core_entry cores[NUM_CORES] IBSS_ATTR;
struct thread_entry threads[MAXTHREADS] IBSS_ATTR;
static const char main_thread_name[] = "main";
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
extern uintptr_t stackbegin[];
extern uintptr_t stackend[];
+#else
+extern uintptr_t *stackbegin;
+extern uintptr_t *stackend;
+#endif
static inline void core_sleep(IF_COP_VOID(unsigned int core))
__attribute__((always_inline));
@@ -170,7 +175,9 @@ void switch_thread(void)
/****************************************************************************
* Processor-specific section - include necessary core support
*/
-#if defined(CPU_ARM)
+#if defined(ANDROID)
+#include "thread-android-arm.c"
+#elif defined(CPU_ARM)
#include "thread-arm.c"
#if defined (CPU_PP)
#include "thread-pp.c"
@@ -1150,7 +1157,7 @@ void switch_thread(void)
store_context(&thread->context);
/* Check if the current thread stack is overflown */
- if (UNLIKELY(thread->stack[0] != DEADBEEF))
+ if (UNLIKELY(thread->stack[0] != DEADBEEF) && thread->stack_size > 0)
thread_stkov(thread);
#if NUM_CORES > 1
@@ -2319,7 +2326,9 @@ static int stack_usage(uintptr_t *stackptr, size_t stack_size)
*/
int thread_stack_usage(const struct thread_entry *thread)
{
- return stack_usage(thread->stack, thread->stack_size);
+ if (LIKELY(thread->stack_size > 0))
+ return stack_usage(thread->stack, thread->stack_size);
+ return 0;
}
#if NUM_CORES > 1