1
; l_vmlinx.asm -- loader & decompressor for the vmlinux/i386 format
3
; This file is part of the UPX executable compressor.
5
; Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
6
; Copyright (C) 1996-2004 Laszlo Molnar
7
; Copyright (C) 2004 John Reiser
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.
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.
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.
25
; Markus F.X.J. Oberhumer Laszlo Molnar
26
; <mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
29
; <jreiser@users.sourceforge.net>
32
%define jmps jmp short
41
; ============= ENTRY POINT
46
; %eax= &uncompressed [and final entry]; %ds= %es= __BOOT_DS
47
; %esp: &compressed; __BOOT_CS
49
pop edx ; &compressed; length at -4(%edx)
51
push eax ; MATCH00(1/2) entry address; __BOOT_CS
52
push edi ; MATCH01 save
53
push esi ; MATCH02 save
56
push eax ; MATCH03 src unfilter
59
push eax ; MATCH03 src unfilter
60
push byte '?' ; MATCH04 cto unfilter
62
push 'ULEN' ; MATCH05 uncompressed length
63
call move_up ; MATCH06
66
; ============= DECOMPRESSION
69
%include "n2b_d32.ash"
70
%include "n2d_d32.ash"
71
%include "n2e_d32.ash"
72
;;%include "cl1_d32.ash"
75
; ============= UNFILTER
83
ckt32 edi, dl ; dl has cto8
84
;edi: adjust for the difference between 0 origin of buffer at filter,
85
;and actual origin of destination at unfilter.
86
;Filter.addvalue is 0: destination origin is unknown at filter time.
87
;The input data is still relocatable, and address is assigned later
88
;[as of 2004-12-15 it is 'always' 0x100000].
96
pop esi ; MATCH02 restore
97
pop edi ; MATCH01 restore
98
xor ebx, ebx ; booting the 1st cpu
102
%define ALIGN (~0<<4)
103
; must have 0==(UNLAP &~ ALIGN)
106
pop esi ; MATCH06 &decompressor
107
mov ecx,[-4+ esi] ; length of decompressor+unfilter
108
mov ebp,eax ; &uncompressed
109
add eax,[esp] ; MATCH05 ULEN + base; entry to decompressor
110
add eax, byte ~ALIGN + UNLAP
115
lea esi,[-1+ ecx + esi] ; unmoved top -1 of decompressor
116
lea edi,[-1+ ecx + eax] ; moved top -1 of decompressor
120
mov ecx,[-4+ edx] ; length of compressed data
122
shr ecx,2 ; count of .long
123
; copy compressed data
124
lea esi,[-4+ 4*ecx + edx] ; unmoved top -4 of compressed data
125
lea edi,[-4+ eax] ; moved top -4 of compressed data
130
lea esi,[4+ edi] ; &compressed [after move]
131
mov edi,ebp ; &uncompressed
132
or ebp, byte -1 ; decompressor assumption
133
jmp eax ; enter moved decompressor
136
; ============= CUT HERE
139
%include "header.ash"