djgpp2: lzma seems to work

This commit is contained in:
László Molnár
2006-06-22 15:00:15 +02:00
parent b13f7366cf
commit 3f566e541d
3 changed files with 575 additions and 553 deletions
+6
View File
@@ -89,7 +89,9 @@ int PackDjgpp2::buildLoader(const Filter *ft)
addLoader("IDENTSTR,DJ2MAIN1", addLoader("IDENTSTR,DJ2MAIN1",
ft->id ? "DJCALLT1" : "", ft->id ? "DJCALLT1" : "",
"DJ2MAIN2", "DJ2MAIN2",
ph.method == M_LZMA ? "LZMA_INIT_STACK" : "",
getDecompressorSections(), getDecompressorSections(),
ph.method == M_LZMA ? "LZMA_DONE_STACK" : "",
"DJ2BSS00", "DJ2BSS00",
NULL NULL
); );
@@ -300,6 +302,8 @@ void PackDjgpp2::pack(OutputFile *fo)
if (bss->size < ph.overlap_overhead) // give it a .bss if (bss->size < ph.overlap_overhead) // give it a .bss
bss->size = ph.overlap_overhead; bss->size = ph.overlap_overhead;
if (ph.method == M_LZMA && bss->size < 0x4000)
bss->size = 0x4000;
text->scnptr = sizeof(coff_hdr); text->scnptr = sizeof(coff_hdr);
data->scnptr = text->scnptr + text->size; data->scnptr = text->scnptr + text->size;
@@ -317,6 +321,8 @@ void PackDjgpp2::pack(OutputFile *fo)
patch_le32(loader, lsize, "BSSL", ph.overlap_overhead / 4); patch_le32(loader, lsize, "BSSL", ph.overlap_overhead / 4);
patchDecompressor(loader, lsize); patchDecompressor(loader, lsize);
assert(bss->vaddr == ((size + 0x1ff) &~ 0x1ff) + (text->vaddr &~ 0x1ff)); assert(bss->vaddr == ((size + 0x1ff) &~ 0x1ff) + (text->vaddr &~ 0x1ff));
if (ph.method == M_LZMA)
patch_le32(loader, lsize, "ESP0", bss->vaddr + bss->size);
patch_le32(loader, lsize, "OUTP", text->vaddr - hdrsize); patch_le32(loader, lsize, "OUTP", text->vaddr - hdrsize);
patch_le32(loader, lsize, "INPP", data->vaddr); patch_le32(loader, lsize, "INPP", data->vaddr);
File diff suppressed because it is too large Load Diff
+12
View File
@@ -52,6 +52,14 @@ start:
; cld ; the stub sets this ; cld ; the stub sets this
or ebp, byte -1 or ebp, byte -1
; __LZMA_INIT_STACK__
xor eax, eax
mov [eax], ss
mov [eax + 4], esp
mov eax, ds
mov ss, eax
mov esp, 'ESP0'
; ============= ; =============
; ============= DECOMPRESSION ; ============= DECOMPRESSION
; ============= ; =============
@@ -61,6 +69,10 @@ start:
%include "arch/i386/nrv2e_d32.ash" %include "arch/i386/nrv2e_d32.ash"
%include "arch/i386/lzma_d.ash" %include "arch/i386/lzma_d.ash"
; __LZMA_DONE_STACK__
mov ss, [eax]
mov esp, [eax + 4]
; ============= ; =============
; __DJ2BSS00__ ; __DJ2BSS00__