From: Alan Cox Date: Thu, 14 May 2015 20:13:05 +0000 (+0100) Subject: binman: Change the boot and packing (*THIS WILL AFFECT MOST PORTS*) X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=cf2b7ef28db394406b81df986aa5dfd700afc2e0;p=FUZIX.git binman: Change the boot and packing (*THIS WILL AFFECT MOST PORTS*) 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. --- diff --git a/Kernel/platform-nc100/crt0.s b/Kernel/platform-nc100/crt0.s index 4cf8d893..c4f085da 100644 --- a/Kernel/platform-nc100/crt0.s +++ b/Kernel/platform-nc100/crt0.s @@ -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 diff --git a/Kernel/platform-trs80/crt0.s b/Kernel/platform-trs80/crt0.s index 18fab50f..dad4312a 100644 --- a/Kernel/platform-trs80/crt0.s +++ b/Kernel/platform-trs80/crt0.s @@ -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 diff --git a/Kernel/tools/binman.c b/Kernel/tools/binman.c index a5158183..72de486d 100644 --- a/Kernel/tools/binman.c +++ b/Kernel/tools/binman.c @@ -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",