| Index: emcore/trunk/init.c | 
| — | — | @@ -133,7 +133,7 @@ | 
| 134 | 134 | #endif | 
| 135 | 135 |  | 
| 136 | 136 | void initthread(void* arg0, void* arg1, void* arg2, void* arg3) INITCODE_ATTR; | 
| 137 |  | -void initthread(void* arg0, void* bootalloc, void* arg2, void* arg3)
 | 
|  | 137 | +void initthread(void* arg0, void* arg1, void* arg2, void* arg3) | 
| 138 | 138 | { | 
| 139 | 139 | struct initbss* ib = (struct initbss*)arg0; | 
| 140 | 140 | #ifdef HAVE_I2C | 
| — | — | @@ -244,7 +244,6 @@ | 
| 245 | 245 | else option = option->fail_next; | 
| 246 | 246 | } | 
| 247 | 247 | if (!success) cputs(CONSOLE_BOOT, nobootoptionsstr); | 
| 248 |  | -    free(bootalloc);
 | 
| 249 | 248 | } | 
| 250 | 249 |  | 
| 251 | 250 | void init() INITCODE_ATTR; | 
| — | — | @@ -271,7 +270,7 @@ | 
| 272 | 271 | reownalloc(ib, OWNER_TYPE(OWNER_THREAD, &(ib->initthread))); | 
| 273 | 272 | reownalloc(bootalloc, OWNER_TYPE(OWNER_THREAD, &(ib->initthread))); | 
| 274 | 273 | thread_create(&(ib->initthread), initthreadname, initthread, ib->initstack, | 
| 275 |  | -                  sizeof(ib->initstack), OS_THREAD, 127, true, ib, bootalloc, NULL, NULL);
 | 
|  | 274 | +                  sizeof(ib->initstack), OS_THREAD, 127, true, ib, NULL, NULL, NULL); | 
| 276 | 275 | timer_init(); | 
| 277 | 276 | interrupt_init(); | 
| 278 | 277 | } | 
| Index: emcore/trunk/execimage.c | 
| — | — | @@ -28,7 +28,7 @@ | 
| 29 | 29 | #include "malloc.h" | 
| 30 | 30 |  | 
| 31 | 31 |  | 
| 32 |  | -struct scheduler_thread* execimage(void* image, bool copy, int argc, const char** argv)
 | 
|  | 32 | +struct scheduler_thread* execimage(void* image, bool copy, int argc, const char* const* argv) | 
| 33 | 33 | { | 
| 34 | 34 | int i; | 
| 35 | 35 | struct emcoreapp_header* header = (struct emcoreapp_header*)image; | 
| — | — | @@ -62,6 +62,7 @@ | 
| 63 | 63 | for (i = 0; i < argc; i++) | 
| 64 | 64 | argsize += 5 + strlen(argv[i]); | 
| 65 | 65 | else argc = 0; | 
|  | 66 | +    argsize = (argsize + 3) & ~3; | 
| 66 | 67 | size_t finalsize; | 
| 67 | 68 | if (lib) finalsize = textsize + bsssize; | 
| 68 | 69 | else finalsize = textsize + bsssize + argsize + stacksize; | 
| — | — | @@ -122,6 +123,7 @@ | 
| 123 | 124 | void* ptr = image + textsize; | 
| 124 | 125 | memset(ptr, 0, bsssize); | 
| 125 | 126 | ptr += bsssize; | 
|  | 127 | +    void* argv_copy = ptr; | 
| 126 | 128 | if (argv) | 
| 127 | 129 | { | 
| 128 | 130 | memcpy(image + textsize + bsssize, argv, argc * 4); | 
| — | — | @@ -133,6 +135,7 @@ | 
| 134 | 136 | ptr += len; | 
| 135 | 137 | } | 
| 136 | 138 | } | 
|  | 139 | +    ptr = (void*)(((int)ptr + 3) & ~3); | 
| 137 | 140 | clean_dcache(); | 
| 138 | 141 | invalidate_icache(); | 
| 139 | 142 | struct scheduler_thread* thread; | 
| — | — | @@ -141,7 +144,7 @@ | 
| 142 | 145 | else | 
| 143 | 146 | { | 
| 144 | 147 | thread = thread_create(NULL, NULL, image + entrypoint, ptr, stacksize, | 
| 145 |  | -                               USER_THREAD, 127, false, (void*)argc, argv, NULL, NULL);
 | 
|  | 148 | +                               USER_THREAD, 127, false, (void*)argc, argv_copy, NULL, NULL); | 
| 146 | 149 | if (thread) | 
| 147 | 150 | { | 
| 148 | 151 | reownalloc(image, OWNER_TYPE(OWNER_THREAD, thread)); | 
| Index: emcore/trunk/execimage.h | 
| — | — | @@ -54,7 +54,7 @@ | 
| 55 | 55 |  | 
| 56 | 56 |  | 
| 57 | 57 | #ifndef _TOOL | 
| 58 |  | -struct scheduler_thread* execimage(void* image, bool copy, int argc, const char** argv);
 | 
|  | 58 | +struct scheduler_thread* execimage(void* image, bool copy, int argc, const char* const* argv); | 
| 59 | 59 | #endif | 
| 60 | 60 |  | 
| 61 | 61 |  |