Some atari/tos cleanups.

This commit is contained in:
Markus F.X.J. Oberhumer
2006-11-18 02:39:11 +01:00
parent 8146e9cbcd
commit cd0efe3edb
5 changed files with 1322 additions and 1257 deletions
+1 -1
View File
@@ -620,7 +620,7 @@ tc.m68k-atari.tos.gcc += -fno-exceptions -fno-asynchronous-unwind-tables
tc.m68k-atari.tos.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror
m68k-atari.tos.h : $(srcdir)/src/$$T.S
$(call tc,gcc) -c -x assembler-with-cpp -Wa,-m68040,-l,--pcrel,--register-prefix-optional $< -o tmp/$T.bin
$(call tc,gcc) -c -x assembler-with-cpp -Wa,-m68000,-l,--pcrel,--register-prefix-optional $< -o tmp/$T.bin
$(call tc,f-embed_objinfo,tmp/$T.bin)
$(call tc,bin2h) --ident=nrv_loader tmp/$T.bin $@
+1226 -1190
View File
File diff suppressed because it is too large Load Diff
+22 -20
View File
@@ -294,10 +294,10 @@ 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),a0
lea.l code_on_stack_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 #((code_on_stack_end-code_on_stack)/2-1),d5
moveq.l #copy_to_stack_len,d5
1: move.w -(a0),-(ASTACK)
subq.l #1,d5
@@ -307,7 +307,7 @@ section copy_to_stack
#ifdef FLUSH_CACHE
// patch code: on the stack, the 'rts' becomes a 'nop'
//move.w #0x4e71,(flush_cache_rts-clear_bss):w(ASTACK)
////move.w #0x4e71,(flush_cache_rts-code_on_stack):w(ASTACK)
move.w #0x4e71,flush_cache_rts_offset:w(ASTACK)
bsrs flush_cache
@@ -366,17 +366,18 @@ section jmp_decompressor_d4.l
// this is the final part of the startup code which runs in the stack
**************************************************************************/
// ------------- clear dirty bss
section clear_bss
section code_on_stack
// on entry:
// ASTACK == pc == clear_bss (on stack)
// ASTACK == pc == code_on_stack (on stack)
// a6 start of dirty bss [long living register]
// d6.l number of clr loops
// d6 number of clr loops for clear_dirty_bss
// d3.l 0
// ------------- clear dirty bss
section clear_dirty_bss
section loop3_label
section loop3.small
move.l d3,(a6)+
@@ -413,20 +414,19 @@ GL(flush_cache_rts) // for flush_cache_rts_offset
#endif
// ------------- restore ASTACK
// ------------- restore stack
section clear_dirty_stack
section restore_stack
//lea clear_bss_size+4:w(ASTACK),sp
lea clear_bss_end+4:w(pc),sp
// assert sp == clear_bss_end(pc)+4
lea code_on_stack_end+4:w(pc),sp
// ------------- clear the dirty stack
// clear down to clear_bss(pc) + 32 extra longs
////moveq.l #((clear_dirty_stack_loop-clear_bss+3)/4+32-1),d0
section clear_dirty_stack
// clear down to code_on_stack(pc) + 32 extra longs
////moveq.l #((clear_dirty_stack_loop-code_on_stack+3)/4+32-1),d0
moveq.l #clear_dirty_stack_len,d0
lea 1f(pc),a0
GL(clear_dirty_stack_loop) // for clear_dirty_stack_len
@@ -445,7 +445,7 @@ section start_program
1: dc.w 0x4ef9 // jmp $xxxxxxxx - jmp to text segment
GL(clear_bss_end) // for copy_to_stack_len
GL(code_on_stack_end) // for copy_to_stack_len
/*************************************************************************
@@ -549,7 +549,7 @@ section reloc
// note: d3.l is still 0
move.l a6,a0 // a0 = start of relocations
moveq.l #1,d5
moveq.l #1,d1
move.l d4,a1
add.l (a0)+,a1 // get initial fixup
@@ -558,12 +558,14 @@ section reloc
add.l d4,(a1) // reloc one address
2: move.b (a0)+,d3
beqs 3f
cmp.b d5,d3 // note: d5.b is #1 from above
cmp.b d1,d3 // note: d1.b is #1 from above
bnes 1b
lea 254(a1),a1 // d3 == 1 -> add 254, don't reloc
bras 2b
3:
// note: d3.l is still 0
// ------------- clear dirty bss & start program
@@ -581,7 +583,7 @@ section jmp_stack
// We are currently running in the dirty bss.
// Jump to the code we copied below the stack.
jmp (ASTACK) // jmp clear_bss (on stack)
jmp (ASTACK) // jmp code_on_stack (on stack)
/*************************************************************************
+41 -34
View File
@@ -25,34 +25,36 @@ Idx Name Size VMA LMA File off Algn Flags
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
23 code_on_stack 00000000 00000000 00000000 00000118 2**0 CONTENTS, READONLY
24 clear_dirty_bss 00000000 00000000 00000000 00000118 2**0 CONTENTS, READONLY
25 loop3_label 00000000 00000000 00000000 00000118 2**0 CONTENTS, READONLY
26 loop3.small 00000002 00000000 00000000 00000118 2**0 CONTENTS, READONLY
27 loop3.fast 00000008 00000000 00000000 0000011a 2**0 CONTENTS, READONLY
28 loop3_subql 00000004 00000000 00000000 00000122 2**0 CONTENTS, RELOC, READONLY
29 loop3_subqw 00000004 00000000 00000000 00000126 2**0 CONTENTS, RELOC, READONLY
30 loop3_dbra 00000004 00000000 00000000 0000012a 2**0 CONTENTS, RELOC, READONLY
31 flush_cache 00000078 00000000 00000000 0000012e 2**0 CONTENTS, READONLY
32 restore_stack 00000004 00000000 00000000 000001a6 2**0 CONTENTS, RELOC, READONLY
33 clear_dirty_stack 0000000c 00000000 00000000 000001aa 2**0 CONTENTS, RELOC, READONLY
34 start_program 0000000c 00000000 00000000 000001b6 2**0 CONTENTS, READONLY
35 UPX1HEAD 00000020 00000000 00000000 000001c2 2**0 CONTENTS, READONLY
36 CUTPOINT 00000000 00000000 00000000 000001e2 2**0 CONTENTS, READONLY
37 nrv2b_8.fast 0000007c 00000000 00000000 000001e2 2**0 CONTENTS, READONLY
38 nrv2d_8.fast 00000090 00000000 00000000 0000025e 2**0 CONTENTS, READONLY
39 nrv2e_8.fast 00000098 00000000 00000000 000002ee 2**0 CONTENTS, READONLY
40 nrv2b_8.small 00000076 00000000 00000000 00000386 2**0 CONTENTS, READONLY
41 nrv2d_8.small 0000008a 00000000 00000000 000003fc 2**0 CONTENTS, READONLY
42 nrv2e_8.small 00000092 00000000 00000000 00000486 2**0 CONTENTS, READONLY
43 lzma.init 0000002e 00000000 00000000 00000518 2**0 CONTENTS, RELOC, READONLY
44 lzma.fast 000008ca 00000000 00000000 00000546 2**0 CONTENTS, RELOC, READONLY
45 lzma.small 000008ca 00000000 00000000 00000e10 2**0 CONTENTS, RELOC, READONLY
46 lzma.finish 00000012 00000000 00000000 000016da 2**0 CONTENTS, READONLY
47 reloc 0000001a 00000000 00000000 000016ec 2**0 CONTENTS, READONLY
48 loop3_set_count.b 00000002 00000000 00000000 00001706 2**0 CONTENTS, RELOC, READONLY
49 loop3_set_count.w 00000004 00000000 00000000 00001708 2**0 CONTENTS, RELOC, READONLY
50 loop3_set_count.l 00000006 00000000 00000000 0000170c 2**0 CONTENTS, RELOC, READONLY
51 jmp_stack 00000002 00000000 00000000 00001712 2**0 CONTENTS, READONLY
52 __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
@@ -80,12 +82,14 @@ SYMBOL TABLE:
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 code_on_stack 00000000 code_on_stack
00000000 l d clear_dirty_bss 00000000 clear_dirty_bss
00000000 l d loop3.small 00000000 loop3.small
00000000 l d loop3.fast 00000000 loop3.fast
00000000 l d loop3_subql 00000000 loop3_subql
00000000 l d loop3_subqw 00000000 loop3_subqw
00000000 l d loop3_dbra 00000000 loop3_dbra
00000000 l d restore_stack 00000000 restore_stack
00000000 l d clear_dirty_stack 00000000 clear_dirty_stack
00000000 l d start_program 00000000 start_program
00000000 l d UPX1HEAD 00000000 UPX1HEAD
@@ -112,14 +116,14 @@ SYMBOL TABLE:
00000000 *UND* 00000000 up21_d4
00000000 *UND* 00000000 loop1_count
00000000 *UND* 00000000 loop2_count
0000000c g start_program 00000000 clear_bss_end
0000000c g start_program 00000000 code_on_stack_end
00000000 *UND* 00000000 copy_to_stack_len
00000000 *UND* 00000000 flush_cache_rts_offset
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
00000006 g clear_dirty_stack 00000000 clear_dirty_stack_loop
00000002 g nrv2b_8.fast 00000000 nrv2b_8_fast_decompr_start
00000002 g nrv2d_8.fast 00000000 nrv2d_8_fast_decompr_start
00000002 g nrv2e_8.fast 00000000 nrv2e_8_fast_decompr_start
@@ -180,7 +184,7 @@ OFFSET TYPE VALUE
RELOCATION RECORDS FOR [copy_to_stack]:
OFFSET TYPE VALUE
00000002 R_68K_PC16 clear_bss_end
00000002 R_68K_PC16 code_on_stack_end
00000007 R_68K_8 copy_to_stack_len
00000012 R_68K_16 flush_cache_rts_offset
00000015 R_68K_PC8 flush_cache+0xffffffff
@@ -213,10 +217,13 @@ RELOCATION RECORDS FOR [loop3_dbra]:
OFFSET TYPE VALUE
00000002 R_68K_PC16 loop3_label
RELOCATION RECORDS FOR [restore_stack]:
OFFSET TYPE VALUE
00000002 R_68K_PC16 code_on_stack_end+0x00000004
RELOCATION RECORDS FOR [clear_dirty_stack]:
OFFSET TYPE VALUE
00000002 R_68K_PC16 clear_bss_end+0x00000004
00000005 R_68K_8 clear_dirty_stack_len
00000001 R_68K_8 clear_dirty_stack_len
RELOCATION RECORDS FOR [lzma.init]:
OFFSET TYPE VALUE