binman: Change the boot and packing (*THIS WILL AFFECT MOST PORTS*)
authorAlan Cox <alan@linux.intel.com>
Thu, 14 May 2015 20:13:05 +0000 (21:13 +0100)
committerAlan Cox <alan@linux.intel.com>
Thu, 14 May 2015 20:13:05 +0000 (21:13 +0100)
We now copy intializer to initialized and then pack common, fonts, discard etc
over data. That has two impacts

- your crt0.s needs to copy from s__DATA now
- your crt0.s ordering needs to put DATA last in the main block

It also saves us about 8K and neatly avoids any issues with overlapping memory
areas. That makes it worth the pain.

Kernel/platform-nc100/crt0.s
Kernel/platform-trs80/crt0.s
Kernel/tools/binman.c

index 4cf8d89..c4f085d 100644 (file)
@@ -8,11 +8,11 @@
                .area _VIDEO
                .area _CONST
                .area _INITIALIZED
-               .area _INITIALIZER
                .area _DATA
                .area _BSEG
                .area _BSS
                .area _HEAP
+               .area _INITIALIZER
                ; note that areas below here may be overwritten by the heap at runtime, so
                ; put initialisation stuff in here
                .area _GSINIT
@@ -50,7 +50,7 @@
 start:         di
                ld sp, #kstack_top
                ; move the common memory where it belongs    
-               ld hl, #s__INITIALIZER
+               ld hl, #s__DATA
                ld de, #s__COMMONMEM
                ld bc, #l__COMMONMEM
                ldir
index 18fab50..dad4312 100644 (file)
@@ -6,14 +6,14 @@
                .area _CODE2
                .area _VIDEO
                .area _CONST
-               .area _DATA
                .area _INITIALIZED
+               .area _DATA
+               .area _INITIALIZER
                .area _BSEG
                .area _BSS
                .area _HEAP
                ; note that areas below here may be overwritten by the heap at runtime, so
                ; put initialisation stuff in here
-               .area _INITIALIZER
                .area _GSINIT
                .area _GSFINAL
                .area _COMMONMEM
@@ -41,7 +41,8 @@
 start:
                ld sp, #kstack_top
                ; move the common memory where it belongs    
-               ld hl, #s__INITIALIZER
+               ld hl, #s__DATA
+               push hl
                ld de, #s__COMMONMEM
                ld bc, #l__COMMONMEM
                ldir
@@ -50,7 +51,7 @@ start:
                ld bc, #l__DISCARD
                ldir
                ; then zero the data area
-               ld hl, #s__DATA
+               pop hl  ; s__DATA
                ld de, #s__DATA + 1
                ld bc, #l__DATA - 1
                ld (hl), #0
index a515818..72de486 100644 (file)
@@ -172,7 +172,7 @@ int main(int argc, char *argv[])
                /* Pack any common memory on the end of the main code/memory if its
                   relocated */
                if (!s__DISCARD || pack_discard) {
-                       base = s__INITIALIZER;
+                       base = s__DATA;
                        tail = l__COMMONMEM;
                        memcpy(out + base, buf + s__COMMONMEM,
                               l__COMMONMEM);
@@ -227,7 +227,7 @@ int main(int argc, char *argv[])
                if (reloc == 0 && end < s__COMMONMEM +  l__COMMONMEM)
                        end = s__COMMONMEM + l__COMMONMEM;
 
-                /* Packed image with common over initializer */
+                /* Packed image with common over data */
                if (!s__DISCARD || pack_discard) {
                        end = base;
                        printf("\nPacked image %d bytes, for RAM target\n",