mirror of
https://github.com/upx/upx
synced 2025-10-05 19:20:23 +08:00
Propagate changes from linux.hh.
Also adjust calling segquence of upx_main() to shave a few bytes. l_lx_exec.c fold_exec86.asm fold_exec86.h committer: jreiser <jreiser> 1144967447 +0000
This commit is contained in:
parent
6a4db2ecab
commit
5d948a67a8
|
@ -50,11 +50,11 @@ fold_begin: ; enter: %ebx= &Elf32_Ehdr of this program
|
|||
pop eax ; Pop the argument count
|
||||
mov ecx, esp ; argv starts just at the current stack top
|
||||
lea edx, [esp+eax*4+4] ; envp = &argv[argc + 1]
|
||||
mov esi, [e_entry + ebx]
|
||||
add ebx, szElf32_Ehdr + szElf32_Phdr + szl_info
|
||||
sub esi, ebx ; length
|
||||
lea edi, [2 + ebp] ; f_unfilter, maybe
|
||||
pusha ; (f_unf, cprLen, f_decpr, xx, cprSrc, envp, argv, argc)
|
||||
mov edi, [ebx + e_entry]
|
||||
lea esi, [ebx + szElf32_Ehdr + szElf32_Phdr + szl_info]
|
||||
sub edi, esi ; length
|
||||
lea ebx, [2 + ebp] ; f_unfilter, maybe
|
||||
pusha ; (cprLen, cprSrc, f_decpr, xx, f_unf, envp, argv, argc)
|
||||
EXTERN upx_main
|
||||
call upx_main ; Call the UPX main function
|
||||
hlt ; Crash if somehow upx_main does return
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* fold_exec86.h -- created from fold_exec86.bin, 947 (0x3b3) bytes
|
||||
/* fold_exec86.h -- created from fold_exec86.bin, 899 (0x383) bytes
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
|
@ -27,69 +27,66 @@
|
|||
*/
|
||||
|
||||
|
||||
#define LINUX_I386EXEC_FOLD_SIZE 947
|
||||
#define LINUX_I386EXEC_FOLD_ADLER32 0x14ec8f58
|
||||
#define LINUX_I386EXEC_FOLD_CRC32 0x81e80623
|
||||
#define LINUX_I386EXEC_FOLD_SIZE 899
|
||||
#define LINUX_I386EXEC_FOLD_ADLER32 0xcf9c7496
|
||||
#define LINUX_I386EXEC_FOLD_CRC32 0xab6154cb
|
||||
|
||||
unsigned char linux_i386exec_fold[947] = {
|
||||
unsigned char linux_i386exec_fold[899] = {
|
||||
127, 69, 76, 70, 1, 1, 1, 0, 76,105,110,117,120, 0, 0, 0, /* 0x 0 */
|
||||
2, 0, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, /* 0x 10 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 32, 0, 1, 0, 0, 0, /* 0x 20 */
|
||||
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 16, 64, 0, /* 0x 30 */
|
||||
0, 16, 64, 0,179, 3, 0, 0,180, 3, 0, 0, 7, 0, 0, 0, /* 0x 40 */
|
||||
0, 16, 64, 0,131, 3, 0, 0,132, 3, 0, 0, 7, 0, 0, 0, /* 0x 40 */
|
||||
0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 50 */
|
||||
88, 88, 88,137,225,141, 84,132, 4,139,115, 24,131,195, 96, 41, /* 0x 60 */
|
||||
222,141,125, 2, 96,232,197, 0, 0, 0,244, 83,141, 92, 36, 8, /* 0x 70 */
|
||||
88, 88, 88,137,225,141, 84,132, 4,139,123, 24,141,115, 96, 41, /* 0x 60 */
|
||||
247,141, 93, 2, 96,232,197, 0, 0, 0,244, 83,141, 92, 36, 8, /* 0x 70 */
|
||||
106, 90, 88,205,128, 91,195, 0, 83,137,195,139, 76, 36, 8,136, /* 0x 80 */
|
||||
208,131,224, 31, 60, 25,118, 3,131,232, 43,131,192, 65, 75,136, /* 0x 90 */
|
||||
3,137,208,193,232, 5,137,194,226,229, 91,195, 85, 49,201,137, /* 0x a0 */
|
||||
229, 87, 86,137,202, 83,131,236, 32,139, 93, 8,106, 5, 88,205, /* 0x b0 */
|
||||
128,133,192,137,199,120,108,199, 69,212, 47,112,114,111,199, 69, /* 0x c0 */
|
||||
216, 99, 47, 0, 0,106, 20, 88,205,128,141, 85,218,141,117,212, /* 0x d0 */
|
||||
232,171, 2, 0, 0,141, 80, 4,137,243,199, 0, 47,102,100, 47, /* 0x e0 */
|
||||
137,248,232,153, 2, 0, 0,186, 1, 0, 0, 0,106, 33, 88,106, /* 0x f0 */
|
||||
229, 87, 86,137,202, 83,131,236, 44,139, 93, 8,106, 5, 88,205, /* 0x b0 */
|
||||
128,133,192,137,198,120,108,199, 69,212, 47,112,114,111,199, 69, /* 0x c0 */
|
||||
216, 99, 47, 0, 0,106, 20, 88,205,128,141, 85,218,141,125,212, /* 0x d0 */
|
||||
232,123, 2, 0, 0,141, 80, 4,137,251,199, 0, 47,102,100, 47, /* 0x e0 */
|
||||
137,240,232,105, 2, 0, 0,186, 1, 0, 0, 0,106, 33, 88,106, /* 0x f0 */
|
||||
5, 89,205,128, 61, 85, 80, 88, 50,117, 33,139, 93, 8,106, 10, /* 0x 100 */
|
||||
88,205,128,185, 2, 0, 0, 0,137,251,106, 55, 88,205,128,137, /* 0x 110 */
|
||||
243,139, 77, 12,139, 85, 16,106, 11, 88,205,128,137,251,106, 6, /* 0x 120 */
|
||||
88,205,128,131,196, 32,137,248, 91, 94, 95,201,194, 12, 0, 85, /* 0x 130 */
|
||||
137,229, 87, 86, 83,131,236,112,141,125,228,139, 77, 24,139, 69, /* 0x 140 */
|
||||
16,139, 85, 12,137,203,129,227, 0,240,255,255,137, 69,156,137, /* 0x 150 */
|
||||
85,148,137,206,137, 77,152,137, 93,144,165,165,165,131,109,148, /* 0x 160 */
|
||||
12,129,125,228, 85, 80, 88, 51,137,117,152, 15,133,100, 1, 0, /* 0x 170 */
|
||||
0,199, 69,196, 47,116,109,112,199, 69,200, 47,117,112,120,141, /* 0x 180 */
|
||||
77,215,106, 20, 88,205,128,137,194,106, 4,137,200,141,117,211, /* 0x 190 */
|
||||
232,227,254,255,255,141, 93,172,137,199,198, 69,215, 0, 51,125, /* 0x 1a0 */
|
||||
228, 49,201,106, 78, 88,205,128, 51,125,172,139, 85,176,137,240, /* 0x 1b0 */
|
||||
199, 4, 36, 7, 0, 0, 0,193,226, 12,141, 93,196, 49,250,232, /* 0x 1c0 */
|
||||
180,254,255,255, 88,106, 10, 88,205,128,131,248,254,116, 8,133, /* 0x 1d0 */
|
||||
192, 15,133,254, 0, 0, 0,185,194, 0, 0, 0,186,192, 1, 0, /* 0x 1e0 */
|
||||
0,141, 93,196,106, 5, 88,205,128,137, 69,136,139, 77,232,137, /* 0x 1f0 */
|
||||
195,106, 93, 88,205,128,133,192, 15,133,207, 0, 0, 0,106, 0, /* 0x 200 */
|
||||
83,106, 1,106, 3, 81,106, 0,232, 94,254,255,255,131,196, 24, /* 0x 210 */
|
||||
61, 0,240,255,255,137, 69,132, 15,135,175, 0, 0, 0,139, 69, /* 0x 220 */
|
||||
232,106, 0,106, 0, 5,255, 15, 0, 0,106, 50, 37, 0,240,255, /* 0x 230 */
|
||||
255,106, 3, 3, 69,132,104, 0, 16, 0, 0, 80,232, 42,254,255, /* 0x 240 */
|
||||
255,131,196, 24,141,125,180,139,117,152,165,165,165,139, 77,180, /* 0x 250 */
|
||||
131,109,148, 12,133,201,137,117,152,139, 85,184,117, 20,129,250, /* 0x 260 */
|
||||
85, 80, 88, 33,117,103,131,125,232, 0, 15,132,141, 0, 0, 0, /* 0x 270 */
|
||||
235, 91, 57,202,119, 87, 59, 85,236,119, 82, 57,202,115, 36, 15, /* 0x 280 */
|
||||
182, 69,188, 80,141, 69,168, 80,255,117,132, 82,255,117,152,255, /* 0x 290 */
|
||||
85,156,131,196, 20,133,192,117, 52,139, 69,180, 57, 69,168,117, /* 0x 2a0 */
|
||||
44,235, 8,139,125,132,139,117,152,243,164,139, 77,180,139, 93, /* 0x 2b0 */
|
||||
132,106, 91, 88,205,128,139, 69,184, 1,203, 41, 69,148, 41, 77, /* 0x 2c0 */
|
||||
232, 1, 69,152,131,125,148, 0,137, 93,132,121, 18,141, 93,196, /* 0x 2d0 */
|
||||
106, 10, 88,205,128,106,127, 91,106, 1, 88,205,128,235,254,139, /* 0x 2e0 */
|
||||
77,152,139, 93,144,129,225, 0,240,255,255, 43, 77,144,106, 91, /* 0x 2f0 */
|
||||
88,205,128, 1,203,137, 93,144,233, 71,255,255,255,139, 93,136, /* 0x 300 */
|
||||
106, 6, 88,205,128,133,192,117,196,255,117, 28,255,117, 32,141, /* 0x 310 */
|
||||
117,196, 86,232,132,253,255,255,133,192,120,177,106, 2, 88,205, /* 0x 320 */
|
||||
128,133,192,117, 51,106, 2, 88,205,128,133,192,137,193,117, 31, /* 0x 330 */
|
||||
199, 69,160, 85, 80, 88, 52,184,162, 0, 0, 0,141, 93,160,199, /* 0x 340 */
|
||||
69,164, 0, 0, 0, 0,205,128,137,243,106, 10, 88,205,128, 49, /* 0x 350 */
|
||||
219,106, 1, 88,205,128,235,254, 49,201,131,203,255,137,202,106, /* 0x 360 */
|
||||
7, 88,205,128,141, 93,196,139, 77, 32,139, 85, 28,106, 11, 88, /* 0x 370 */
|
||||
205,128,233, 86,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 380 */
|
||||
87,137,215,106, 10,252, 89,232, 5, 0, 0, 0,136, 39,151, 95, /* 0x 390 */
|
||||
195,153,247,241, 82,133,192,116, 5,232,243,255,255,255, 88, 4, /* 0x 3a0 */
|
||||
48,170,195 /* 0x 3b0 */
|
||||
88,205,128,185, 2, 0, 0, 0,137,243,106, 55, 88,205,128,137, /* 0x 110 */
|
||||
251,139, 77, 12,139, 85, 16,106, 11, 88,205,128,137,243,106, 6, /* 0x 120 */
|
||||
88,205,128,131,196, 44,137,240, 91, 94, 95,201,194, 12, 0, 85, /* 0x 130 */
|
||||
137,229, 87, 86, 83,131,236,124,141,125,228,139, 69, 16,139,117, /* 0x 140 */
|
||||
12,137, 69,156,165,165,165,131,109, 8, 12,129,125,228, 85, 80, /* 0x 150 */
|
||||
88, 51,137,117, 12, 15,133,111, 1, 0, 0,199, 69,196, 47,116, /* 0x 160 */
|
||||
109,112,199, 69,200, 47,117,112,120,141, 77,215,106, 20, 88,205, /* 0x 170 */
|
||||
128,137,194,106, 4,137,200,141,125,211,232,249,254,255,255,139, /* 0x 180 */
|
||||
85,228,198, 69,215, 0, 49,201, 49,208,141, 93,172,137, 69,132, /* 0x 190 */
|
||||
106, 78, 88,205,128,139, 85,172,137,248, 49, 85,132,139, 85,176, /* 0x 1a0 */
|
||||
199, 4, 36, 7, 0, 0, 0,141, 93,196,193,226, 12, 51, 85,132, /* 0x 1b0 */
|
||||
232,195,254,255,255, 88,106, 10, 88,205,128,131,248,254,116, 8, /* 0x 1c0 */
|
||||
133,192, 15,133, 2, 1, 0, 0,185,194, 0, 0, 0,186,192, 1, /* 0x 1d0 */
|
||||
0, 0,141, 93,196,106, 5, 88,205,128,139, 85,232,137, 69,148, /* 0x 1e0 */
|
||||
137,195,137,209,106, 93, 88,205,128,133,192, 15,133,209, 0, 0, /* 0x 1f0 */
|
||||
0,106, 0,255,117,148,106, 1,106, 3, 82,106, 0,232,105,254, /* 0x 200 */
|
||||
255,255,131,196, 24, 61, 0,240,255,255,137, 69,136, 15,135,175, /* 0x 210 */
|
||||
0, 0, 0,139, 69,232,106, 0,106, 0, 5,255, 15, 0, 0,106, /* 0x 220 */
|
||||
50, 37, 0,240,255,255,106, 3, 3, 69,136,104, 0, 16, 0, 0, /* 0x 230 */
|
||||
80,232, 53,254,255,255,131,196, 24,141,125,180,139,117, 12,165, /* 0x 240 */
|
||||
165,165,139, 77,180,131,109, 8, 12,133,201,137,117, 12,139, 85, /* 0x 250 */
|
||||
184,117, 16,129,250, 85, 80, 88, 33,117,103,131,125,232, 0,116, /* 0x 260 */
|
||||
115,235, 95, 57,202,119, 91, 59, 85,236,119, 86, 57,202,115, 36, /* 0x 270 */
|
||||
15,182, 69,188, 80,141, 69,168, 80,255,117,136, 82,255,117, 12, /* 0x 280 */
|
||||
255, 85,156,131,196, 20,133,192,117, 56,139, 69,180, 57, 69,168, /* 0x 290 */
|
||||
117, 48,235, 8,139,125,136,139,117, 12,243,164,139, 85,180,139, /* 0x 2a0 */
|
||||
93,136,137,209,106, 91, 88,205,128,139, 69,184, 41, 69, 8, 1, /* 0x 2b0 */
|
||||
85,136, 41, 85,232, 1, 69, 12,131,125, 8, 0, 15,137,119,255, /* 0x 2c0 */
|
||||
255,255,141, 93,196,106, 10, 88,205,128,106,127, 91,106, 1, 88, /* 0x 2d0 */
|
||||
205,128,235,254,139, 93,148,106, 6, 88,205,128,133,192,117,226, /* 0x 2e0 */
|
||||
255,117, 28,255,117, 32,141,117,196, 86,232,173,253,255,255,133, /* 0x 2f0 */
|
||||
192,120,207,106, 2, 88,205,128,133,192,117, 51,106, 2, 88,205, /* 0x 300 */
|
||||
128,133,192,137,193,117, 31,199, 69,160, 85, 80, 88, 52,184,162, /* 0x 310 */
|
||||
0, 0, 0,141, 93,160,199, 69,164, 0, 0, 0, 0,205,128,137, /* 0x 320 */
|
||||
243,106, 10, 88,205,128, 49,219,106, 1, 88,205,128,235,254, 49, /* 0x 330 */
|
||||
201,131,203,255,137,202,106, 7, 88,205,128,141, 93,196,139, 77, /* 0x 340 */
|
||||
32,139, 85, 28,106, 11, 88,205,128,233,116,255,255,255, 0, 0, /* 0x 350 */
|
||||
87,137,215,106, 10,252, 89,232, 5, 0, 0, 0,136, 39,151, 95, /* 0x 360 */
|
||||
195,153,247,241, 82,133,192,116, 5,232,243,255,255,255, 88, 4, /* 0x 370 */
|
||||
48,170,195 /* 0x 380 */
|
||||
};
|
||||
|
|
|
@ -217,21 +217,19 @@ typedef int f_expand(
|
|||
**************************************************************************/
|
||||
|
||||
void upx_main(
|
||||
f_unfilter *const f_unf,
|
||||
unsigned cprLen,
|
||||
struct Extent xi,
|
||||
f_expand *const f_decompress,
|
||||
int junk2,
|
||||
char /*const*/ *cprSrc,
|
||||
f_unfilter *const f_unf,
|
||||
char *envp[],
|
||||
char *argv[],
|
||||
int argc
|
||||
) __asm__("upx_main");
|
||||
void upx_main(
|
||||
f_unfilter *const f_unf,
|
||||
unsigned cprLen,
|
||||
struct Extent xi,
|
||||
f_expand *const f_decompress,
|
||||
int junk,
|
||||
char /*const*/ *cprSrc,
|
||||
f_unfilter *const f_unf,
|
||||
char *envp[],
|
||||
char *argv[],
|
||||
int argc
|
||||
|
@ -244,10 +242,6 @@ void upx_main(
|
|||
unsigned char *buf;
|
||||
|
||||
char *tmpname;
|
||||
|
||||
struct Extent xi = { cprLen, cprSrc };
|
||||
|
||||
char *next_unmap = (char *)(PAGE_MASK & (unsigned)xi.buf);
|
||||
struct p_info header;
|
||||
|
||||
// temporary file name
|
||||
|
@ -380,7 +374,6 @@ void upx_main(
|
|||
for (;;)
|
||||
{
|
||||
struct b_info h;
|
||||
int i;
|
||||
|
||||
// Read and check block sizes.
|
||||
{
|
||||
|
@ -412,7 +405,7 @@ void upx_main(
|
|||
|
||||
if (h.sz_cpr < h.sz_unc) { // Decompress block.
|
||||
nrv_uint out_len;
|
||||
i = (*f_decompress)((unsigned char *)xi.buf, h.sz_cpr, buf, &out_len, h.b_method);
|
||||
int i = (*f_decompress)((unsigned char *)xi.buf, h.sz_cpr, buf, &out_len, h.b_method);
|
||||
if (i != 0 || out_len != (nrv_uint)h.sz_unc)
|
||||
goto error;
|
||||
// Right now, unfilter is combined with decompression.
|
||||
|
@ -457,14 +450,8 @@ void upx_main(
|
|||
for (;;)
|
||||
(void) exit(127);
|
||||
}
|
||||
|
||||
// We will never touch these pages again.
|
||||
i = (PAGE_MASK & (unsigned)xi.buf) - (unsigned)next_unmap;
|
||||
munmap(next_unmap, i);
|
||||
next_unmap += i;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// ----- Step 5: release resources -----
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue
Block a user