freemyipod r299 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r298‎ | r299 | r300 >
Date:18:23, 1 December 2010
Author:theseven
Status:new
Tags:
Comment:
emBIOS: Make sure that the BSS is cleared properly in apps.
Modified paths:
  • /embios/trunk/export/embiosapp.h (modified) (history)

Diff [purge]

Index: embios/trunk/export/embiosapp.h
@@ -2,16 +2,19 @@
33
44
55 #define EMBIOS_APP_HEADER(threadnamestr, stacksizebytes, mainfunc, threadprio) \
 6+ extern char __bss_start; \
 7+ extern char __bss_end; \
68 void __embios_init() \
79 { \
8 - asm volatile("swi\t2\n\tldr\tr3,\t=__embios_required_version\nldr\tr3,\t[r3]\n\t" \
9 - "ldr\tr2,\t[r0]\n\tcmp\tr3,\tr2\n\tldrls\tr1,\t[r0,#4]\n\tcmpls\tr1,\tr3\n\t"\
10 - "movhi\tr0,\t#0\n\tldrhi\tr1,\t=__embios_incompatible_api_str\n\t" \
11 - "swihi\t1\n\tldr\tr1,\t=__embios_syscall\n\tstr\tr0,\t[r1]\n\t" \
 10+ asm volatile("swi\t2\n\tldr\tr3, =__embios_required_version\nldr\tr3, [r3]\n\t" \
 11+ "ldr\tr2, [r0]\n\tcmp\tr3, r2\n\tldrls\tr1, [r0,#4]\n\tcmpls\tr1, r3\n\t" \
 12+ "movhi\tr0, #0\n\tldrhi\tr1, =__embios_incompatible_api_str\n\t" \
 13+ "swihi\t1\n\tldr\tr1, =__embios_syscall\n\tstr\tr0, [r1]\n\t" \
1214 ::: "r0", "r1", "r2", "r3", "r12", "lr", "cc", "memory"); \
 15+ memset(&__bss_start, 0, (&__bss_end) - (&__bss_start)); \
1316 mainfunc(); \
1417 } \
15 - uint32_t __embios_thread_stack[stacksizebytes >> 2]; \
 18+ uint32_t __embios_thread_stack[stacksizebytes >> 2] __attribute__((section(".stack"))); \
1619 const char __embios_thread_name[] = threadnamestr; \
1720 struct embios_app_header \
1821 { \
@@ -40,6 +43,6 @@
4144 .threadtype = 0, \
4245 .threadpriority = threadprio \
4346 }; \
44 - struct embios_syscall_table* __embios_syscall; \
 47+ struct embios_syscall_table* __embios_syscall __attribute__((section(".stack"))); \
4548 const uint32_t __embios_required_version = EMBIOS_API_VERSION; \
4649 const char __embios_incompatible_api_str[] = "Incompatible API version!\nGot %d, need %d";