More work on atari/tos.
This commit is contained in:
+9
-10
@@ -37,7 +37,7 @@
|
|||||||
static const
|
static const
|
||||||
#include "stub/m68k-atari.tos.h"
|
#include "stub/m68k-atari.tos.h"
|
||||||
|
|
||||||
// #define TESTING
|
//#define TESTING 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@@ -549,14 +549,14 @@ void PackTos::pack(OutputFile *fo)
|
|||||||
symbols.loop1.init(o_data / 160);
|
symbols.loop1.init(o_data / 160);
|
||||||
symbols.loop2.init((o_data % 160) / 4);
|
symbols.loop2.init((o_data % 160) / 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
symbols.loop3.init(dirty_bss / dirty_bss_align);
|
symbols.loop3.init(dirty_bss / dirty_bss_align);
|
||||||
|
|
||||||
// now re-build loader
|
// now re-build loader
|
||||||
buildLoader(&ft);
|
buildLoader(&ft);
|
||||||
unsigned new_lsize = getLoaderSize();
|
unsigned new_lsize = getLoaderSize();
|
||||||
|
//printf("buildLoader %d %d\n", new_lsize, initial_lsize);
|
||||||
assert(new_lsize <= initial_lsize);
|
assert(new_lsize <= initial_lsize);
|
||||||
if (new_lsize == last_lsize && memcmp(getLoader(), getLoader(), last_lsize) == 0)
|
if (new_lsize == last_lsize && memcmp(getLoader(), last_loader, last_lsize) == 0)
|
||||||
break;
|
break;
|
||||||
last_lsize = new_lsize;
|
last_lsize = new_lsize;
|
||||||
memcpy(last_loader, getLoader(), last_lsize);
|
memcpy(last_loader, getLoader(), last_lsize);
|
||||||
@@ -580,11 +580,11 @@ void PackTos::pack(OutputFile *fo)
|
|||||||
linker->getSymbolOffset("clear_bss");
|
linker->getSymbolOffset("clear_bss");
|
||||||
linker->defineSymbol("copy_to_stack_len", clear_size / 2 - 1);
|
linker->defineSymbol("copy_to_stack_len", clear_size / 2 - 1);
|
||||||
linker->defineSymbol("clear_bss_size_p4", clear_size + 4);
|
linker->defineSymbol("clear_bss_size_p4", clear_size + 4);
|
||||||
// FIXME
|
// FIXME (we have at least 512 bytes of .bss)
|
||||||
linker->defineSymbol("clear_dirty_stack_len", (128 + 3) / 4 + 32 - 1);
|
unsigned clear_dirty_stack_size = 256;
|
||||||
|
linker->defineSymbol("clear_dirty_stack_len", (clear_dirty_stack_size + 3) / 4 - 1);
|
||||||
|
|
||||||
linker->relocate();
|
linker->relocate();
|
||||||
//linker->dumpSymbols();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// write
|
// write
|
||||||
@@ -614,12 +614,11 @@ void PackTos::pack(OutputFile *fo)
|
|||||||
#if 0 || defined(TESTING)
|
#if 0 || defined(TESTING)
|
||||||
printf("old text: %6d, data: %6d, bss: %6d, reloc: %d, overlay: %d\n",
|
printf("old text: %6d, data: %6d, bss: %6d, reloc: %d, overlay: %d\n",
|
||||||
i_text, i_data, i_bss, relocsize, overlay);
|
i_text, i_data, i_bss, relocsize, overlay);
|
||||||
printf("new text: %6d, data: %6d, bss: %6d, dirty_bss: %d, flag=0x%x\n",
|
printf("new text: %6d, data: %6d, bss: %6d, flag=0x%x\n",
|
||||||
o_text, o_data, o_bss, dirty_bss, (int)oh.fh_flag);
|
o_text, o_data, o_bss, (int)oh.fh_flag);
|
||||||
|
linker->dumpSymbols();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
linker->relocate();
|
|
||||||
|
|
||||||
// prepare loader
|
// prepare loader
|
||||||
MemBuffer loader(o_text);
|
MemBuffer loader(o_text);
|
||||||
memcpy(loader, getLoader(), o_text);
|
memcpy(loader, getLoader(), o_text);
|
||||||
|
|||||||
+1282
-1185
File diff suppressed because it is too large
Load Diff
@@ -32,9 +32,7 @@ lzma_d_c%.S : tc_bfdname = elf32-m68k
|
|||||||
|
|
||||||
c := tc.method-lzma.gcc
|
c := tc.method-lzma.gcc
|
||||||
$c = $(tc.m68k-atari.tos.gcc)
|
$c = $(tc.m68k-atari.tos.gcc)
|
||||||
# FIXME / TODO: we still generate references to __mulsi3
|
$c += -fpic -mpcrel
|
||||||
##$c += -m68020
|
|
||||||
##$c += -mshort -D_LZMA_UINT32_IS_ULONG
|
|
||||||
$c += -Os -fomit-frame-pointer
|
$c += -Os -fomit-frame-pointer
|
||||||
$c += -fno-unit-at-a-time
|
$c += -fno-unit-at-a-time
|
||||||
$c += -ffunction-sections
|
$c += -ffunction-sections
|
||||||
@@ -43,12 +41,16 @@ $c += -I$(UPX_LZMADIR)
|
|||||||
$c += -I$(top_srcdir)/src
|
$c += -I$(top_srcdir)/src
|
||||||
|
|
||||||
lzma_d_c%.S : lzma_d_c.c
|
lzma_d_c%.S : lzma_d_c.c
|
||||||
$(call tc,gcc) $(PP_FLAGS) -c $< -o tmp/$T.o
|
$(call tc,gcc) $(PP_FLAGS) -S $< -o tmp/$T.s
|
||||||
|
cat tmp/$T.s | $(RTRIM) | $(SQUEEZE) | sed -e '/^$$/d' -e '1,/LzmaDecode:/d' -e '/\.size/d' -e '/\.ident/d' -e '/\.section/d' -e 's/\.L/$(LABEL_PREFIX)/g' -e '/^[ \t]rts.*/d' -e 's/bsr\.l/bsr.w/' tmp/$T.s | $(RTRIM) > $@
|
||||||
|
# the following stuff is for debugging only
|
||||||
|
$(call tc,gcc) -c -MF /dev/null $@ -o tmp/$T.o
|
||||||
$(call tc,f-objstrip,tmp/$T.o)
|
$(call tc,f-objstrip,tmp/$T.o)
|
||||||
$(call tc,objcopy) -O binary --only-section .text.LzmaDecode tmp/$T.o tmp/$T.bin
|
$(call tc,objcopy) -O binary tmp/$T.o tmp/$T.bin
|
||||||
head -c-2 tmp/$T.bin > tmp/$T.out
|
head -c-0 tmp/$T.bin > tmp/$T.out
|
||||||
$(call tc,objdump) -b binary -m m68k -D tmp/$T.out | $(RTRIM) > tmp/$T.out.disasm
|
$(call tc,objdump) -b binary -m m68k -D tmp/$T.out | $(RTRIM) > tmp/$T.out.disasm
|
||||||
$(call tc,bin2h) --mode=gas tmp/$T.out $@
|
|
||||||
|
|
||||||
lzma_d_cf.% : PP_FLAGS = -DFAST
|
lzma_d_cf.% : PP_FLAGS = -DFAST
|
||||||
lzma_d_cs.% : PP_FLAGS = -DSMALL
|
lzma_d_cs.% : PP_FLAGS = -DSMALL
|
||||||
|
lzma_d_cf.% : LABEL_PREFIX = .Lf
|
||||||
|
lzma_d_cs.% : LABEL_PREFIX = .Ls
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -533,42 +533,6 @@ section lzma.small
|
|||||||
// note: d3.l is 0 from decompressor above
|
// note: d3.l is 0 from decompressor above
|
||||||
|
|
||||||
|
|
||||||
// ------------- support
|
|
||||||
|
|
||||||
section __mulsi3
|
|
||||||
#if 0
|
|
||||||
// compute high-word
|
|
||||||
move.w 4(sp),d1 // 12
|
|
||||||
move.w 6(sp),d0 // 12
|
|
||||||
mulu.w 8(sp),d0 // 78
|
|
||||||
mulu.w 10(sp),d1 // 78
|
|
||||||
add.w d1,d0 // 4
|
|
||||||
swap d0 // 4
|
|
||||||
clr.w d0 // 4
|
|
||||||
// add low-word
|
|
||||||
move.w 6(sp),d1 // 12
|
|
||||||
mulu.w 10(sp),d1 // 78
|
|
||||||
add.l d1,d0 // 6
|
|
||||||
rts // 16
|
|
||||||
#else
|
|
||||||
// smaller and faster
|
|
||||||
// compute high-word
|
|
||||||
lea 4(sp),a0 // 8
|
|
||||||
move.w (a0)+,d1 // 8
|
|
||||||
move.w (a0)+,d0 // 8
|
|
||||||
mulu.w (a0)+,d0 // 74
|
|
||||||
mulu.w (a0),d1 // 74
|
|
||||||
add.w d1,d0 // 4
|
|
||||||
swap d0 // 4
|
|
||||||
clr.w d0 // 4
|
|
||||||
// add low-word
|
|
||||||
move.w 6(sp),d1 // 12
|
|
||||||
mulu.w (a0),d1 // 74
|
|
||||||
add.l d1,d0 // 6
|
|
||||||
rts // 16
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// ------------- reloc
|
// ------------- reloc
|
||||||
|
|
||||||
section reloc
|
section reloc
|
||||||
@@ -614,15 +578,50 @@ section jmpstack
|
|||||||
jmp (ASTACK) // jmp clear_bss (on stack)
|
jmp (ASTACK) // jmp clear_bss (on stack)
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
// support
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
section __mulsi3
|
||||||
|
#if 0
|
||||||
|
// compute high-word
|
||||||
|
move.w 4(sp),d1 // 12
|
||||||
|
move.w 6(sp),d0 // 12
|
||||||
|
mulu.w 8(sp),d0 // 78
|
||||||
|
mulu.w 10(sp),d1 // 78
|
||||||
|
add.w d1,d0 // 4
|
||||||
|
swap d0 // 4
|
||||||
|
clr.w d0 // 4
|
||||||
|
// add low-word
|
||||||
|
move.w 6(sp),d1 // 12
|
||||||
|
mulu.w 10(sp),d1 // 78
|
||||||
|
add.l d1,d0 // 6
|
||||||
|
rts // 16
|
||||||
|
#else
|
||||||
|
// smaller and faster
|
||||||
|
// compute high-word
|
||||||
|
lea 4(sp),a0 // 8
|
||||||
|
move.w (a0)+,d1 // 8
|
||||||
|
move.w (a0)+,d0 // 8
|
||||||
|
mulu.w (a0)+,d0 // 74
|
||||||
|
mulu.w (a0),d1 // 74
|
||||||
|
add.w d1,d0 // 4
|
||||||
|
swap d0 // 4
|
||||||
|
clr.w d0 // 4
|
||||||
|
// add low-word
|
||||||
|
move.w 6(sp),d1 // 12
|
||||||
|
mulu.w (a0),d1 // 74
|
||||||
|
add.l d1,d0 // 6
|
||||||
|
rts // 16
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// absolute symbols ("*ABS*")
|
// absolute symbols ("*ABS*")
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
section abs_symbols
|
section abs_symbols
|
||||||
|
|
||||||
//.globl copy_to_stack_len
|
|
||||||
//copy_to_stack_len = (clear_bss_end-clear_bss)/2-1
|
|
||||||
|
|
||||||
.globl flush_cache_rts_offset
|
.globl flush_cache_rts_offset
|
||||||
flush_cache_rts_offset = flush_cache_rts - flush_cache
|
flush_cache_rts_offset = flush_cache_rts - flush_cache
|
||||||
|
|
||||||
|
|||||||
@@ -38,19 +38,20 @@ Idx Name Size VMA LMA File off Algn Flags
|
|||||||
33 nrv2b_8.small 00000076 00000000 00000000 00000366 2**0 CONTENTS, READONLY
|
33 nrv2b_8.small 00000076 00000000 00000000 00000366 2**0 CONTENTS, READONLY
|
||||||
34 nrv2d_8.small 0000008a 00000000 00000000 000003dc 2**0 CONTENTS, READONLY
|
34 nrv2d_8.small 0000008a 00000000 00000000 000003dc 2**0 CONTENTS, READONLY
|
||||||
35 nrv2e_8.small 00000092 00000000 00000000 00000466 2**0 CONTENTS, READONLY
|
35 nrv2e_8.small 00000092 00000000 00000000 00000466 2**0 CONTENTS, READONLY
|
||||||
36 lzma.fast 000008ac 00000000 00000000 000004f8 2**0 CONTENTS, READONLY
|
36 lzma.fast 000008cc 00000000 00000000 000004f8 2**0 CONTENTS, RELOC, READONLY
|
||||||
37 lzma.small 000008ac 00000000 00000000 00000da4 2**0 CONTENTS, READONLY
|
37 lzma.small 000008cc 00000000 00000000 00000dc4 2**0 CONTENTS, RELOC, READONLY
|
||||||
38 __mulsi3 0000001c 00000000 00000000 00001650 2**0 CONTENTS, READONLY
|
38 reloc 0000001a 00000000 00000000 00001690 2**0 CONTENTS, READONLY
|
||||||
39 reloc 0000001a 00000000 00000000 0000166c 2**0 CONTENTS, READONLY
|
39 loop3_set_count.b 00000002 00000000 00000000 000016aa 2**0 CONTENTS, RELOC, READONLY
|
||||||
40 loop3_set_count.b 00000002 00000000 00000000 00001686 2**0 CONTENTS, RELOC, READONLY
|
40 loop3_set_count.w 00000004 00000000 00000000 000016ac 2**0 CONTENTS, RELOC, READONLY
|
||||||
41 loop3_set_count.w 00000004 00000000 00000000 00001688 2**0 CONTENTS, RELOC, READONLY
|
41 loop3_set_count.l 00000006 00000000 00000000 000016b0 2**0 CONTENTS, RELOC, READONLY
|
||||||
42 loop3_set_count.l 00000006 00000000 00000000 0000168c 2**0 CONTENTS, RELOC, READONLY
|
42 jmpstack 00000002 00000000 00000000 000016b6 2**0 CONTENTS, READONLY
|
||||||
43 jmpstack 00000002 00000000 00000000 00001692 2**0 CONTENTS, READONLY
|
43 __mulsi3 0000001c 00000000 00000000 000016b8 2**0 CONTENTS, READONLY
|
||||||
44 abs_symbols 00000000 00000000 00000000 00001694 2**0 CONTENTS, READONLY
|
44 abs_symbols 00000000 00000000 00000000 000016d4 2**0 CONTENTS, READONLY
|
||||||
SYMBOL TABLE:
|
SYMBOL TABLE:
|
||||||
00000000 l d loop1_label 00000000 loop1_label
|
00000000 l d loop1_label 00000000 loop1_label
|
||||||
00000000 l d flush_cache 00000000 flush_cache
|
00000000 l d flush_cache 00000000 flush_cache
|
||||||
00000000 l d loop3_label 00000000 loop3_label
|
00000000 l d loop3_label 00000000 loop3_label
|
||||||
|
00000000 l d __mulsi3 00000000 __mulsi3
|
||||||
00000000 l d entry 00000000 entry
|
00000000 l d entry 00000000 entry
|
||||||
00000000 l d loop1_set_count.b 00000000 loop1_set_count.b
|
00000000 l d loop1_set_count.b 00000000 loop1_set_count.b
|
||||||
00000000 l d loop1_set_count.w 00000000 loop1_set_count.w
|
00000000 l d loop1_set_count.w 00000000 loop1_set_count.w
|
||||||
@@ -86,7 +87,6 @@ SYMBOL TABLE:
|
|||||||
00000000 l d nrv2e_8.small 00000000 nrv2e_8.small
|
00000000 l d nrv2e_8.small 00000000 nrv2e_8.small
|
||||||
00000000 l d lzma.fast 00000000 lzma.fast
|
00000000 l d lzma.fast 00000000 lzma.fast
|
||||||
00000000 l d lzma.small 00000000 lzma.small
|
00000000 l d lzma.small 00000000 lzma.small
|
||||||
00000000 l d __mulsi3 00000000 __mulsi3
|
|
||||||
00000000 l d reloc 00000000 reloc
|
00000000 l d reloc 00000000 reloc
|
||||||
00000000 l d loop3_set_count.b 00000000 loop3_set_count.b
|
00000000 l d loop3_set_count.b 00000000 loop3_set_count.b
|
||||||
00000000 l d loop3_set_count.w 00000000 loop3_set_count.w
|
00000000 l d loop3_set_count.w 00000000 loop3_set_count.w
|
||||||
@@ -176,6 +176,38 @@ OFFSET TYPE VALUE
|
|||||||
00000002 R_68K_16 clear_bss_size_p4
|
00000002 R_68K_16 clear_bss_size_p4
|
||||||
00000005 R_68K_8 clear_dirty_stack_len
|
00000005 R_68K_8 clear_dirty_stack_len
|
||||||
|
|
||||||
|
RELOCATION RECORDS FOR [lzma.fast]:
|
||||||
|
OFFSET TYPE VALUE
|
||||||
|
00000108 R_68K_PC16 __mulsi3
|
||||||
|
000001ca R_68K_PC16 __mulsi3
|
||||||
|
00000242 R_68K_PC16 __mulsi3
|
||||||
|
000002fe R_68K_PC16 __mulsi3
|
||||||
|
00000382 R_68K_PC16 __mulsi3
|
||||||
|
000003de R_68K_PC16 __mulsi3
|
||||||
|
00000482 R_68K_PC16 __mulsi3
|
||||||
|
000004da R_68K_PC16 __mulsi3
|
||||||
|
00000578 R_68K_PC16 __mulsi3
|
||||||
|
000005e0 R_68K_PC16 __mulsi3
|
||||||
|
0000066c R_68K_PC16 __mulsi3
|
||||||
|
00000708 R_68K_PC16 __mulsi3
|
||||||
|
000007f8 R_68K_PC16 __mulsi3
|
||||||
|
|
||||||
|
RELOCATION RECORDS FOR [lzma.small]:
|
||||||
|
OFFSET TYPE VALUE
|
||||||
|
00000108 R_68K_PC16 __mulsi3
|
||||||
|
000001ca R_68K_PC16 __mulsi3
|
||||||
|
00000242 R_68K_PC16 __mulsi3
|
||||||
|
000002fe R_68K_PC16 __mulsi3
|
||||||
|
00000382 R_68K_PC16 __mulsi3
|
||||||
|
000003de R_68K_PC16 __mulsi3
|
||||||
|
00000482 R_68K_PC16 __mulsi3
|
||||||
|
000004da R_68K_PC16 __mulsi3
|
||||||
|
00000578 R_68K_PC16 __mulsi3
|
||||||
|
000005e0 R_68K_PC16 __mulsi3
|
||||||
|
0000066c R_68K_PC16 __mulsi3
|
||||||
|
00000708 R_68K_PC16 __mulsi3
|
||||||
|
000007f8 R_68K_PC16 __mulsi3
|
||||||
|
|
||||||
RELOCATION RECORDS FOR [loop3_set_count.b]:
|
RELOCATION RECORDS FOR [loop3_set_count.b]:
|
||||||
OFFSET TYPE VALUE
|
OFFSET TYPE VALUE
|
||||||
00000001 R_68K_8 loop3_count
|
00000001 R_68K_8 loop3_count
|
||||||
|
|||||||
Reference in New Issue
Block a user