atari/tos now seems to work again.

This commit is contained in:
Markus F.X.J. Oberhumer
2006-11-12 18:25:46 +01:00
parent 9d0270dcd6
commit 8e0bd936eb
6 changed files with 1616 additions and 1464 deletions
+1411 -1360
View File
File diff suppressed because it is too large Load Diff
+97
View File
@@ -0,0 +1,97 @@
/*
; lzma_d.S --
;
; This file is part of the UPX executable compressor.
;
; Copyright (C) 2006-2006 Markus Franz Xaver Johannes Oberhumer
; All Rights Reserved.
;
; UPX and the UCL library are free software; you can redistribute them
; and/or modify them under the terms of the GNU General Public License as
; published by the Free Software Foundation; either version 2 of
; the License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; see the file COPYING.
; If not, write to the Free Software Foundation, Inc.,
; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;
; Markus F.X.J. Oberhumer
; <markus@oberhumer.com>
; http://www.oberhumer.com/opensource/upx/
;
; ------------- DECOMPRESSION -------------
; decompress from a3 to d4
; note: must preserve d4 and a5-a7
;
; On entry:
; a3 src pointer
; d4 dest pointer
;
; On exit:
; d3.l = 0
*/
section lzma.init
move.l sp,d7 // save stack
lea lzma_stack_adjust:w(sp),sp
addq.l #2,a3 // skip 2 bytes for properties
move.l sp,a2
// move.l (a2)+,-(sp) // &outSizeProcessed
pea (a2) // &outSizeProcessed
move.l #lzma_u_len,-(sp) // outSize
move.l d4,-(sp) // out
// move.l (a2)+,-(sp) // &inSizeProcessed
pea 4(a2) // &inSizeProcessed
move.l #lzma_c_len,-(sp) // inSize
move.l a3,-(sp) // in
// move.l (a2),-(sp) // &CLzmaDecoderState
pea 8(a2) // &CLzmaDecoderState
move.l d0,-(sp) // dummy for call
// hardwired LzmaDecodeProperties()
move.l #lzma_properties,8(a2) // lc, lp, pb, dummy
section lzma.fast
#include "m68000/lzma_d_cf.S"
section lzma.small
#include "m68000/lzma_d_cs.S"
section lzma.finish
moveq.l #0,d3
// add.l 4(a2),XX // inSizeProcessed
// add.l (a2),XX // outSizeProcessed
#if 0
move.l d7,sp // restore stack
#else
// Partially clear exposed stack (only because of paranoia.)
lea -256(a2),sp
.clearstack2:
move.l d3,(sp)+
move.l d3,(sp)+
move.l d3,(sp)+
move.l d3,(sp)+
cmp.l sp,d7
bnes .clearstack2
#endif
// vi:ts=8:et
+30 -40
View File
@@ -38,19 +38,16 @@
; freemint/sys/memory.c (load_region, load_and_reloc)
; freemint/sys/arch/cpu.S (cpush)
;
;
; This file is first preprocessed by cpp, then the a68k assembler
; is run and finally the generated object file is translated to a .h file
; by a simple perl script. We also maintain compatiblity with the pasm
; assembler (which must be started in the emulator window).
;
*/
#define macro(name) .macro name
#define endm .endm
#define section .section
// global label for cross-section addressing
#define GL(l) .globl l; l:
/*
; basepage offsets
p_lowtpa equ $0 ; .l pointer to self (bottom of TPA)
@@ -299,25 +296,20 @@ loop6: move.w -(a2),-(ASTACK)
subq.l #1,d5
bccs loop6
#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_offset:w(ASTACK)
#endif
// note: d5.l is now -1 (needed for decompressor)
// -------------
#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_offset:w(ASTACK)
bsrs flush_cache
#endif
// ------------- prepare decompressor
#define NRV_NO_INIT
#define NRV_NO_INIT 1
section nrv2b.init
//moveq.l #-1,d5 // last_off = -1
@@ -325,30 +317,34 @@ section nrv2b.init
moveq.l #-1,d7
moveq.l #-0x68,d6 // 0xffffff98
lsl.w #5,d6 // 0xfffff300 == -0xd00
// a3 still points to the start of the compressed block
move.l d4,a4 // dest. for decompressing
section nrv2d.init
//moveq.l #-1,d5 // last_off = -1
moveq.l #-128,d0 // d0.b = $80
moveq.l #-1,d7
moveq.l #-0x50,d6 // 0xffffffb0
lsl.w #4,d6 // 0xfffffb00 == -0x500
// a3 still points to the start of the compressed block
move.l d4,a4 // dest. for decompressing
section nrv2e.init
//moveq.l #-1,d5 // last_off = -1
moveq.l #-128,d0 // d0.b = $80
moveq.l #0,d7
moveq.l #-0x50,d6 // 0xffffffb0
lsl.w #4,d6 // 0xfffffb00 == -0x500
section lzma.init
// a3 still points to the start of the compressed block
move.l d4,a4 // dest. for decompressing
// ------------- jump to copied decompressor
section jmp_decompressor
// a3 still points to the start of the compressed block
move.l d4,a4 // dest. for decompressing
move.l d4,a2
add.l #up31,a2
jmp (a2) // jmp decompr_start
move.l d4,a0
add.l #up31,a0
jmp (a0) // jmp decompr_start
/*************************************************************************
@@ -396,7 +392,7 @@ section loop3_dbra
section flush_cache
FLUSH_CACHE
flush_cache_rts:
GL(flush_cache_rts) // for flush_cache_rts_offset
rts
#endif
@@ -406,7 +402,8 @@ flush_cache_rts:
section clear_dirty_stack
lea clear_bss_size_p4:w(ASTACK),sp
//lea clear_bss_size+4:w(ASTACK),sp
lea clear_bss_end+4:w(pc),sp
// assert sp == clear_bss_end(pc)+4
@@ -417,6 +414,7 @@ section clear_dirty_stack
//moveq.l #((L(loop)-clear_bss+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
1: move.l d3,-(a0)
dbra d0,1b
@@ -432,8 +430,7 @@ section start_program
1: dc.w 0x4ef9 // jmp $xxxxxxxx - jmp to text segment
.globl clear_bss_end // for clear_dirty_stack_len
clear_bss_end:
GL(clear_bss_end) // for copy_to_stack_len
/*************************************************************************
@@ -521,13 +518,7 @@ section nrv2e_8.small
#undef d2
section lzma.fast
#include "arch/m68k/m68000/lzma_d_cf.S"
moveq.l #0,d3
section lzma.small
#include "arch/m68k/m68000/lzma_d_cs.S"
moveq.l #0,d3
#include "arch/m68k/lzma_d.S"
// note: d3.l is 0 from decompressor above
@@ -598,7 +589,7 @@ section __mulsi3
add.l d1,d0 // 6
rts // 16
#else
// smaller and faster
// slightly smaller and faster
// compute high-word
lea 4(sp),a0 // 8
move.w (a0)+,d1 // 8
@@ -620,12 +611,10 @@ section __mulsi3
// absolute symbols ("*ABS*")
**************************************************************************/
#if 0
section abs_symbols
.globl flush_cache_rts_offset
flush_cache_rts_offset = flush_cache_rts - flush_cache
#if 0
#define N(a,b) \
.globl a##_##b##_start_offset; \
a##_##b##_start_offset = a##_##b##_decompr_start - a.b
@@ -642,6 +631,7 @@ N(nrv2e_8,small)
N(lzma,fast)
N(lzma,small)
#undef N
#endif
+50 -38
View File
@@ -15,38 +15,38 @@ Idx Name Size VMA LMA File off Algn Flags
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 00000008 00000000 00000000 000000d4 2**0 CONTENTS, READONLY
14 nrv2d.init 00000008 00000000 00000000 000000dc 2**0 CONTENTS, READONLY
15 nrv2e.init 00000008 00000000 00000000 000000e4 2**0 CONTENTS, READONLY
16 lzma.init 00000000 00000000 00000000 000000ec 2**0 CONTENTS, READONLY
17 jmp_decompressor 0000000c 00000000 00000000 000000ec 2**0 CONTENTS, RELOC, READONLY
18 clear_bss 00000000 00000000 00000000 000000f8 2**0 CONTENTS, READONLY
19 loop3_label 00000000 00000000 00000000 000000f8 2**0 CONTENTS, READONLY
20 loop3.small 00000002 00000000 00000000 000000f8 2**0 CONTENTS, READONLY
21 loop3.fast 00000008 00000000 00000000 000000fa 2**0 CONTENTS, READONLY
22 loop3_subql 00000004 00000000 00000000 00000102 2**0 CONTENTS, RELOC, READONLY
23 loop3_subqw 00000004 00000000 00000000 00000106 2**0 CONTENTS, RELOC, READONLY
24 loop3_dbra 00000004 00000000 00000000 0000010a 2**0 CONTENTS, RELOC, READONLY
25 flush_cache 00000078 00000000 00000000 0000010e 2**0 CONTENTS, READONLY
26 clear_dirty_stack 00000010 00000000 00000000 00000186 2**0 CONTENTS, RELOC, READONLY
27 start_program 0000000c 00000000 00000000 00000196 2**0 CONTENTS, READONLY
28 UPX1HEAD 00000020 00000000 00000000 000001a2 2**0 CONTENTS, READONLY
29 CUTPOINT 00000000 00000000 00000000 000001c2 2**0 CONTENTS, READONLY
30 nrv2b_8.fast 0000007c 00000000 00000000 000001c2 2**0 CONTENTS, READONLY
31 nrv2d_8.fast 00000090 00000000 00000000 0000023e 2**0 CONTENTS, READONLY
32 nrv2e_8.fast 00000098 00000000 00000000 000002ce 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
35 nrv2e_8.small 00000092 00000000 00000000 00000466 2**0 CONTENTS, READONLY
36 lzma.fast 000008cc 00000000 00000000 000004f8 2**0 CONTENTS, RELOC, READONLY
37 lzma.small 000008cc 00000000 00000000 00000dc4 2**0 CONTENTS, RELOC, READONLY
38 reloc 0000001a 00000000 00000000 00001690 2**0 CONTENTS, READONLY
39 loop3_set_count.b 00000002 00000000 00000000 000016aa 2**0 CONTENTS, RELOC, READONLY
40 loop3_set_count.w 00000004 00000000 00000000 000016ac 2**0 CONTENTS, RELOC, READONLY
41 loop3_set_count.l 00000006 00000000 00000000 000016b0 2**0 CONTENTS, RELOC, READONLY
42 jmpstack 00000002 00000000 00000000 000016b6 2**0 CONTENTS, READONLY
43 __mulsi3 0000001c 00000000 00000000 000016b8 2**0 CONTENTS, READONLY
44 abs_symbols 00000000 00000000 00000000 000016d4 2**0 CONTENTS, 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
SYMBOL TABLE:
00000000 l d loop1_label 00000000 loop1_label
00000000 l d flush_cache 00000000 flush_cache
@@ -67,7 +67,6 @@ 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 lzma.init 00000000 lzma.init
00000000 l d jmp_decompressor 00000000 jmp_decompressor
00000000 l d clear_bss 00000000 clear_bss
00000000 l d loop3.small 00000000 loop3.small
@@ -85,14 +84,15 @@ SYMBOL TABLE:
00000000 l d nrv2b_8.small 00000000 nrv2b_8.small
00000000 l d nrv2d_8.small 00000000 nrv2d_8.small
00000000 l d nrv2e_8.small 00000000 nrv2e_8.small
00000000 l d lzma.init 00000000 lzma.init
00000000 l d lzma.fast 00000000 lzma.fast
00000000 l d lzma.small 00000000 lzma.small
00000000 l d lzma.finish 00000000 lzma.finish
00000000 l d reloc 00000000 reloc
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 l d abs_symbols 00000000 abs_symbols
00000000 *UND* 00000000 up11
00000000 *UND* 00000000 up12
00000000 *UND* 00000000 up13
@@ -101,16 +101,21 @@ SYMBOL TABLE:
00000000 *UND* 00000000 loop2_count
0000000c g start_program 00000000 clear_bss_end
00000000 *UND* 00000000 copy_to_stack_len
00000076 g *ABS* 00000000 flush_cache_rts_offset
00000000 *UND* 00000000 flush_cache_rts_offset
00000000 *UND* 00000000 up31
00000000 *UND* 00000000 clear_bss_size_p4
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
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
00000002 g nrv2b_8.small 00000000 nrv2b_8_small_decompr_start
00000002 g nrv2d_8.small 00000000 nrv2d_8_small_decompr_start
00000002 g nrv2e_8.small 00000000 nrv2e_8_small_decompr_start
00000000 *UND* 00000000 lzma_stack_adjust
00000000 *UND* 00000000 lzma_u_len
00000000 *UND* 00000000 lzma_c_len
00000000 *UND* 00000000 lzma_properties
00000000 *UND* 00000000 loop3_count
RELOCATION RECORDS FOR [entry]:
@@ -157,7 +162,7 @@ OFFSET TYPE VALUE
RELOCATION RECORDS FOR [jmp_decompressor]:
OFFSET TYPE VALUE
00000006 R_68K_32 up31
00000004 R_68K_32 up31
RELOCATION RECORDS FOR [loop3_subql]:
OFFSET TYPE VALUE
@@ -173,9 +178,16 @@ OFFSET TYPE VALUE
RELOCATION RECORDS FOR [clear_dirty_stack]:
OFFSET TYPE VALUE
00000002 R_68K_16 clear_bss_size_p4
00000002 R_68K_PC16 clear_bss_end+0x00000004
00000005 R_68K_8 clear_dirty_stack_len
RELOCATION RECORDS FOR [lzma.init]:
OFFSET TYPE VALUE
00000004 R_68K_16 lzma_stack_adjust
0000000e R_68K_32 lzma_u_len
0000001a R_68K_32 lzma_c_len
00000028 R_68K_32 lzma_properties
RELOCATION RECORDS FOR [lzma.fast]:
OFFSET TYPE VALUE
00000108 R_68K_PC16 __mulsi3