Implemented some small atari/tos optimizations.

This commit is contained in:
Markus F.X.J. Oberhumer
2006-11-17 18:47:33 +01:00
parent 5d95275024
commit 8146e9cbcd
5 changed files with 1796 additions and 1515 deletions
+1584 -1420
View File
File diff suppressed because it is too large Load Diff
+37 -20
View File
@@ -198,8 +198,8 @@ section entry
beqs 1f
move.l 4(a0),sp // accessory - get stack
bras 2f
1: move.l 4(sp),d0 // application - get basepage
2: movem.l d1-d7/a0-a6,-(sp)
@@ -207,26 +207,35 @@ section entry
// we also setup d4 and a6 here, and we prepare a4
move.l d0,a2 // a2 = basepage
addq.l #8,a2
move.l (a2)+,a6
move.l a6,d4 // d4 = p_tbase
move.l #up11,(a2) // p_tlen
add.l (a2)+,a6
move.l a6,(a2)+ // p_dbase
move.l #up12,(a2) // p_dlen
add.l (a2)+,a6 // a6 = decompressed p_bbase
move.l (a2),a4 // a4 = compressed p_bbase
move.l a6,(a2)+ // p_bbase
move.l #up13,(a2) // p_blen
move.l d0,a0 // a0 = basepage
addq.l #8,a0
move.l (a0)+,a6 // p_tbase
move.l a6,d4 // d4 = p_tbase
move.l #orig_p_tlen,(a0)
add.l (a0)+,a6
move.l a6,(a0)+ // p_dbase
move.l #orig_p_dlen,(a0)
add.l (a0)+,a6 // a6 = decompressed p_bbase
move.l (a0),a4 // a4 = compressed p_bbase
move.l a6,(a0)+ // p_bbase
move.l #orig_p_blen,(a0)
// a4 == d4 + compressed_p_tlen + compressed_p_dlen
// a6 == d4 + orig_p_tlen + orig_p_dlen
// ------------- copy data segment (from a4 to a3, downwards)
// a4 (top of compressed data) already initialized above
section set_up21_a6.w
lea.l up21_a6:w(a6),a3 // top of data segment + offset
section set_up21_d4.w
move.l d4,a3
add.l #up21,a3 // top of data segment + offset
add.w #up21_d4,a3 // top of data segment + offset
section set_up21_d4.l
move.l d4,a3
add.l #up21_d4,a3 // top of data segment + offset
// number of loops
@@ -285,12 +294,12 @@ section copy_to_stack
// Copy the final startup code below the stack. This will get
// called via "jmp (ASTACK)" after decompression and relocation.
lea.l clear_bss_end:w(pc),a2
lea.l clear_bss_end:w(pc),a0
move.l d4,-(ASTACK) // entry point for final jmp
//moveq.l #((clear_bss_end-clear_bss)/2-1),d5
moveq.l #copy_to_stack_len,d5
1: move.w -(a2),-(ASTACK)
1: move.w -(a0),-(ASTACK)
subq.l #1,d5
bccs 1b
@@ -339,9 +348,17 @@ section nrv2e.init
// ------------- jump to copied decompressor
section jmp_decompressor
section jmp_decompressor_a6.w
jmp up31_a6:w(a6) // jmp decompr_start
section jmp_decompressor_d4.w
move.l d4,a0
add.l #up31,a0
jmp up31_d4:w(a0) // jmp decompr_start
section jmp_decompressor_a6.w2
lea.l 32767(a6),a0
jmp up31_a6:w(a0) // jmp decompr_start
section jmp_decompressor_d4.l
move.l d4,a0
add.l #up31_d4,a0
jmp (a0) // jmp decompr_start
@@ -559,7 +576,7 @@ section loop3_set_count.l
move.l #loop3_count,d6
section jmpstack
section jmp_stack
// We are currently running in the dirty bss.
// Jump to the code we copied below the stack.
@@ -633,5 +650,5 @@ N(lzma,small)
#endif
// vi:ts=8:et:nowrap
// vi:ts=4:et:nowrap
+95 -58
View File
@@ -2,57 +2,66 @@ tmp/m68k-atari.tos.bin: file format elf32-m68k
Sections:
Idx Name Size VMA LMA File off Algn Flags
0 entry 0000003e 00000000 00000000 00000034 2**0 CONTENTS, RELOC, READONLY
1 loop1_set_count.b 00000002 00000000 00000000 00000072 2**0 CONTENTS, RELOC, READONLY
2 loop1_set_count.w 00000004 00000000 00000000 00000074 2**0 CONTENTS, RELOC, READONLY
3 loop1_set_count.l 00000006 00000000 00000000 00000078 2**0 CONTENTS, RELOC, READONLY
4 loop1_label 00000000 00000000 00000000 0000007e 2**0 CONTENTS, READONLY
5 loop1.fast 0000002a 00000000 00000000 0000007e 2**0 CONTENTS, READONLY
6 loop1.small 00000002 00000000 00000000 000000a8 2**0 CONTENTS, READONLY
7 loop1_subql 00000004 00000000 00000000 000000aa 2**0 CONTENTS, RELOC, READONLY
8 loop1_subqw 00000004 00000000 00000000 000000ae 2**0 CONTENTS, RELOC, READONLY
9 loop1_dbra 00000004 00000000 00000000 000000b2 2**0 CONTENTS, RELOC, READONLY
10 loop2.fast 00000008 00000000 00000000 000000b6 2**0 CONTENTS, RELOC, READONLY
11 loop2.small 00000000 00000000 00000000 000000be 2**0 CONTENTS, READONLY
12 copy_to_stack 00000016 00000000 00000000 000000be 2**0 CONTENTS, RELOC, READONLY
13 nrv2b.init 0000000a 00000000 00000000 000000d4 2**0 CONTENTS, READONLY
14 nrv2d.init 0000000a 00000000 00000000 000000de 2**0 CONTENTS, READONLY
15 nrv2e.init 0000000a 00000000 00000000 000000e8 2**0 CONTENTS, READONLY
16 jmp_decompressor 0000000a 00000000 00000000 000000f2 2**0 CONTENTS, RELOC, READONLY
17 clear_bss 00000000 00000000 00000000 000000fc 2**0 CONTENTS, READONLY
18 loop3_label 00000000 00000000 00000000 000000fc 2**0 CONTENTS, READONLY
19 loop3.small 00000002 00000000 00000000 000000fc 2**0 CONTENTS, READONLY
20 loop3.fast 00000008 00000000 00000000 000000fe 2**0 CONTENTS, READONLY
21 loop3_subql 00000004 00000000 00000000 00000106 2**0 CONTENTS, RELOC, READONLY
22 loop3_subqw 00000004 00000000 00000000 0000010a 2**0 CONTENTS, RELOC, READONLY
23 loop3_dbra 00000004 00000000 00000000 0000010e 2**0 CONTENTS, RELOC, READONLY
24 flush_cache 00000078 00000000 00000000 00000112 2**0 CONTENTS, READONLY
25 clear_dirty_stack 00000010 00000000 00000000 0000018a 2**0 CONTENTS, RELOC, READONLY
26 start_program 0000000c 00000000 00000000 0000019a 2**0 CONTENTS, READONLY
27 UPX1HEAD 00000020 00000000 00000000 000001a6 2**0 CONTENTS, READONLY
28 CUTPOINT 00000000 00000000 00000000 000001c6 2**0 CONTENTS, READONLY
29 nrv2b_8.fast 0000007c 00000000 00000000 000001c6 2**0 CONTENTS, READONLY
30 nrv2d_8.fast 00000090 00000000 00000000 00000242 2**0 CONTENTS, READONLY
31 nrv2e_8.fast 00000098 00000000 00000000 000002d2 2**0 CONTENTS, READONLY
32 nrv2b_8.small 00000076 00000000 00000000 0000036a 2**0 CONTENTS, READONLY
33 nrv2d_8.small 0000008a 00000000 00000000 000003e0 2**0 CONTENTS, READONLY
34 nrv2e_8.small 00000092 00000000 00000000 0000046a 2**0 CONTENTS, READONLY
35 lzma.init 0000002e 00000000 00000000 000004fc 2**0 CONTENTS, RELOC, READONLY
36 lzma.fast 000008ca 00000000 00000000 0000052a 2**0 CONTENTS, RELOC, READONLY
37 lzma.small 000008ca 00000000 00000000 00000df4 2**0 CONTENTS, RELOC, READONLY
38 lzma.finish 00000012 00000000 00000000 000016be 2**0 CONTENTS, READONLY
39 reloc 0000001a 00000000 00000000 000016d0 2**0 CONTENTS, READONLY
40 loop3_set_count.b 00000002 00000000 00000000 000016ea 2**0 CONTENTS, RELOC, READONLY
41 loop3_set_count.w 00000004 00000000 00000000 000016ec 2**0 CONTENTS, RELOC, READONLY
42 loop3_set_count.l 00000006 00000000 00000000 000016f0 2**0 CONTENTS, RELOC, READONLY
43 jmpstack 00000002 00000000 00000000 000016f6 2**0 CONTENTS, READONLY
44 __mulsi3 0000001c 00000000 00000000 000016f8 2**0 CONTENTS, READONLY
0 entry 00000036 00000000 00000000 00000034 2**0 CONTENTS, RELOC, READONLY
1 set_up21_a6.w 00000004 00000000 00000000 0000006a 2**0 CONTENTS, RELOC, READONLY
2 set_up21_d4.w 00000006 00000000 00000000 0000006e 2**0 CONTENTS, RELOC, READONLY
3 set_up21_d4.l 00000008 00000000 00000000 00000074 2**0 CONTENTS, RELOC, READONLY
4 loop1_set_count.b 00000002 00000000 00000000 0000007c 2**0 CONTENTS, RELOC, READONLY
5 loop1_set_count.w 00000004 00000000 00000000 0000007e 2**0 CONTENTS, RELOC, READONLY
6 loop1_set_count.l 00000006 00000000 00000000 00000082 2**0 CONTENTS, RELOC, READONLY
7 loop1_label 00000000 00000000 00000000 00000088 2**0 CONTENTS, READONLY
8 loop1.fast 0000002a 00000000 00000000 00000088 2**0 CONTENTS, READONLY
9 loop1.small 00000002 00000000 00000000 000000b2 2**0 CONTENTS, READONLY
10 loop1_subql 00000004 00000000 00000000 000000b4 2**0 CONTENTS, RELOC, READONLY
11 loop1_subqw 00000004 00000000 00000000 000000b8 2**0 CONTENTS, RELOC, READONLY
12 loop1_dbra 00000004 00000000 00000000 000000bc 2**0 CONTENTS, RELOC, READONLY
13 loop2.fast 00000008 00000000 00000000 000000c0 2**0 CONTENTS, RELOC, READONLY
14 loop2.small 00000000 00000000 00000000 000000c8 2**0 CONTENTS, READONLY
15 copy_to_stack 00000016 00000000 00000000 000000c8 2**0 CONTENTS, RELOC, READONLY
16 nrv2b.init 0000000a 00000000 00000000 000000de 2**0 CONTENTS, READONLY
17 nrv2d.init 0000000a 00000000 00000000 000000e8 2**0 CONTENTS, READONLY
18 nrv2e.init 0000000a 00000000 00000000 000000f2 2**0 CONTENTS, READONLY
19 jmp_decompressor_a6.w 00000004 00000000 00000000 000000fc 2**0 CONTENTS, RELOC, READONLY
20 jmp_decompressor_d4.w 00000006 00000000 00000000 00000100 2**0 CONTENTS, RELOC, READONLY
21 jmp_decompressor_a6.w2 00000008 00000000 00000000 00000106 2**0 CONTENTS, RELOC, READONLY
22 jmp_decompressor_d4.l 0000000a 00000000 00000000 0000010e 2**0 CONTENTS, RELOC, READONLY
23 clear_bss 00000000 00000000 00000000 00000118 2**0 CONTENTS, READONLY
24 loop3_label 00000000 00000000 00000000 00000118 2**0 CONTENTS, READONLY
25 loop3.small 00000002 00000000 00000000 00000118 2**0 CONTENTS, READONLY
26 loop3.fast 00000008 00000000 00000000 0000011a 2**0 CONTENTS, READONLY
27 loop3_subql 00000004 00000000 00000000 00000122 2**0 CONTENTS, RELOC, READONLY
28 loop3_subqw 00000004 00000000 00000000 00000126 2**0 CONTENTS, RELOC, READONLY
29 loop3_dbra 00000004 00000000 00000000 0000012a 2**0 CONTENTS, RELOC, READONLY
30 flush_cache 00000078 00000000 00000000 0000012e 2**0 CONTENTS, READONLY
31 clear_dirty_stack 00000010 00000000 00000000 000001a6 2**0 CONTENTS, RELOC, READONLY
32 start_program 0000000c 00000000 00000000 000001b6 2**0 CONTENTS, READONLY
33 UPX1HEAD 00000020 00000000 00000000 000001c2 2**0 CONTENTS, READONLY
34 CUTPOINT 00000000 00000000 00000000 000001e2 2**0 CONTENTS, READONLY
35 nrv2b_8.fast 0000007c 00000000 00000000 000001e2 2**0 CONTENTS, READONLY
36 nrv2d_8.fast 00000090 00000000 00000000 0000025e 2**0 CONTENTS, READONLY
37 nrv2e_8.fast 00000098 00000000 00000000 000002ee 2**0 CONTENTS, READONLY
38 nrv2b_8.small 00000076 00000000 00000000 00000386 2**0 CONTENTS, READONLY
39 nrv2d_8.small 0000008a 00000000 00000000 000003fc 2**0 CONTENTS, READONLY
40 nrv2e_8.small 00000092 00000000 00000000 00000486 2**0 CONTENTS, READONLY
41 lzma.init 0000002e 00000000 00000000 00000518 2**0 CONTENTS, RELOC, READONLY
42 lzma.fast 000008ca 00000000 00000000 00000546 2**0 CONTENTS, RELOC, READONLY
43 lzma.small 000008ca 00000000 00000000 00000e10 2**0 CONTENTS, RELOC, READONLY
44 lzma.finish 00000012 00000000 00000000 000016da 2**0 CONTENTS, READONLY
45 reloc 0000001a 00000000 00000000 000016ec 2**0 CONTENTS, READONLY
46 loop3_set_count.b 00000002 00000000 00000000 00001706 2**0 CONTENTS, RELOC, READONLY
47 loop3_set_count.w 00000004 00000000 00000000 00001708 2**0 CONTENTS, RELOC, READONLY
48 loop3_set_count.l 00000006 00000000 00000000 0000170c 2**0 CONTENTS, RELOC, READONLY
49 jmp_stack 00000002 00000000 00000000 00001712 2**0 CONTENTS, READONLY
50 __mulsi3 0000001c 00000000 00000000 00001714 2**0 CONTENTS, READONLY
SYMBOL TABLE:
00000000 l d loop1_label 00000000 loop1_label
00000000 l d flush_cache 00000000 flush_cache
00000000 l d loop3_label 00000000 loop3_label
00000000 l d __mulsi3 00000000 __mulsi3
00000000 l d entry 00000000 entry
00000000 l d set_up21_a6.w 00000000 set_up21_a6.w
00000000 l d set_up21_d4.w 00000000 set_up21_d4.w
00000000 l d set_up21_d4.l 00000000 set_up21_d4.l
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.l 00000000 loop1_set_count.l
@@ -67,7 +76,10 @@ SYMBOL TABLE:
00000000 l d nrv2b.init 00000000 nrv2b.init
00000000 l d nrv2d.init 00000000 nrv2d.init
00000000 l d nrv2e.init 00000000 nrv2e.init
00000000 l d jmp_decompressor 00000000 jmp_decompressor
00000000 l d jmp_decompressor_a6.w 00000000 jmp_decompressor_a6.w
00000000 l d jmp_decompressor_d4.w 00000000 jmp_decompressor_d4.w
00000000 l d jmp_decompressor_a6.w2 00000000 jmp_decompressor_a6.w2
00000000 l d jmp_decompressor_d4.l 00000000 jmp_decompressor_d4.l
00000000 l d clear_bss 00000000 clear_bss
00000000 l d loop3.small 00000000 loop3.small
00000000 l d loop3.fast 00000000 loop3.fast
@@ -92,17 +104,19 @@ SYMBOL TABLE:
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.l 00000000 loop3_set_count.l
00000000 l d jmpstack 00000000 jmpstack
00000000 *UND* 00000000 up11
00000000 *UND* 00000000 up12
00000000 *UND* 00000000 up13
00000000 *UND* 00000000 up21
00000000 l d jmp_stack 00000000 jmp_stack
00000000 *UND* 00000000 orig_p_tlen
00000000 *UND* 00000000 orig_p_dlen
00000000 *UND* 00000000 orig_p_blen
00000000 *UND* 00000000 up21_a6
00000000 *UND* 00000000 up21_d4
00000000 *UND* 00000000 loop1_count
00000000 *UND* 00000000 loop2_count
0000000c g start_program 00000000 clear_bss_end
00000000 *UND* 00000000 copy_to_stack_len
00000000 *UND* 00000000 flush_cache_rts_offset
00000000 *UND* 00000000 up31
00000000 *UND* 00000000 up31_a6
00000000 *UND* 00000000 up31_d4
00000076 g flush_cache 00000000 flush_cache_rts
00000000 *UND* 00000000 clear_dirty_stack_len
0000000a g clear_dirty_stack 00000000 clear_dirty_stack_loop
@@ -120,10 +134,21 @@ SYMBOL TABLE:
RELOCATION RECORDS FOR [entry]:
OFFSET TYPE VALUE
0000001c R_68K_32 up11
00000026 R_68K_32 up12
00000032 R_68K_32 up13
0000003a R_68K_32 up21
0000001c R_68K_32 orig_p_tlen
00000026 R_68K_32 orig_p_dlen
00000032 R_68K_32 orig_p_blen
RELOCATION RECORDS FOR [set_up21_a6.w]:
OFFSET TYPE VALUE
00000002 R_68K_16 up21_a6
RELOCATION RECORDS FOR [set_up21_d4.w]:
OFFSET TYPE VALUE
00000004 R_68K_16 up21_d4
RELOCATION RECORDS FOR [set_up21_d4.l]:
OFFSET TYPE VALUE
00000004 R_68K_32 up21_d4
RELOCATION RECORDS FOR [loop1_set_count.b]:
OFFSET TYPE VALUE
@@ -160,9 +185,21 @@ OFFSET TYPE VALUE
00000012 R_68K_16 flush_cache_rts_offset
00000015 R_68K_PC8 flush_cache+0xffffffff
RELOCATION RECORDS FOR [jmp_decompressor]:
RELOCATION RECORDS FOR [jmp_decompressor_a6.w]:
OFFSET TYPE VALUE
00000004 R_68K_32 up31
00000002 R_68K_16 up31_a6
RELOCATION RECORDS FOR [jmp_decompressor_d4.w]:
OFFSET TYPE VALUE
00000004 R_68K_16 up31_d4
RELOCATION RECORDS FOR [jmp_decompressor_a6.w2]:
OFFSET TYPE VALUE
00000006 R_68K_16 up31_a6
RELOCATION RECORDS FOR [jmp_decompressor_d4.l]:
OFFSET TYPE VALUE
00000004 R_68K_32 up31_d4
RELOCATION RECORDS FOR [loop3_subql]:
OFFSET TYPE VALUE