1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

Started work on atari/tos.

This commit is contained in:
Markus F.X.J. Oberhumer 2006-11-12 10:58:04 +01:00
parent a74e239e28
commit 76771b845a
8 changed files with 1564 additions and 1243 deletions

View File

@ -72,39 +72,134 @@ Linker* PackTos::newLinker() const
}
void PackTos::LinkerSymbols::LoopInfo::init(unsigned count_, bool allow_dbra)
{
count = value = count_;
if (count == 0)
mode = LOOP_NONE;
else if (count <= 65536 && allow_dbra)
{
mode = LOOP_DBRA;
value -= 1;
value &= 0xffff;
}
else if (count <= 65536)
{
mode = LOOP_SUBQ_W;
value &= 0xffff;
}
else
mode = LOOP_SUBQ_L;
}
int PackTos::buildLoader(const Filter *ft)
{
assert(ft->id == 0);
const unsigned char *p = NULL;
size_t l = 0;
initLoader(nrv_loader, sizeof(nrv_loader));
//linker->dumpSymbols();
p = nrv_loader;
addLoader("entry", NULL);
assert(symbols.loop1.count || symbols.loop2.count);
if (symbols.loop1.count)
{
if (symbols.loop1.value <= 127)
addLoader("loop1_set_count.b", NULL);
else if (symbols.loop1.value <= 65535)
addLoader("loop1_set_count.w", NULL);
else
addLoader("loop1_set_count.l", NULL);
addLoader("loop1_label", NULL);
if (opt->small)
addLoader("loop1.small", NULL);
else
addLoader("loop1.fast", NULL);
if (symbols.loop1.mode == symbols.LOOP_SUBQ_L)
addLoader("loop1_subql", NULL);
else if (symbols.loop1.mode == symbols.LOOP_SUBQ_W)
addLoader("loop1_subqw", NULL);
else if (symbols.loop1.mode == symbols.LOOP_DBRA)
addLoader("loop1_dbra", NULL);
else
throwBadLoader();
}
if (symbols.loop2.count)
{
if (opt->small)
addLoader("loop2.small", NULL);
else
addLoader("loop2.fast", NULL);
}
addLoader("copy_to_stack", NULL);
if (M_IS_NRV2B(ph.method))
addLoader("nrv2b.init", NULL);
else if (M_IS_NRV2D(ph.method))
addLoader("nrv2d.init", NULL);
else if (M_IS_NRV2E(ph.method))
addLoader("nrv2e.init", NULL);
else if (M_IS_LZMA(ph.method))
addLoader("lzma.init", NULL);
else
throwBadLoader();
addLoader("jmp_decompressor", NULL);
addLoader("clear_bss", NULL);
addLoader("loop3_label", NULL);
if (opt->small)
addLoader("loop3.small", NULL);
else
addLoader("loop3.fast", NULL);
if (symbols.loop3.mode == symbols.LOOP_SUBQ_L)
addLoader("loop3_subql", NULL);
else if (symbols.loop3.mode == symbols.LOOP_SUBQ_W)
addLoader("loop3_subqw", NULL);
else if (symbols.loop3.mode == symbols.LOOP_DBRA)
addLoader("loop3_dbra", NULL);
else
throwBadLoader();
addLoader("flush_cache", NULL);
addLoader("clear_dirty_stack", NULL);
addLoader("start_program", NULL);
addLoader("IDENTSTR,+40D,UPX1HEAD,CUTPOINT", NULL);
// FIXME: symbols.decompr_offset should not be hardcoded
if (M_IS_NRV2B(ph.method)) {
// p = opt->small ? nrv2b_loader_small : nrv2b_loader;
// l = opt->small ? sizeof(nrv2b_loader_small) : sizeof(nrv2b_loader);
addLoader(opt->small ? "nrv2b_8.small" : "nrv2b_8.fast", NULL);
symbols.decompr_offset = 2;
} else if (M_IS_NRV2D(ph.method)) {
addLoader(opt->small ? "nrv2d_8.small" : "nrv2d_8.fast", NULL);
symbols.decompr_offset = 2;
} else if (M_IS_NRV2E(ph.method)) {
addLoader(opt->small ? "nrv2e_8.small" : "nrv2e_8.fast", NULL);
symbols.decompr_offset = 2;
} else if (M_IS_LZMA(ph.method)) {
addLoader("__mulsi3", NULL);
addLoader(opt->small ? "lzma.small" : "lzma.fast", NULL);
symbols.decompr_offset = linker->getSectionSize("__mulsi3");
}
if (M_IS_NRV2D(ph.method)) {
// p = opt->small ? nrv2d_loader_small : nrv2d_loader;
// l = opt->small ? sizeof(nrv2d_loader_small) : sizeof(nrv2d_loader);
}
if (M_IS_NRV2E(ph.method)) {
// p = opt->small ? nrv2e_loader_small : nrv2e_loader;
// l = opt->small ? sizeof(nrv2e_loader_small) : sizeof(nrv2e_loader);
}
initLoader(p, l);
else
throwBadLoader();
addLoader("tos0",
true ? "subql_1d0" : "subqw_1d0",
"s_bneloop0",
true ? "subql_1d6" : "subqw_1d6",
"s_bneloop3",
"IDENTSTR,+40,UPX1HEAD",
"CUTPOINT",
true ? "reloc" : "",
"jmpastack",
NULL
);
if (symbols.need_reloc)
addLoader("reloc", NULL);
assert(symbols.loop3.count);
if (symbols.loop3.value <= 127)
addLoader("loop3_set_count.b", NULL);
else if (symbols.loop3.value <= 65535)
addLoader("loop3_set_count.w", NULL);
else
addLoader("loop3_set_count.l", NULL);
addLoader("jmpstack", NULL);
freezeLoader();
return getLoaderSize();
@ -196,123 +291,6 @@ bool PackTos::checkFileHeader()
}
/*************************************************************************
// some 68000 opcodes for patching
**************************************************************************/
#if 0
enum m68k_reg_t {
REG_D0, REG_D1, REG_D2, REG_D3, REG_D4, REG_D5, REG_D6, REG_D7,
REG_A0, REG_A1, REG_A2, REG_A3, REG_A4, REG_A5, REG_A6, REG_A7
};
static unsigned OP_DBRA(int d_reg)
{
assert(d_reg >= REG_D0 && d_reg <= REG_D7);
return 0x51c8 | (d_reg & 7);
}
static unsigned OP_JMP(int a_reg)
{
// jmp (a0)
assert(a_reg >= REG_A0 && a_reg <= REG_A7);
return 0x4ed0 | (a_reg & 7);
}
static unsigned OP_MOVEI_L(int d_reg)
{
// movei.l #XXXXXXXX,d0
assert(d_reg >= REG_D0 && d_reg <= REG_D7);
return 0x203c | ((d_reg & 7) << 9);
}
static unsigned OP_MOVEQ(int value, int d_reg)
{
// moveq.l #0,d0
assert(d_reg >= REG_D0 && d_reg <= REG_D7);
assert(value >= -128 && value <= 127);
return 0x7000 | ((d_reg & 7) << 9) | (value & 0xff);
}
static unsigned OP_SUBQ_L(int value, int d_reg)
{
// subq.l #X,d0
assert(value >= 1 && value <= 8);
assert(d_reg >= REG_D0 && d_reg <= REG_D7);
return 0x5180 | ((value & 7) << 9) | (d_reg & 7);
}
static unsigned OP_SUBQ_W(int value, int d_reg)
{
// subq.w #X,d0
assert(value >= 1 && value <= 8);
assert(d_reg >= REG_D0 && d_reg <= REG_D7);
return 0x5140 | ((value & 7) << 9) | (d_reg & 7);
}
/*************************************************************************
//
**************************************************************************/
unsigned PackTos::patch_d_subq(void *b, int blen,
int d_reg, unsigned d_value,
const char *subq_marker)
{
// patch a "subq.l #1,d0" or "subq.w #1,d0".
// also convert into "dbra" if possible
assert(d_reg >= REG_D0 && d_reg <= REG_D7);
assert((int)d_value > 0);
int boff = find_be16(b, blen, get_be16(subq_marker));
if (boff < 0)
throwBadLoader();
upx_byte *p = (upx_byte *)b + boff;
if (p[2] == 0x66) // bne.b XXX
checkPatch(b, blen, boff, 4);
else
checkPatch(b, blen, boff, 2);
if (d_value > 65536)
{
set_be16(p, OP_SUBQ_L(1, d_reg)); // subq.l #1,d0
}
else
{
if (p[2] == 0x66) // bne.b XXX
{
set_be16(p, OP_DBRA(d_reg)); // dbra d0,XXX
// adjust and extend branch from 8 to 16 bits
int branch = (signed char) p[3];
set_be16(p+2, branch+2);
// adjust d0
d_value -= 1;
}
else
{
set_be16(p, OP_SUBQ_W(1, d_reg)); // subq.w #1,d0
}
d_value &= 0xffff;
}
return d_value;
}
unsigned PackTos::patch_d_loop(void *b, int blen,
int d_reg, unsigned d_value,
const char *d_marker, const char *subq_marker)
{
d_value = patch_d_subq(b, blen, d_reg, d_value, subq_marker);
int boff = find_be32(b, blen, get_be32(d_marker));
checkPatch(b, blen, boff, 4);
upx_byte *p = (upx_byte *)b + boff;
assert(get_be16(p - 2) == OP_MOVEI_L(d_reg)); // move.l #XXXXXXXX,d0
set_be32(p, d_value);
return d_value;
}
#endif
/*************************************************************************
// relocs
**************************************************************************/
@ -366,18 +344,6 @@ static int check_relocs(const upx_byte *relocs, unsigned rsize, unsigned isize,
bool PackTos::canPack()
{
#if 0 // debug
# define p(x) printf("%-30s 0x%04x\n", #x, x)
p(OP_DBRA(REG_D0));
p(OP_MOVEI_L(REG_D0));
p(OP_MOVEQ(-1, REG_D0));
p(OP_MOVEQ(1, REG_D2));
p(OP_MOVEQ(1, REG_D3));
p(OP_SUBQ_W(1, REG_D0));
p(OP_SUBQ_L(1, REG_D0));
# undef p
#endif
if (!readFileHeader())
return false;
@ -409,7 +375,6 @@ void PackTos::fileInfo()
void PackTos::pack(OutputFile *fo)
{
throwInternalError("atari/tos is currenty broken; this will get fixed in UPX 2.91");
unsigned t;
unsigned nrelocs = 0;
unsigned relocsize = 0;
@ -443,7 +408,7 @@ void PackTos::pack(OutputFile *fo)
// Check relocs (see load_and_reloc() in freemint/sys/memory.c).
// Must work around TOS bugs and lots of broken programs.
int r = 0;
symbols.need_reloc = false;
if (overlay < 4)
{
// Bug workaround: Whatever this is, silently keep it in
@ -459,15 +424,17 @@ void PackTos::pack(OutputFile *fo)
}
else if (ih.fh_reloc != 0)
relocsize = 0;
else
r = check_relocs(ibuf+t, overlay, t, &nrelocs, &relocsize, &overlay);
else {
int r = check_relocs(ibuf+t, overlay, t, &nrelocs, &relocsize, &overlay);
if (r != 0)
throwCantPack("bad relocation table");
symbols.need_reloc = true;
}
#if 0 || defined(TESTING)
printf("xx2: %d relocs: %d, overlay: %d, t: %d\n", nrelocs, relocsize, overlay, t);
#endif
if (r != 0)
throwCantPack("bad relocation table");
checkOverlay(overlay);
// Append original fileheader.
@ -488,6 +455,11 @@ void PackTos::pack(OutputFile *fo)
// alloc buffer (2048 is for decompressor and the various alignments)
obuf.allocForCompression(t, 2048);
// prepare symbols for buildLoader() - worst case
symbols.loop1.init(0x08000000);
symbols.loop2.init(0x08000000);
symbols.loop3.init(0x08000000);
// prepare packheader
ph.u_len = t;
// prepare filter
@ -497,100 +469,126 @@ void PackTos::pack(OutputFile *fo)
cconf.conf_ucl.max_match = 65535;
compressWithFilters(&ft, 512, 0, NULL, &cconf);
// get loader
const unsigned lsize = getLoaderSize();
const unsigned e_len = getLoaderSectionStart("CUTPOINT");
const unsigned d_len = lsize - e_len;
const unsigned decomp_offset = linker->getSymbolOffset("decompr_start") - e_len;
assert(decomp_offset != 0xdeaddead);
assert((e_len & 3) == 0 && (d_len & 1) == 0);
//
// multipass buildLoader()
//
// The decompressed data will now get placed at this offset:
unsigned offset = (ph.u_len + ph.overlap_overhead) - ph.c_len;
// save initial loader
const unsigned initial_lsize = getLoaderSize();
unsigned last_lsize = initial_lsize;
MemBuffer last_loader(last_lsize);
memcpy(last_loader, getLoader(), last_lsize);
// compute addresses
unsigned o_text, o_data, o_bss;
o_text = e_len;
o_data = ph.c_len;
o_bss = i_bss;
// word align len of compressed data
while (o_data & 1)
unsigned e_len, d_len, d_off;
unsigned offset;
for (;;)
{
obuf[o_data++] = 0;
offset++;
}
// The decompressed data will now get placed at this offset:
offset = (ph.u_len + ph.overlap_overhead) - ph.c_len;
// append decompressor (part 2 of loader)
const unsigned d_off = o_data;
o_data += d_len;
// get loader
const unsigned lsize = getLoaderSize();
e_len = getLoaderSectionStart("CUTPOINT");
d_len = lsize - e_len;
assert((e_len & 3) == 0 && (d_len & 1) == 0);
// dword align the len of the final data segment
while (o_data & 3)
{
obuf[o_data++] = 0;
offset++;
}
// dword align offset
while (offset & 3)
offset++;
// compute addresses
o_text = e_len;
o_data = ph.c_len;
o_bss = i_bss;
// new bss
if (i_text + i_data + i_bss > o_text + o_data + o_bss)
o_bss = (i_text + i_data + i_bss) - (o_text + o_data);
// dirty bss
unsigned dirty_bss = (o_data + offset) - (i_text + i_data);
//printf("real dirty_bss: %d\n", dirty_bss);
// dword align (or 16 - for speedup when clearing the dirty bss)
const unsigned dirty_bss_align = opt->small ? 4 : 16;
while (dirty_bss & (dirty_bss_align - 1))
dirty_bss++;
// adjust bss, assert room for some stack
if (dirty_bss + 512 > o_bss)
o_bss = dirty_bss + 512;
// dword align the len of the final bss segment
while (o_bss & 3)
o_bss++;
// patch "subq.l #1,d6" or "subq.w #1,d6" - see "up41" below
const unsigned dirty_bss_d6 = dirty_bss / dirty_bss_align;
// FIXME patch_d_subq(loader, o_text, REG_D6, dirty_bss / dirty_bss_align, "u4");
linker->defineSymbol("up31", d_off + offset + decomp_offset);
if (opt->small)
; // patch_d_loop(loader, o_text, REG_D0, o_data/4, "up22", "u1");
else
{
if (o_data <= 160)
throwNotCompressible();
unsigned loop1 = o_data / 160;
unsigned loop2 = o_data % 160;
if (loop2 == 0)
// word align len of compressed data
while (o_data & 1)
{
loop1--;
loop2 = 160;
obuf[o_data++] = 0;
offset++;
}
linker->defineSymbol("copy_remain", loop2 / 4 - 1);
//patch_be16(loader, o_text, "u2", OP_MOVEQ(loop2/4-1, REG_D0)); // moveq.l #X,d0
//patch_d_loop(loader, o_text, REG_D0, loop1, "up22", "u1");
// append decompressor (part 2 of loader)
d_off = o_data;
o_data += d_len;
// dword align the len of the final data segment
while (o_data & 3)
{
obuf[o_data++] = 0;
offset++;
}
// dword align offset
while (offset & 3)
offset++;
// new bss
if (i_text + i_data + i_bss > o_text + o_data + o_bss)
o_bss = (i_text + i_data + i_bss) - (o_text + o_data);
// dirty bss
unsigned dirty_bss = (o_data + offset) - (i_text + i_data);
//printf("real dirty_bss: %d\n", dirty_bss);
// dword align (or 16 - for speedup when clearing the dirty bss)
const unsigned dirty_bss_align = opt->small ? 4 : 16;
while (dirty_bss & (dirty_bss_align - 1))
dirty_bss++;
// adjust bss, assert room for some stack
if (dirty_bss + 512 > o_bss)
o_bss = dirty_bss + 512;
// dword align the len of the final bss segment
while (o_bss & 3)
o_bss++;
// update symbols for buildLoader()
if (opt->small)
{
symbols.loop1.init(o_data / 4);
symbols.loop2.init(0);
}
else
{
symbols.loop1.init(o_data / 160);
symbols.loop2.init((o_data % 160) / 4);
}
symbols.loop3.init(dirty_bss / dirty_bss_align);
// now re-build loader
buildLoader(&ft);
unsigned new_lsize = getLoaderSize();
assert(new_lsize <= initial_lsize);
if (new_lsize == last_lsize && memcmp(getLoader(), getLoader(), last_lsize) == 0)
break;
last_lsize = new_lsize;
memcpy(last_loader, getLoader(), last_lsize);
}
linker->defineSymbol("up22", opt->small ? o_data / 4 : (o_data - 1) / 160);
linker->defineSymbol("up21", o_data + offset);
linker->defineSymbol("up13", i_bss); // p_blen
linker->defineSymbol("up12", i_data); // p_dlen
//
// define symbols and reloc
//
linker->defineSymbol("loop1_count", symbols.loop1.value);
linker->defineSymbol("loop2_count", symbols.loop2.value);
linker->defineSymbol("loop3_count", symbols.loop3.value);
linker->defineSymbol("up11", i_text); // p_tlen
linker->defineSymbol("up12", i_data); // p_dlen
linker->defineSymbol("up13", i_bss); // p_blen
linker->defineSymbol("up21", o_data + offset);
linker->defineSymbol("up31", d_off + offset + symbols.decompr_offset);
const unsigned clear_size = linker->getSymbolOffset("clear_bss_end") -
linker->getSymbolOffset("clear_bss");
linker->defineSymbol("copy_to_stack_len", clear_size / 2 - 1);
linker->defineSymbol("clear_bss_size_p4", clear_size + 4);
// FIXME
linker->defineSymbol("clear_dirty_stack_len", (128 + 3) / 4 + 32 - 1);
// patch decompressor
//upx_byte *p = obuf + d_off;
// patch "moveq.l #1,d5" or "jmp (ASTACK)"
//patch_be16(p, d_len, "u3", (nrelocs > 0) ? OP_MOVEQ(1, REG_D5) : OP_JMP(REG_A7));
linker->defineSymbol("up41", dirty_bss_d6);
linker->relocate();
//linker->dumpSymbols();
//
// write
//
// set new file_hdr
memcpy(&oh, &ih, FH_SIZE);
@ -621,6 +619,7 @@ void PackTos::pack(OutputFile *fo)
#endif
linker->relocate();
// prepare loader
MemBuffer loader(o_text);
memcpy(loader, getLoader(), o_text);
@ -636,7 +635,7 @@ void PackTos::pack(OutputFile *fo)
fo->write(obuf, o_data); // compressed + decompressor
// write empty relocation fixup
fo->write("\x00\x00\x00\x00",4);
fo->write("\x00\x00\x00\x00", 4);
// verify
verifyOverlappingDecompression();

View File

@ -75,27 +75,34 @@ protected:
tos_header_t ih, oh;
// symbols for buildLoader()
struct LinkerSymbols
{
enum { LOOP_UNKNOWN, LOOP_SUBQ_L, LOOP_SUBQ_W, LOOP_DBRA };
// "constant"
bool need_reloc;
// these are updated by buildLoader()
enum { LOOP_NONE, LOOP_SUBQ_L, LOOP_SUBQ_W, LOOP_DBRA };
struct LoopInfo {
unsigned mode; unsigned count; unsigned value;
void init(unsigned count, bool allow_dbra=true);
};
LoopInfo loop1;
LoopInfo loop2;
LoopInfo loop3;
unsigned decompr_offset;
// before linker->relocate()
unsigned loop1_count; int loop1_mode;
unsigned loop2_count; int loop2_mode;
unsigned loop3_count; int loop3_mode;
// after linker->relocate()
unsigned copy_to_stack_len;
unsigned flush_cache_rts_offset;
unsigned clear_bss_size_p4;
unsigned clear_dirty_stack_len;
// FIXME: up11 etc.
// const char *decompr_start;
void reset() { memset(this, 0, sizeof(*this)); }
};
LinkerSymbols symbols;
protected:
unsigned patch_d_subq(void *l, int llen, int, unsigned, const char*);
unsigned patch_d_loop(void *l, int llen, int, unsigned, const char*, const char*);
};

File diff suppressed because it is too large Load Diff

View File

@ -100,7 +100,7 @@ fillbytes_sr: FILLBYTES_SR
decompr_literal:
move.b (a0)+,(a1)+
//.globl decompr_start
.globl decompr_start
decompr_start:
decompr_loop:
#ifdef SMALL

View File

@ -101,7 +101,7 @@ fillbytes_sr: FILLBYTES_SR
decompr_literal:
move.b (a0)+,(a1)+
//.globl decompr_start
.globl decompr_start
decompr_start:
decompr_loop:
#ifdef SMALL

View File

@ -99,7 +99,7 @@ fillbytes_sr: FILLBYTES_SR
decompr_literal:
move.b (a0)+,(a1)+
//.globl decompr_start
.globl decompr_start
decompr_start:
decompr_loop:
#ifdef SMALL

View File

@ -198,9 +198,7 @@ done:
// are contiguous in memory
**************************************************************************/
section tos0
start:
section entry
move.l a0,d0 // a0 is basepage if accessory
beqs 1f
move.l 4(a0),sp // accessory - get stack
@ -245,24 +243,6 @@ section loop1_set_count.l
move.l #loop1_count,d0
section loop1_label
loop1:
section loop1.small
// copy 4 bytes per loop
move.l -(a4),-(a3)
section loop1_subql
subq.l #1,d0
bnes loop1
section loop1_subqw
subq.w #1,d0
bnes loop1
section loop1_dbra
dbra d0,loop1
section loop2.small
// loop2 - EMPTY section
section loop1.fast
// loop1 - use 10 registers to copy 4*10*4 = 160 bytes per loop
@ -276,12 +256,29 @@ section loop1.fast
movem.l (a4),d1-d3/d5-d7/a0-a2/a5
movem.l d1-d3/d5-d7/a0-a2/a5,-(a3)
section loop1.small
// loop1 - copy 4 bytes per loop
move.l -(a4),-(a3)
section loop1_subql
subq.l #1,d0
bnes loop1_label
section loop1_subqw
subq.w #1,d0
bnes loop1_label
section loop1_dbra
dbra d0,loop1_label
section loop2.fast
// loop2 - copy the remaining 4..160 bytes
moveq.l #loop2_count,d0
loop2: move.l -(a4),-(a3)
dbra d0,loop2
section loop2.small
// loop2 - EMPTY section
// a3 now points to the start of the compressed block
@ -340,6 +337,7 @@ section nrv2e.init
moveq.l #0,d7
moveq.l #-0x50,d6 // 0xffffffb0
lsl.w #4,d6 // 0xfffffb00 == -0x500
section lzma.init
// ------------- jump to copied decompressor
@ -368,11 +366,10 @@ section clear_bss
// d3.l 0
section loop3_label:
loop3:
section loop3.small:
section loop3_label
section loop3.small
move.l d3,(a6)+
section loop3.fast:
section loop3.fast
// the dirty bss is usually not too large, so we don't
// bother making movem optimizations here
move.l d3,(a6)+
@ -381,12 +378,12 @@ section loop3.fast:
move.l d3,(a6)+
section loop3_subql
subq.l #1,d6
bnes loop3
bnes loop3_label
section loop3_subqw
subq.w #1,d6
bnes loop3
bnes loop3_label
section loop3_dbra
dbra d6,loop3
dbra d6,loop3_label
// ------------- flush the cache
@ -407,6 +404,8 @@ flush_cache_rts:
// ------------- restore ASTACK
section clear_dirty_stack
lea clear_bss_size_p4:w(ASTACK),sp
// assert sp == clear_bss_end(pc)+4
@ -414,8 +413,6 @@ flush_cache_rts:
// ------------- clear the dirty stack
section clear_dirty_stack
// clear down to clear_bss(pc) + 32 extra longs
//moveq.l #((L(loop)-clear_bss+3)/4+32-1),d0
moveq.l #clear_dirty_stack_len,d0
@ -524,6 +521,15 @@ 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
// note: d3.l is 0 from decompressor above
@ -608,10 +614,19 @@ section jmpstack
jmp (ASTACK) // jmp clear_bss (on stack)
// ------------- absolute symbols ("*ABS*")
/*************************************************************************
// absolute symbols ("*ABS*")
**************************************************************************/
section abs_symbols
//.globl copy_to_stack_len
//copy_to_stack_len = (clear_bss_end-clear_bss)/2-1
.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
@ -628,6 +643,7 @@ N(nrv2e_8,small)
N(lzma,fast)
N(lzma,small)
#undef N
#endif
// vi:ts=8:et:nowrap

View File

@ -2,71 +2,75 @@ tmp/m68k-atari.tos.bin: file format elf32-m68k
Sections:
Idx Name Size VMA LMA File off Algn Flags
0 tos0 0000003e 00000000 00000000 00000034 2**0 CONTENTS, RELOC, READONLY
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.small 00000002 00000000 00000000 0000007e 2**0 CONTENTS, READONLY
6 loop1_subql 00000004 00000000 00000000 00000080 2**0 CONTENTS, RELOC, READONLY
7 loop1_subqw 00000004 00000000 00000000 00000084 2**0 CONTENTS, RELOC, READONLY
8 loop1_dbra 00000004 00000000 00000000 00000088 2**0 CONTENTS, RELOC, READONLY
9 loop2.small 00000000 00000000 00000000 0000008c 2**0 CONTENTS, READONLY
10 loop1.fast 0000002a 00000000 00000000 0000008c 2**0 CONTENTS, READONLY
11 loop2.fast 00000008 00000000 00000000 000000b6 2**0 CONTENTS, RELOC, 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 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 jmp_decompressor 0000000c 00000000 00000000 000000ec 2**0 CONTENTS, RELOC, READONLY
17 clear_bss 00000000 00000000 00000000 000000f8 2**0 CONTENTS, READONLY
18 loop3_label: 00000000 00000000 00000000 000000f8 2**0 CONTENTS, READONLY
19 loop3.small: 00000002 00000000 00000000 000000f8 2**0 CONTENTS, READONLY
20 loop3.fast: 00000008 00000000 00000000 000000fa 2**0 CONTENTS, READONLY
21 loop3_subql 00000004 00000000 00000000 00000102 2**0 CONTENTS, RELOC, READONLY
22 loop3_subqw 00000004 00000000 00000000 00000106 2**0 CONTENTS, RELOC, READONLY
23 loop3_dbra 00000004 00000000 00000000 0000010a 2**0 CONTENTS, RELOC, READONLY
24 flush_cache 0000007c 00000000 00000000 0000010e 2**0 CONTENTS, RELOC, READONLY
25 clear_dirty_stack 0000000c 00000000 00000000 0000018a 2**0 CONTENTS, RELOC, READONLY
26 start_program 0000000c 00000000 00000000 00000196 2**0 CONTENTS, READONLY
27 UPX1HEAD 00000020 00000000 00000000 000001a2 2**0 CONTENTS, READONLY
28 CUTPOINT 00000000 00000000 00000000 000001c2 2**0 CONTENTS, READONLY
29 nrv2b_8.fast 0000007c 00000000 00000000 000001c2 2**0 CONTENTS, READONLY
30 nrv2d_8.fast 00000090 00000000 00000000 0000023e 2**0 CONTENTS, READONLY
31 nrv2e_8.fast 00000098 00000000 00000000 000002ce 2**0 CONTENTS, READONLY
32 nrv2b_8.small 00000076 00000000 00000000 00000366 2**0 CONTENTS, READONLY
33 nrv2d_8.small 0000008a 00000000 00000000 000003dc 2**0 CONTENTS, READONLY
34 nrv2e_8.small 00000092 00000000 00000000 00000466 2**0 CONTENTS, READONLY
35 __mulsi3 0000001c 00000000 00000000 000004f8 2**0 CONTENTS, READONLY
36 reloc 0000001a 00000000 00000000 00000514 2**0 CONTENTS, READONLY
37 loop3_set_count.b 00000002 00000000 00000000 0000052e 2**0 CONTENTS, RELOC, READONLY
38 loop3_set_count.w 00000004 00000000 00000000 00000530 2**0 CONTENTS, RELOC, READONLY
39 loop3_set_count.l 00000006 00000000 00000000 00000534 2**0 CONTENTS, RELOC, READONLY
40 jmpstack 00000002 00000000 00000000 0000053a 2**0 CONTENTS, READONLY
41 abs_symbols 00000000 00000000 00000000 0000053c 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 000008ac 00000000 00000000 000004f8 2**0 CONTENTS, READONLY
37 lzma.small 000008ac 00000000 00000000 00000da4 2**0 CONTENTS, READONLY
38 __mulsi3 0000001c 00000000 00000000 00001650 2**0 CONTENTS, READONLY
39 reloc 0000001a 00000000 00000000 0000166c 2**0 CONTENTS, READONLY
40 loop3_set_count.b 00000002 00000000 00000000 00001686 2**0 CONTENTS, RELOC, READONLY
41 loop3_set_count.w 00000004 00000000 00000000 00001688 2**0 CONTENTS, RELOC, READONLY
42 loop3_set_count.l 00000006 00000000 00000000 0000168c 2**0 CONTENTS, RELOC, READONLY
43 jmpstack 00000002 00000000 00000000 00001692 2**0 CONTENTS, READONLY
44 abs_symbols 00000000 00000000 00000000 00001694 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 tos0 00000000 tos0
00000000 l d loop3_label 00000000 loop3_label
00000000 l d entry 00000000 entry
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
00000000 l d loop1.fast 00000000 loop1.fast
00000000 l d loop1.small 00000000 loop1.small
00000000 l d loop1_subql 00000000 loop1_subql
00000000 l d loop1_subqw 00000000 loop1_subqw
00000000 l d loop1_dbra 00000000 loop1_dbra
00000000 l d loop2.small 00000000 loop2.small
00000000 l d loop1.fast 00000000 loop1.fast
00000000 l d loop2.fast 00000000 loop2.fast
00000000 l d loop2.small 00000000 loop2.small
00000000 l d copy_to_stack 00000000 copy_to_stack
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:
00000000 l d loop3.fast: 00000000 loop3.fast:
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
@ -80,6 +84,8 @@ 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.fast 00000000 lzma.fast
00000000 l d lzma.small 00000000 lzma.small
00000000 l d __mulsi3 00000000 __mulsi3
00000000 l d reloc 00000000 reloc
00000000 l d loop3_set_count.b 00000000 loop3_set_count.b
@ -95,21 +101,19 @@ SYMBOL TABLE:
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
00000076 g *ABS* 00000000 flush_cache_rts_offset
00000000 *UND* 00000000 up31
00000000 *UND* 00000000 clear_bss_size_p4
00000000 *UND* 00000000 clear_dirty_stack_len
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 loop3_count
00000002 g *ABS* 00000000 nrv2b_8_fast_start_offset
00000002 g *ABS* 00000000 nrv2d_8_fast_start_offset
00000002 g *ABS* 00000000 nrv2e_8_fast_start_offset
00000002 g *ABS* 00000000 nrv2b_8_small_start_offset
00000002 g *ABS* 00000000 nrv2d_8_small_start_offset
00000002 g *ABS* 00000000 nrv2e_8_small_start_offset
00000000 g *ABS* 00000000 lzma_fast_start_offset
00000000 g *ABS* 00000000 lzma_small_start_offset
RELOCATION RECORDS FOR [tos0]:
RELOCATION RECORDS FOR [entry]:
OFFSET TYPE VALUE
0000001c R_68K_32 up11
00000026 R_68K_32 up12
@ -157,23 +161,20 @@ OFFSET TYPE VALUE
RELOCATION RECORDS FOR [loop3_subql]:
OFFSET TYPE VALUE
00000003 R_68K_PC8 loop3_label:+0xffffffff
00000003 R_68K_PC8 loop3_label+0xffffffff
RELOCATION RECORDS FOR [loop3_subqw]:
OFFSET TYPE VALUE
00000003 R_68K_PC8 loop3_label:+0xffffffff
00000003 R_68K_PC8 loop3_label+0xffffffff
RELOCATION RECORDS FOR [loop3_dbra]:
OFFSET TYPE VALUE
00000002 R_68K_PC16 loop3_label:
RELOCATION RECORDS FOR [flush_cache]:
OFFSET TYPE VALUE
0000007a R_68K_16 clear_bss_size_p4
00000002 R_68K_PC16 loop3_label
RELOCATION RECORDS FOR [clear_dirty_stack]:
OFFSET TYPE VALUE
00000001 R_68K_8 clear_dirty_stack_len
00000002 R_68K_16 clear_bss_size_p4
00000005 R_68K_8 clear_dirty_stack_len
RELOCATION RECORDS FOR [loop3_set_count.b]:
OFFSET TYPE VALUE