1/* 2; i386-dos32.tmt.S -- loader & decompressor for the tmt/adam format 3; 4; This file is part of the UPX executable compressor. 5; 6; Copyright (C) 1996-2020 Markus Franz Xaver Johannes Oberhumer 7; Copyright (C) 1996-2020 Laszlo Molnar 8; All Rights Reserved. 9; 10; UPX and the UCL library are free software; you can redistribute them 11; and/or modify them under the terms of the GNU General Public License as 12; published by the Free Software Foundation; either version 2 of 13; the License, or (at your option) any later version. 14; 15; This program is distributed in the hope that it will be useful, 16; but WITHOUT ANY WARRANTY; without even the implied warranty of 17; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18; GNU General Public License for more details. 19; 20; You should have received a copy of the GNU General Public License 21; along with this program; see the file COPYING. 22; If not, write to the Free Software Foundation, Inc., 23; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 24; 25; Markus F.X.J. Oberhumer Laszlo Molnar 26; <markus@oberhumer.com> <ezerotven+github@gmail.com> 27; 28*/ 29 30#include "arch/i386/macros.S" 31 32 33// ============= 34// ============= ENTRY POINT 35// ============= 36 37start: 38section TMTMAIN1 39 mov edi, 0 // relocated 40 push edi 41 lea esi, [edi + copy_source] 42 sub edi, offset copy_dest 43section TMTMAIN1A 44 sbb ebp, ebp // ebp = -1 45section TMTMAIN1B 46 mov ecx, offset bytes_to_copy 47 48 std 49 rep 50 movsb 51 cld 52 53 lea esi, [edi + 1] 54 pop edi 55 push edi 56section TMTCALT1 57 push edi 58section TMTMAIN2 59 jmp decompressor 60 61#include "include/header.S" 62 63section TMTCUTPO 64decompressor: 65 66// ============= 67// ============= DECOMPRESSION 68// ============= 69 70#include "arch/i386/nrv2b_d32.S" 71#include "arch/i386/nrv2d_d32.S" 72#include "arch/i386/nrv2e_d32.S" 73#include "arch/i386/lzma_d.S" 74 75section TMTMAIN5 76 pop ebp 77 mov esi, edi 78 sub esi, [edi - 4] 79 80// ============= 81// ============= CALLTRICK 82// ============= 83 84section TMTCALT2 85 pop edi 86 87 cjt32 ebp 88 89section ctok32.00 90 mov ecx, offset filter_length 91 ctok32 ebp, (offset filter_cto) 92 93// ============= 94// ============= RELOCATION 95// ============= 96 97section TMTRELOC 98 lea edi, [ebp - 4] 99 reloc32 esi, edi, ebp 100 101section TMTJUMP1 102 jmp original_entry 103 104/* vim:set ts=8 sw=8 et: */ 105