| Index: apps/iloader/main.c | 
| — | — | @@ -9,7 +9,7 @@ | 
| 10 | 10 | uint16_t backdrop[240 * 320]; | 
| 11 | 11 |  | 
| 12 | 12 | uint32_t config[0x4000]; | 
| 13 |  | -uint32_t nordir[0x200];
 | 
|  | 13 | +uint32_t nordir[0x400]; | 
| 14 | 14 |  | 
| 15 | 15 | struct mutex eventmtx; | 
| 16 | 16 | struct wakeup eventwakeup; | 
| — | — | @@ -197,7 +197,8 @@ | 
| 198 | 198 | { | 
| 199 | 199 | if (bootflash_is_memmapped) | 
| 200 | 200 | { | 
| 201 |  | -                        if (ucl_decompress(filename, size, (void*)config[pc + 1], &size))
 | 
|  | 201 | +                        if (ucl_decompress(bootflash_getaddr(filename), size, | 
|  | 202 | +                                           (void*)config[pc + 1], &size)) | 
| 202 | 203 | pc = errhandler; | 
| 203 | 204 | else pc += 3; | 
| 204 | 205 | } | 
| Index: apps/iloader/Makefile | 
| — | — | @@ -77,10 +77,10 @@ | 
| 78 | 78 | build/version.h: version.h .svn/entries | 
| 79 | 79 | @echo [PP]     $< | 
| 80 | 80 | ifeq ($(shell uname),WindowsNT) | 
| 81 |  | -	@-if not exist $$(subst /,\,$$(dir $$@)) md $$(subst /,\,$$(dir $$@))
 | 
|  | 81 | +	@-if not exist build md build | 
| 82 | 82 | @sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@ | 
| 83 | 83 | else | 
| 84 |  | -	@-mkdir -p $$(dir $$@)
 | 
|  | 84 | +	@-mkdir -p build | 
| 85 | 85 | @sed -e 's/\$$REVISION\$$/$(REVISION)/' -e 's/\$$REVISIONINT\$$/$(REVISIONINT)/' < $< > $@ | 
| 86 | 86 | endif | 
| 87 | 87 |  | 
| Index: embios/trunk/init.c | 
| — | — | @@ -57,13 +57,16 @@ | 
| 58 | 58 | bool trydataflash; | 
| 59 | 59 | char dataflashpath[256]; | 
| 60 | 60 | bool dataflashflags; | 
|  | 61 | +    void* dataflashdest; | 
| 61 | 62 | bool trybootflash; | 
| 62 | 63 | char bootimagename[8]; | 
| 63 | 64 | bool bootflashflags; | 
|  | 65 | +    void* bootflashdest; | 
| 64 | 66 | bool trymemmapped; | 
| 65 | 67 | void* memmappedaddr; | 
| 66 | 68 | int memmappedsize; | 
| 67 | 69 | bool memmappedflags; | 
|  | 70 | +    void* memmappeddest; | 
| 68 | 71 | }; | 
| 69 | 72 |  | 
| 70 | 73 |  | 
| — | — | @@ -71,7 +74,6 @@ | 
| 72 | 75 | static const char initthreadname[] INITCONST_ATTR = "Initialization thread"; | 
| 73 | 76 | static uint32_t initstack[0x400] INITSTACK_ATTR; | 
| 74 | 77 | extern int _loadspaceend; | 
| 75 |  | -extern int _initstart;
 | 
| 76 | 78 | struct bootinfo_t bootinfo_src INITHEAD_ATTR = | 
| 77 | 79 | { | 
| 78 | 80 | .signature = "emBIboot", | 
| — | — | @@ -96,10 +98,11 @@ | 
| 97 | 99 | { | 
| 98 | 100 | void* addr = (void*)((((uint32_t)&_loadspaceend) - size) & ~(CACHEALIGN_SIZE - 1)); | 
| 99 | 101 | if (read(fd, addr, size) != size) goto dataflashfailed; | 
| 100 |  | -            if (ucl_decompress(addr, size, &_initstart, (uint32_t*)&size)) goto dataflashfailed;
 | 
|  | 102 | +            if (ucl_decompress(addr, size, bootinfo.dataflashdest, (uint32_t*)&size)) | 
|  | 103 | +                goto dataflashfailed; | 
| 101 | 104 | } | 
| 102 |  | -        else if (read(fd, &_initstart, size) != size) goto dataflashfailed;
 | 
| 103 |  | -        if (execimage(&_initstart) >= 0) return;
 | 
|  | 105 | +        else if (read(fd, bootinfo.dataflashdest, size) != size) goto dataflashfailed; | 
|  | 106 | +        if (execimage(bootinfo.dataflashdest) >= 0) return; | 
| 104 | 107 | } | 
| 105 | 108 | dataflashfailed: | 
| 106 | 109 | #endif | 
| — | — | @@ -113,13 +116,14 @@ | 
| 114 | 117 | if (!addr) goto bootflashfailed; | 
| 115 | 118 | if (bootinfo.bootflashflags & 1) | 
| 116 | 119 | { | 
| 117 |  | -            if (ucl_decompress(addr, size, &_initstart, (uint32_t*)&size)) goto bootflashfailed;
 | 
| 118 |  | -            if (execimage(&_initstart) >= 0) return;
 | 
|  | 120 | +            if (ucl_decompress(addr, size, bootinfo.bootflashdest, (uint32_t*)&size)) | 
|  | 121 | +                goto bootflashfailed; | 
|  | 122 | +            if (execimage(bootinfo.bootflashdest) >= 0) return; | 
| 119 | 123 | } | 
| 120 | 124 | else if (bootinfo.bootflashflags & 2) | 
| 121 | 125 | { | 
| 122 |  | -            memcpy(&_initstart, addr, size);
 | 
| 123 |  | -            if (execimage(&_initstart) >= 0) return;
 | 
|  | 126 | +            memcpy(bootinfo.bootflashdest, addr, size); | 
|  | 127 | +            if (execimage(bootinfo.bootflashdest) >= 0) return; | 
| 124 | 128 | } | 
| 125 | 129 | else if (execimage(addr) >= 0) return; | 
| 126 | 130 | #else | 
| — | — | @@ -128,11 +132,12 @@ | 
| 129 | 133 | void* addr = (void*)((((uint32_t)&_loadspaceend) - size) & ~(CACHEALIGN_SIZE - 1)); | 
| 130 | 134 | if (bootflash_read(bootinfo.bootimagename, addr, 0, size) != size) | 
| 131 | 135 | goto bootflashfailed; | 
| 132 |  | -            if (ucl_decompress(addr, size, &_initstart, (uint32_t*)&size)) goto bootflashfailed;
 | 
|  | 136 | +            if (ucl_decompress(addr, size, bootinfo.bootflashdest, (uint32_t*)&size)) | 
|  | 137 | +                goto bootflashfailed; | 
| 133 | 138 | } | 
| 134 |  | -        else if (bootflash_read(bootinfo.bootimagename, &_initstart, 0, size) != size)
 | 
|  | 139 | +        else if (bootflash_read(bootinfo.bootimagename, bootinfo.bootflashdest, 0, size) != size) | 
| 135 | 140 | goto bootflashfailed; | 
| 136 |  | -        if (execimage(&_initstart) >= 0) return;
 | 
|  | 141 | +        if (execimage(bootinfo.bootflashdest) >= 0) return; | 
| 137 | 142 | #endif | 
| 138 | 143 | } | 
| 139 | 144 | bootflashfailed: | 
| — | — | @@ -142,14 +147,15 @@ | 
| 143 | 148 | int size = bootinfo.memmappedsize; | 
| 144 | 149 | if (bootinfo.memmappedflags & 1) | 
| 145 | 150 | { | 
| 146 |  | -            if (ucl_decompress(bootinfo.memmappedaddr, size, &_initstart, (uint32_t*)&size))
 | 
|  | 151 | +            if (ucl_decompress(bootinfo.memmappedaddr, size, | 
|  | 152 | +                               bootinfo.memmappeddest, (uint32_t*)&size)) | 
| 147 | 153 | goto memmappedfailed; | 
| 148 |  | -            if (execimage(&_initstart) >= 0) return;
 | 
|  | 154 | +            if (execimage(bootinfo.memmappeddest) >= 0) return; | 
| 149 | 155 | } | 
| 150 | 156 | else if (bootinfo.memmappedflags & 2) | 
| 151 | 157 | { | 
| 152 |  | -            memcpy(&_initstart, bootinfo.memmappedaddr, size);
 | 
| 153 |  | -            if (execimage(&_initstart) >= 0) return;
 | 
|  | 158 | +            memcpy(bootinfo.memmappeddest, bootinfo.memmappedaddr, size); | 
|  | 159 | +            if (execimage(bootinfo.memmappeddest) >= 0) return; | 
| 154 | 160 | } | 
| 155 | 161 | else if (execimage(bootinfo.memmappedaddr) >= 0) return; | 
| 156 | 162 | } | 
| Index: embios/trunk/arm/contextswitch.S | 
| — | — | @@ -145,8 +145,15 @@ | 
| 146 | 146 | .global execfirmware | 
| 147 | 147 | .type execfirmware, %function | 
| 148 | 148 | execfirmware: | 
|  | 149 | +	str	r0, [sp,#-4]! | 
|  | 150 | +	bl	clean_dcache | 
|  | 151 | +	ldr	r1, [sp], #4 | 
| 149 | 152 | msr	cpsr_c, #0xd3 | 
| 150 |  | -	bx	r0
 | 
|  | 153 | +	mrc	p15, 0, r0,c1,c0 | 
|  | 154 | +	bic	r0, r0, #1 | 
|  | 155 | +	mcr	p15, 0, r0,c1,c0 | 
|  | 156 | +	mcr	p15, 0, r0,c7,c5 | 
|  | 157 | +	bx	r1 | 
| 151 | 158 | .size execfirmware, .-execfirmware | 
| 152 | 159 |  | 
| 153 | 160 | unknown_swi_string: |