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

mipsel stub system calls

This commit is contained in:
John Reiser 2007-05-08 10:41:13 -07:00
parent f252f824a4
commit 748c4bf780
8 changed files with 955 additions and 789 deletions

View File

@ -1607,7 +1607,6 @@ void PackLinuxElf32mipsel::defineSymbols(Filter const * /*ft*/)
adrc = page_mask & (~page_mask + adrc); // round up to page boundary
linker->defineSymbol("ADRX", adrx); // compressed input for eXpansion
linker->defineSymbol("LENX", 0x2345); // FIXME
// For actual moving, we need the true count, which depends on sz_pack2
// and is not yet known. So the runtime stub detects "no move"

View File

@ -858,7 +858,10 @@ tmp/mipsel.r3000-linux.elf-fold.o : $(srcdir)/src/$$T.S
$(call tc,f-objstrip,$@)
tmp/mipsel.r3000-linux.elf-main.o : $(srcdir)/src/$$T.c
$(call tc,gcc) -c -Os $< -o $@
$(call tc,gcc) -S -Os $< -o tmp/$T.i
sed -e 's/ j[ ][ ]*$$L/ b $$L/' \
-e 's/ jal[ ][ ]*\([^\$$]\)/ bal \1/' <tmp/$T.i >tmp/$T.s
$(call tc,gcc) -c -Wa,-O,-mno-pdr tmp/$T.s -o $@
$(call tc,f-objstrip,$@)
$(call tc,objdump) -dr $(tc_objdump_disasm_options) $@ | $(RTRIM) > $@.disasm

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* mipsel.r3000-linux.elf-fold.h
created from mipsel.r3000-linux.elf-fold.bin, 2156 (0x86c) bytes
created from mipsel.r3000-linux.elf-fold.bin, 2220 (0x8ac) bytes
This file is part of the UPX executable compressor.
@ -28,24 +28,24 @@
*/
#define STUB_MIPSEL_R3000_LINUX_ELF_FOLD_SIZE 2156
#define STUB_MIPSEL_R3000_LINUX_ELF_FOLD_ADLER32 0xec0ece82
#define STUB_MIPSEL_R3000_LINUX_ELF_FOLD_CRC32 0x4aec17ef
#define STUB_MIPSEL_R3000_LINUX_ELF_FOLD_SIZE 2220
#define STUB_MIPSEL_R3000_LINUX_ELF_FOLD_ADLER32 0xb56ef961
#define STUB_MIPSEL_R3000_LINUX_ELF_FOLD_CRC32 0x114d0ba9
unsigned char stub_mipsel_r3000_linux_elf_fold[2156] = {
unsigned char stub_mipsel_r3000_linux_elf_fold[2220] = {
127, 69, 76, 70, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 0 */
2, 0, 8, 0, 1, 0, 0, 0,128, 0, 16, 0, 52, 0, 0, 0, /* 0x 10 */
0, 0, 0, 0, 1, 48, 0, 0, 52, 0, 32, 0, 2, 0, 0, 0, /* 0x 20 */
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, /* 0x 30 */
0, 0, 16, 0,108, 8, 0, 0,112, 8, 0, 0, 5, 0, 0, 0, /* 0x 40 */
0, 16, 0, 0, 1, 0, 0, 0,108, 8, 0, 0, 0, 0, 0, 0, /* 0x 50 */
0, 0, 16, 0,172, 8, 0, 0,176, 8, 0, 0, 5, 0, 0, 0, /* 0x 40 */
0, 16, 0, 0, 1, 0, 0, 0,172, 8, 0, 0, 0, 0, 0, 0, /* 0x 50 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 60 */
0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 70 */
36, 0,167, 39, 0, 0,225,140, 4, 0,231, 36,253,255, 32, 20, /* 0x 80 */
33, 72, 0, 0, 0, 0,225,140, 4, 0,231, 36,253,255, 32, 20, /* 0x 90 */
33, 64,224, 2, 32,252,189, 39, 33, 48,160, 3, 33, 40, 32, 2, /* 0x a0 */
1, 0, 17, 4,184, 0, 2, 36, 35, 16,226, 3,196, 6, 66, 36, /* 0x b0 */
9,248, 64, 0, 33, 32, 0, 2, 0, 4,189, 39, 33, 32, 96, 2, /* 0x c0 */
33, 64,224, 2, 32,252,189, 39, 33, 48,160, 3,116,255,165, 38, /* 0x a0 */
1, 0, 17, 4,184, 0, 2, 36, 35, 16,226, 3, 36, 7, 66, 36, /* 0x b0 */
9,248, 64, 0, 33, 32, 32, 2, 0, 4,189, 39, 33, 32, 96, 2, /* 0x c0 */
33, 40, 64, 2, 8, 0,128, 2, 33,248, 64, 0,255,255, 4, 36, /* 0x d0 */
161, 15, 2, 36, 13, 0, 0, 0, 12, 0, 0, 0, 0,240, 65, 44, /* 0x e0 */
255,255, 33, 36, 8, 0,224, 3, 37, 16, 65, 0,249,255, 0, 16, /* 0x f0 */
@ -54,118 +54,122 @@ unsigned char stub_mipsel_r3000_linux_elf_fold[2156] = {
251, 15, 2, 36,239,255, 0, 16, 29, 16, 2, 36, 13, 0, 0, 0, /* 0x 120 */
224,255,189, 39, 16, 0,168,175, 20, 0,169,175,250, 15, 2, 36, /* 0x 130 */
12, 0, 0, 0,233,255, 0, 16, 32, 0,189, 39, 0, 0, 0, 0, /* 0x 140 */
14, 0,128, 16, 1, 0, 3, 36, 0, 0,130,140, 0, 0, 0, 0, /* 0x 150 */
5, 0, 69, 16, 0, 0, 0, 0, 6, 0, 67, 20, 0, 0, 0, 0, /* 0x 160 */
4, 0,160, 16, 0, 0, 0, 0, 4, 0,134,172, 8, 0,224, 3, /* 0x 170 */
0, 0,133,172, 86, 0, 4, 8, 8, 0,132, 36, 8, 0,224, 3, /* 0x 180 */
0, 0, 0, 0,248,255,189, 39, 0, 0,191,175, 0, 0,130,140, /* 0x 190 */
4, 0,135,140, 43, 16, 70, 0, 7, 0, 64, 16, 33, 24,192, 0, /* 0x 1a0 */
56, 0, 4, 12,127, 0, 4, 36, 0, 0,226,144, 1, 0,231, 36, /* 0x 1b0 */
0, 0,162,160, 1, 0,165, 36,255,255, 99, 36,255,255, 2, 36, /* 0x 1c0 */
249,255, 98, 20, 0, 0, 0, 0, 4, 0,131,140, 0, 0,130,140, /* 0x 1d0 */
33, 24,102, 0, 35, 16, 70, 0, 0, 0,130,172, 4, 0,131,172, /* 0x 1e0 */
0, 0,191,143, 0, 0, 0, 0, 8, 0,224, 3, 8, 0,189, 39, /* 0x 1f0 */
216,255,189, 39, 28, 0,179,175, 24, 0,178,175, 20, 0,177,175, /* 0x 200 */
16, 0,176,175, 33,136,128, 0, 33,128,160, 0, 33,152,192, 0, /* 0x 210 */
33,144,224, 0,216, 0, 4, 8, 32, 0,191,175, 33, 32, 32, 2, /* 0x 220 */
101, 0, 4, 12, 4, 0,165, 39, 4, 0,163,143, 8, 0,166,143, /* 0x 230 */
10, 0, 96, 20, 88, 33, 2, 60, 85, 80, 66, 52, 9, 0,194, 20, /* 0x 240 */
0, 0, 0, 0, 0, 0, 34,142, 0, 0, 0, 0, 5, 0, 64, 20, /* 0x 250 */
0, 0, 0, 0,220, 0, 4, 8, 0, 0, 0, 0, 3, 0,192, 20, /* 0x 260 */
43, 16,102, 0, 56, 0, 4, 12,127, 0, 4, 36,253,255, 64, 20, /* 0x 270 */
0, 0, 0, 0, 0, 0, 2,142, 0, 0, 0, 0, 43, 16, 67, 0, /* 0x 280 */
248,255, 64, 20, 43, 16,195, 0, 4, 0, 7,142, 39, 0, 64, 16, /* 0x 290 */
33, 40,224, 0, 4, 0, 36,142, 12, 0,168,143, 33, 40,192, 0, /* 0x 2a0 */
0, 0,163,175, 33, 48,224, 0, 9,248, 96, 2, 33, 56,160, 3, /* 0x 2b0 */
236,255, 64, 20, 0, 0, 0, 0, 0, 0,165,143, 4, 0,162,143, /* 0x 2c0 */
0, 0, 0, 0,231,255,162, 20, 0, 0, 0, 0, 13, 0,167,147, /* 0x 2d0 */
0, 0, 0, 0, 13, 0,224, 16, 0, 0, 0, 0, 11, 0, 64, 18, /* 0x 2e0 */
1, 2,162, 44, 5, 0, 64, 16, 0, 0, 0, 0, 0, 0, 2,142, /* 0x 2f0 */
0, 0, 0, 0, 5, 0, 69, 20, 0, 0, 0, 0, 4, 0, 4,142, /* 0x 300 */
14, 0,166,147, 9,248, 64, 2, 0, 0, 0, 0, 8, 0,162,143, /* 0x 310 */
4, 0, 35,142, 0, 0, 36,142, 33, 24, 98, 0, 35, 32,130, 0, /* 0x 320 */
4, 0, 35,174,209, 0, 4, 8, 0, 0, 36,174,101, 0, 4, 12, /* 0x 330 */
33, 32, 32, 2, 4, 0,162,143, 4, 0, 3,142, 0, 0, 4,142, /* 0x 340 */
33, 24, 98, 0, 35, 32,130, 0, 4, 0, 3,174, 0, 0, 4,174, /* 0x 350 */
0, 0, 2,142, 0, 0, 0, 0,176,255, 64, 20, 12, 0, 6, 36, /* 0x 360 */
32, 0,191,143, 28, 0,179,143, 24, 0,178,143, 20, 0,177,143, /* 0x 370 */
16, 0,176,143, 8, 0,224, 3, 40, 0,189, 39,176,255,189, 39, /* 0x 380 */
72, 0,190,175, 64, 0,182,175, 44, 0,177,175, 40, 0,176,175, /* 0x 390 */
76, 0,191,175, 68, 0,183,175, 60, 0,181,175, 56, 0,180,175, /* 0x 3a0 */
52, 0,179,175, 48, 0,178,175, 16, 0,162,148, 28, 0,163,140, /* 0x 3b0 */
33,176,160, 0, 2, 0, 66, 56, 44, 0,165,148, 33,136,195, 2, /* 0x 3c0 */
1, 0, 66, 44, 24, 0,164,175, 33,240,192, 0, 28, 0,167,175, /* 0x 3d0 */
32, 0,168,175, 0, 57, 2, 0,255,255,165, 36, 33, 32, 32, 2, /* 0x 3e0 */
255,255, 16, 36, 33, 48, 0, 0, 1, 0, 8, 36, 20, 1, 4, 8, /* 0x 3f0 */
36, 0,169,175, 0, 0,130,140, 0, 0, 0, 0, 14, 0, 72, 20, /* 0x 400 */
0, 0, 0, 0, 8, 0,131,140, 0, 0, 0, 0, 43, 16,112, 0, /* 0x 410 */
2, 0, 64, 16, 0, 0, 0, 0, 33,128, 96, 0, 20, 0,130,140, /* 0x 420 */
0, 0, 0, 0, 33, 24, 98, 0, 43, 16,195, 0, 2, 0, 64, 16, /* 0x 430 */
0, 0, 0, 0, 33, 48, 96, 0, 32, 0,132, 36,255,255,165, 36, /* 0x 440 */
236,255,161, 4,255,255, 3, 52,255,255, 4, 60, 36,128, 4, 2, /* 0x 450 */
35, 16,208, 0, 33, 16, 67, 0, 36, 16, 68, 0, 34, 0,231, 36, /* 0x 460 */
33, 32, 0, 2, 33, 40, 64, 0, 33, 48, 0, 0,255,255, 8, 36, /* 0x 470 */
33, 72, 0, 0, 75, 0, 4, 12, 8, 0,162,175, 35,184, 80, 0, /* 0x 480 */
12, 0,162,175,130, 1, 4, 8, 16, 0,160,175, 0, 0, 35,142, /* 0x 490 */
0, 0, 0, 0, 8, 0, 98, 20, 1, 0, 2, 36, 8, 0, 38,142, /* 0x 4a0 */
28, 0,164,143, 33, 48,230, 2, 84, 0, 4, 12, 3, 0, 5, 36, /* 0x 4b0 */
126, 1, 4, 8, 0, 0, 0, 0, 75, 0, 98, 20, 0, 0, 0, 0, /* 0x 4c0 */
8, 0, 34,142, 24, 0, 35,142, 33,168,226, 2, 81,115, 2, 60, /* 0x 4d0 */
128, 24, 3, 0, 64, 98, 66, 52, 6, 16, 98, 0, 16, 0, 42,142, /* 0x 4e0 */
7, 0, 82, 48, 20, 0, 34,142,255,255,163, 50, 20, 0,162,175, /* 0x 4f0 */
33,152, 67, 1, 93, 0,192, 19, 35,160,163, 2, 2, 0, 70, 54, /* 0x 500 */
255,255, 8, 36, 50, 0, 7, 36, 4, 0, 41,142, 33, 32,128, 2, /* 0x 510 */
35, 72, 35, 1, 33, 40, 96, 2, 0, 0,170,175, 75, 0, 4, 12, /* 0x 520 */
4, 0,181,175, 31, 0,130, 22, 0, 0, 0, 0, 11, 0,192, 19, /* 0x 530 */
4, 0, 66, 50, 4, 0, 64, 16, 0, 0, 0, 0, 36, 0,167,143, /* 0x 540 */
87, 1, 4, 8, 0, 0, 0, 0, 33, 56, 0, 0, 24, 0,166,143, /* 0x 550 */
33, 32,192, 3,128, 0, 4, 12, 33, 40,160, 3, 35, 16, 19, 0, /* 0x 560 */
2, 0, 67, 50, 8, 0, 96, 16,255,255, 80, 48, 6, 0, 0, 18, /* 0x 570 */
33, 24,147, 2, 33, 16, 0, 2,255,255, 66, 36, 0, 0, 96,160, /* 0x 580 */
253,255, 64, 20, 1, 0, 99, 36, 8, 0,192, 19, 33, 32,128, 2, /* 0x 590 */
33, 40, 96, 2, 73, 0, 4, 12, 33, 48, 64, 2, 3, 0, 64, 16, /* 0x 5a0 */
0, 0, 0, 0, 56, 0, 4, 12,127, 0, 4, 36, 20, 0,163,143, /* 0x 5b0 */
33, 16,112, 2, 33, 40,163, 2, 33,128,130, 2, 43, 16, 5, 2, /* 0x 5c0 */
9, 0, 64, 16, 35, 40,176, 0, 33, 48, 64, 2, 33, 32, 0, 2, /* 0x 5d0 */
50, 0, 7, 36,255,255, 8, 36, 75, 0, 4, 12, 33, 72, 0, 0, /* 0x 5e0 */
240,255, 2, 22, 0, 0, 0, 0, 16, 0,162,143, 32, 0, 49, 38, /* 0x 5f0 */
1, 0, 66, 36, 16, 0,162,175, 44, 0,194,150, 16, 0,163,143, /* 0x 600 */
0, 0, 0, 0, 42, 16, 98, 0,160,255, 64, 20, 6, 0, 2, 36, /* 0x 610 */
8, 0,192, 23, 3, 0, 2, 36, 24, 0,164,143, 67, 0, 4, 12, /* 0x 620 */
0, 0, 0, 0,223,255, 64, 20, 0, 0, 0, 0,153, 1, 4, 8, /* 0x 630 */
0, 0, 0, 0, 16, 0,195,150, 0, 0, 0, 0, 5, 0, 98, 16, /* 0x 640 */
0, 0, 0, 0, 12, 0,162,143, 8, 0,163,143, 69, 0, 4, 12, /* 0x 650 */
33, 32, 67, 0, 32, 0,162,143, 0, 0, 0, 0, 7, 0, 64, 16, /* 0x 660 */
0, 0, 0, 0,163, 1, 4, 8, 0, 0, 87,172, 24, 0,168,143, /* 0x 670 */
33, 48, 64, 2, 70, 1, 4, 8, 18, 0, 7, 36, 24, 0,194,142, /* 0x 680 */
76, 0,191,143, 33, 16,226, 2, 72, 0,190,143, 68, 0,183,143, /* 0x 690 */
64, 0,182,143, 60, 0,181,143, 56, 0,180,143, 52, 0,179,143, /* 0x 6a0 */
48, 0,178,143, 44, 0,177,143, 40, 0,176,143, 8, 0,224, 3, /* 0x 6b0 */
80, 0,189, 39,192,255,189, 39, 60, 0,191,175, 52, 0,181,175, /* 0x 6c0 */
48, 0,180,175, 44, 0,179,175, 40, 0,178,175, 32, 0,176,175, /* 0x 6d0 */
56, 0,182,175, 36, 0,177,175, 4, 0, 22,141, 0, 0, 49,141, /* 0x 6e0 */
0, 0, 3,141, 4, 0, 34,141, 4, 0,180, 39, 33,128,128, 0, /* 0x 6f0 */
33,144,160, 0, 33,168,224, 0, 33, 32,128, 2, 33, 56, 0, 0, /* 0x 700 */
12, 0,165, 39, 24, 0,170,175, 12, 0,163,175, 33,152,192, 0, /* 0x 710 */
8, 0,162,175, 4, 0,177,175,128, 0, 4, 12, 16, 0,182,175, /* 0x 720 */
8, 0,162,143, 44, 0,198,150, 35, 16, 81, 0, 5, 0, 5, 36, /* 0x 730 */
33, 32, 0, 2, 8, 0,162,175, 84, 0, 4, 12, 4, 0,178,175, /* 0x 740 */
42, 0,198,150, 33, 32, 0, 2, 84, 0, 4, 12, 4, 0, 5, 36, /* 0x 750 */
52, 0,210, 38, 24, 0,166,143, 8, 0, 66,142, 52, 0,198, 36, /* 0x 760 */
33, 48,194, 0, 33, 32, 0, 2, 84, 0, 4, 12, 3, 0, 5, 36, /* 0x 770 */
33, 32, 96, 2, 33, 40,192, 2, 33, 48,128, 2, 33, 56, 0, 2, /* 0x 780 */
33, 64,160, 3,227, 0, 4, 12, 33, 72,160, 2, 33, 48, 64, 0, /* 0x 790 */
33, 32, 0, 2, 9, 0, 5, 36, 84, 0, 4, 12, 33,136, 64, 0, /* 0x 7a0 */
44, 0,197,150, 13, 2, 4, 8, 33, 32, 0, 0, 0, 0, 67,142, /* 0x 7b0 */
0, 0, 0, 0, 26, 0, 98, 20, 1, 0,132, 36, 8, 0, 66,142, /* 0x 7c0 */
0, 0,164,143, 33, 40, 0, 0, 33, 32, 68, 0, 65, 0, 4, 12, /* 0x 7d0 */
33, 48, 0, 0, 8, 0, 64, 4, 33,128, 64, 0, 33, 32, 64, 0, /* 0x 7e0 */
33, 40,192, 2, 63, 0, 4, 12, 0, 2, 6, 36, 0, 2, 3, 36, /* 0x 7f0 */
3, 0, 67, 16, 33, 48, 0, 0, 56, 0, 4, 12,127, 0, 4, 36, /* 0x 800 */
33, 32, 0, 2, 33, 40,192, 2, 33, 56, 0, 0, 33, 64, 0, 0, /* 0x 810 */
227, 0, 4, 12, 33, 72, 0, 0, 16, 2, 4, 8, 33,136, 64, 0, /* 0x 820 */
32, 0, 82, 38, 42, 16,133, 0,224,255, 64, 20, 3, 0, 2, 36, /* 0x 830 */
33, 16, 32, 2, 60, 0,191,143, 56, 0,182,143, 52, 0,181,143, /* 0x 840 */
48, 0,180,143, 44, 0,179,143, 40, 0,178,143, 36, 0,177,143, /* 0x 850 */
32, 0,176,143, 8, 0,224, 3, 64, 0,189, 39 /* 0x 860 */
250, 15, 2, 36,224,255,189, 39, 16, 0,168,175, 20, 0,169,175, /* 0x 150 */
12, 0, 0, 0, 2, 0, 0, 16, 32, 0,189, 39, 12, 0, 0, 0, /* 0x 160 */
3, 0,224, 20,255,255, 3, 36, 8, 0,224, 3, 0, 0, 0, 0, /* 0x 170 */
8, 0,224, 3, 37, 16, 67, 0, 8, 0,224, 3, 0, 0, 0, 0, /* 0x 180 */
0, 0,130,140, 4, 0,135,140, 43, 16, 70, 0, 3, 0, 64, 20, /* 0x 190 */
161, 15, 2, 36, 10, 0, 0, 16, 33, 24,192, 0,127, 0, 4, 36, /* 0x 1a0 */
238,255, 17, 4, 0, 0, 0, 0,255,255, 0, 16, 0, 0, 0, 0, /* 0x 1b0 */
0, 0,226,144, 1, 0,231, 36, 0, 0,162,160, 1, 0,165, 36, /* 0x 1c0 */
255,255, 99, 36,255,255, 2, 36,249,255, 98, 20, 0, 0, 0, 0, /* 0x 1d0 */
4, 0,131,140, 0, 0,130,140, 33, 24,102, 0, 35, 16, 70, 0, /* 0x 1e0 */
0, 0,130,172, 8, 0,224, 3, 4, 0,131,172,216,255,189, 39, /* 0x 1f0 */
28, 0,179,175, 24, 0,178,175, 20, 0,177,175, 16, 0,176,175, /* 0x 200 */
33,136,128, 0, 33,128,160, 0, 33,152,192, 0, 33,144,224, 0, /* 0x 210 */
82, 0, 0, 16, 32, 0,191,175, 33, 32, 32, 2,216,255, 17, 4, /* 0x 220 */
4, 0,165, 39, 4, 0,163,143, 8, 0,166,143, 10, 0, 96, 20, /* 0x 230 */
88, 33, 2, 60, 85, 80, 66, 52, 10, 0,194, 20,127, 0, 4, 36, /* 0x 240 */
0, 0, 34,142, 0, 0, 0, 0, 7, 0, 64, 20,161, 15, 2, 36, /* 0x 250 */
70, 0, 0, 16, 0, 0, 0, 0, 7, 0,192, 20, 43, 16,102, 0, /* 0x 260 */
127, 0, 4, 36,161, 15, 2, 36,188,255, 17, 4, 0, 0, 0, 0, /* 0x 270 */
255,255, 0, 16, 0, 0, 0, 0,250,255, 64, 20,127, 0, 4, 36, /* 0x 280 */
0, 0, 2,142, 0, 0, 0, 0, 43, 16, 67, 0,245,255, 64, 20, /* 0x 290 */
43, 16,195, 0, 4, 0, 7,142, 39, 0, 64, 16, 33, 40,224, 0, /* 0x 2a0 */
4, 0, 36,142, 12, 0,168,143, 33, 40,192, 0, 0, 0,163,175, /* 0x 2b0 */
33, 48,224, 0, 9,248, 96, 2, 33, 56,160, 3,233,255, 64, 20, /* 0x 2c0 */
127, 0, 4, 36, 0, 0,165,143, 4, 0,162,143, 0, 0, 0, 0, /* 0x 2d0 */
228,255,162, 20, 0, 0, 0, 0, 13, 0,167,147, 0, 0, 0, 0, /* 0x 2e0 */
13, 0,224, 16, 0, 0, 0, 0, 11, 0, 64, 18, 1, 2,162, 44, /* 0x 2f0 */
5, 0, 64, 16, 0, 0, 0, 0, 0, 0, 2,142, 0, 0, 0, 0, /* 0x 300 */
5, 0, 69, 20, 0, 0, 0, 0, 4, 0, 4,142, 14, 0,166,147, /* 0x 310 */
9,248, 64, 2, 0, 0, 0, 0, 8, 0,162,143, 4, 0, 35,142, /* 0x 320 */
0, 0, 36,142, 33, 24, 98, 0, 35, 32,130, 0, 4, 0, 35,174, /* 0x 330 */
3, 0, 0, 16, 0, 0, 36,174,145,255, 17, 4, 33, 32, 32, 2, /* 0x 340 */
4, 0,162,143, 4, 0, 3,142, 0, 0, 4,142, 33, 24, 98, 0, /* 0x 350 */
35, 32,130, 0, 4, 0, 3,174, 0, 0, 4,174, 0, 0, 2,142, /* 0x 360 */
0, 0, 0, 0,172,255, 64, 20, 12, 0, 6, 36, 32, 0,191,143, /* 0x 370 */
28, 0,179,143, 24, 0,178,143, 20, 0,177,143, 16, 0,176,143, /* 0x 380 */
8, 0,224, 3, 40, 0,189, 39, 14, 0,128, 16, 1, 0, 3, 36, /* 0x 390 */
0, 0,130,140, 0, 0, 0, 0, 5, 0, 69, 16, 0, 0, 0, 0, /* 0x 3a0 */
6, 0, 67, 20, 0, 0, 0, 0, 4, 0,160, 16, 0, 0, 0, 0, /* 0x 3b0 */
4, 0,134,172, 8, 0,224, 3, 0, 0,133,172,244,255, 0, 16, /* 0x 3c0 */
8, 0,132, 36, 8, 0,224, 3, 0, 0, 0, 0,176,255,189, 39, /* 0x 3d0 */
72, 0,190,175, 68, 0,183,175, 60, 0,181,175, 44, 0,177,175, /* 0x 3e0 */
40, 0,176,175, 76, 0,191,175, 64, 0,182,175, 56, 0,180,175, /* 0x 3f0 */
52, 0,179,175, 48, 0,178,175, 16, 0,162,148, 28, 0,163,140, /* 0x 400 */
33,168,160, 0, 2, 0, 66, 56, 44, 0,165,148, 33,136,163, 2, /* 0x 410 */
1, 0, 66, 44, 33,240,128, 0, 33,184,192, 0, 24, 0,167,175, /* 0x 420 */
28, 0,168,175, 0, 57, 2, 0,255,255,165, 36, 33, 32, 32, 2, /* 0x 430 */
255,255, 16, 36, 33, 48, 0, 0, 1, 0, 8, 36, 19, 0, 0, 16, /* 0x 440 */
32, 0,169,175, 0, 0,130,140, 0, 0, 0, 0, 14, 0, 72, 20, /* 0x 450 */
255,255,165, 36, 8, 0,131,140, 0, 0, 0, 0, 43, 16,112, 0, /* 0x 460 */
2, 0, 64, 16, 0, 0, 0, 0, 33,128, 96, 0, 20, 0,130,140, /* 0x 470 */
0, 0, 0, 0, 33, 24, 98, 0, 43, 16,195, 0, 2, 0, 64, 16, /* 0x 480 */
0, 0, 0, 0, 33, 48, 96, 0, 32, 0,132, 36,237,255,161, 4, /* 0x 490 */
255,255, 3, 52,255,255, 4, 60, 36,128, 4, 2, 35, 16,208, 0, /* 0x 4a0 */
33, 16, 67, 0, 36, 16, 68, 0, 2, 8,231, 36, 33, 32, 0, 2, /* 0x 4b0 */
33, 40, 64, 0, 33, 48, 0, 0,255,255, 8, 36, 33, 72, 0, 0, /* 0x 4c0 */
31,255, 17, 4, 8, 0,162,175, 35,176, 80, 0, 12, 0,162,175, /* 0x 4d0 */
95, 0, 0, 16, 16, 0,160,175, 0, 0, 35,142, 0, 0, 0, 0, /* 0x 4e0 */
8, 0, 98, 20, 1, 0, 2, 36, 8, 0, 38,142, 24, 0,164,143, /* 0x 4f0 */
33, 48,198, 2,164,255, 17, 4, 3, 0, 5, 36, 80, 0, 0, 16, /* 0x 500 */
0, 0, 0, 0, 78, 0, 98, 20, 0, 0, 0, 0, 8, 0, 34,142, /* 0x 510 */
24, 0, 35,142, 33,160,194, 2, 81,115, 2, 60,128, 24, 3, 0, /* 0x 520 */
64, 98, 66, 52, 6, 16, 98, 0, 16, 0, 42,142, 7, 0, 82, 48, /* 0x 530 */
20, 0, 34,142,255,255,131, 50, 20, 0,162,175, 33,128, 67, 1, /* 0x 540 */
98, 0,224, 18, 35,152,131, 2, 2, 0, 70, 54,255,255, 8, 36, /* 0x 550 */
18, 8, 7, 36, 4, 0, 41,142, 33, 32, 96, 2, 35, 72, 35, 1, /* 0x 560 */
33, 40, 0, 2, 0, 0,170,175,245,254, 17, 4, 4, 0,180,175, /* 0x 570 */
31, 0, 98, 22,127, 0, 4, 36, 10, 0,224, 18, 4, 0, 66, 50, /* 0x 580 */
4, 0, 64, 16, 33, 32,224, 2, 32, 0,167,143, 3, 0, 0, 16, /* 0x 590 */
33, 40,160, 3, 33, 56, 0, 0, 33, 40,160, 3, 19,255, 17, 4, /* 0x 5a0 */
33, 48,192, 3, 35, 16, 16, 0, 2, 0, 67, 50, 8, 0, 96, 16, /* 0x 5b0 */
255,255, 71, 48, 6, 0,224, 16, 33, 16,224, 0, 33, 24,112, 2, /* 0x 5c0 */
255,255, 66, 36, 0, 0, 96,160,253,255, 64, 20, 1, 0, 99, 36, /* 0x 5d0 */
12, 0,224, 18, 33, 32, 96, 2, 33, 40, 0, 2, 33, 48, 64, 2, /* 0x 5e0 */
222,254, 17, 4, 29, 16, 2, 36, 6, 0, 64, 16,127, 0, 4, 36, /* 0x 5f0 */
161, 15, 2, 36,217,254, 17, 4, 0, 0, 0, 0,255,255, 0, 16, /* 0x 600 */
0, 0, 0, 0, 20, 0,163,143, 33, 16, 7, 2, 33, 40,131, 2, /* 0x 610 */
33,128, 98, 2, 43, 16, 5, 2, 9, 0, 64, 16, 35, 40,176, 0, /* 0x 620 */
33, 48, 64, 2, 33, 32, 0, 2, 18, 8, 7, 36,255,255, 8, 36, /* 0x 630 */
195,254, 17, 4, 33, 72, 0, 0,237,255, 2, 22,127, 0, 4, 36, /* 0x 640 */
16, 0,162,143, 32, 0, 49, 38, 1, 0, 66, 36, 16, 0,162,175, /* 0x 650 */
44, 0,162,150, 16, 0,163,143, 0, 0, 0, 0, 42, 16, 98, 0, /* 0x 660 */
157,255, 64, 20, 6, 0, 2, 36, 8, 0,224, 22, 3, 0, 2, 36, /* 0x 670 */
33, 32,192, 3,185,254, 17, 4,166, 15, 2, 36,220,255, 64, 20, /* 0x 680 */
127, 0, 4, 36, 11, 0, 0, 16, 0, 0, 0, 0, 16, 0,163,150, /* 0x 690 */
0, 0, 0, 0, 7, 0, 98, 16, 0, 0, 0, 0, 12, 0,162,143, /* 0x 6a0 */
8, 0,163,143, 0, 0, 0, 0, 33, 32, 67, 0,171,254, 17, 4, /* 0x 6b0 */
205, 15, 2, 36, 28, 0,162,143, 0, 0, 0, 0, 7, 0, 64, 16, /* 0x 6c0 */
0, 0, 0, 0, 5, 0, 0, 16, 0, 0, 86,172, 33, 48, 64, 2, /* 0x 6d0 */
33, 64,192, 3,159,255, 0, 16, 18, 0, 7, 36, 24, 0,162,142, /* 0x 6e0 */
76, 0,191,143, 33, 16,194, 2, 72, 0,190,143, 68, 0,183,143, /* 0x 6f0 */
64, 0,182,143, 60, 0,181,143, 56, 0,180,143, 52, 0,179,143, /* 0x 700 */
48, 0,178,143, 44, 0,177,143, 40, 0,176,143, 8, 0,224, 3, /* 0x 710 */
80, 0,189, 39,200,255,189, 39, 52, 0,191,175, 48, 0,180,175, /* 0x 720 */
44, 0,179,175, 40, 0,178,175, 36, 0,177,175, 32, 0,176,175, /* 0x 730 */
33,136, 0, 1, 0, 0,136,140, 33, 24,160, 0, 33, 16,128, 0, /* 0x 740 */
33,160,192, 0, 33,128,224, 0, 33, 48, 32, 2, 33, 56, 0, 0, /* 0x 750 */
4, 0,165, 39, 20, 0,164, 39, 20, 0,163,175, 12, 0,163,175, /* 0x 760 */
4, 0,168,175, 24, 0,162,175, 33,144, 32, 1, 16, 0,162,175, /* 0x 770 */
158,254, 17, 4, 8, 0,180,175, 44, 0,134,150, 33, 32, 0, 2, /* 0x 780 */
1,255, 17, 4, 5, 0, 5, 36, 42, 0,134,150, 33, 32, 0, 2, /* 0x 790 */
4, 0, 5, 36,252,254, 17, 4, 52, 0,147, 38, 8, 0,102,142, /* 0x 7a0 */
33, 32, 0, 2, 52, 0,198, 36,247,254, 17, 4, 3, 0, 5, 36, /* 0x 7b0 */
33, 32, 32, 2, 33, 40,128, 2, 33, 72, 64, 2, 12, 0,166, 39, /* 0x 7c0 */
33, 56, 0, 2, 1,255, 17, 4, 33, 64,160, 3, 33, 48, 64, 0, /* 0x 7d0 */
33, 32, 0, 2, 9, 0, 5, 36,235,254, 17, 4, 33,136, 64, 0, /* 0x 7e0 */
44, 0,133,150, 33, 0, 0, 16, 33, 32, 0, 0, 0, 0, 99,142, /* 0x 7f0 */
3, 0, 2, 36, 29, 0, 98, 20, 32, 0,115, 38,224,255,115, 38, /* 0x 800 */
8, 0, 98,142, 0, 0,164,143, 33, 40, 0, 0, 33, 32, 68, 0, /* 0x 810 */
33, 48, 0, 0, 81,254, 17, 4,165, 15, 2, 36, 8, 0, 64, 4, /* 0x 820 */
33, 32, 64, 0, 33, 40,128, 2, 0, 2, 6, 36, 75,254, 17, 4, /* 0x 830 */
163, 15, 2, 36, 0, 2, 3, 36, 6, 0, 67, 16, 33, 48, 0, 0, /* 0x 840 */
127, 0, 4, 36, 69,254, 17, 4,161, 15, 2, 36,255,255, 0, 16, /* 0x 850 */
0, 0, 0, 0, 33, 56, 0, 0, 33, 64, 0, 0,219,254, 17, 4, /* 0x 860 */
33, 72, 0, 0, 4, 0, 0, 16, 33,136, 64, 0, 42, 16,133, 0, /* 0x 870 */
222,255, 64, 20, 1, 0,132, 36, 33, 16, 32, 2, 52, 0,191,143, /* 0x 880 */
48, 0,180,143, 44, 0,179,143, 40, 0,178,143, 36, 0,177,143, /* 0x 890 */
32, 0,176,143, 8, 0,224, 3, 56, 0,189, 39 /* 0x 8a0 */
};

View File

@ -351,6 +351,175 @@ static inline _syscall1(int,unlink,const char *,file)
#undef Z0
#undef Z1
#elif defined(__mips__) /*}{*/
#undef MAP_ANONYMOUS
#define MAP_ANONYMOUS 0x800
/* Cannot write an inline assembler constraint for a specific register.
http://gcc.gnu.org/ml/gcc-help/2007-02/msg00068.html
Workaround:
const register int num asm("v0") = 4;
const register char *const str asm("a0") = string;
asm volatile("syscall" : : "r"(num), "r"(str));
*/
static void *mmap(
void *addr, size_t len,
int prot, int flags,
int fd, off_t offset
)
{
#define __NR_mmap (90+ 4000)
register void * const a0 asm("a0") = addr;
register size_t const a1 asm("a1") = len;
register int const a2 asm("a2") = prot;
register int const a3 asm("a3") = flags;
register int const t0 asm("t0") = fd;
register off_t const t1 asm("t1") = offset;
register int v0 asm("v0") = __NR_mmap;
__asm__ __volatile__(
/*"break\n"*/ /* debug only */
"addiu $29,$29,-0x20\n"
"sw $8,0x10($29)\n"
"sw $9,0x14($29)\n"
"syscall\n"
"addiu $29,$29, 0x20\n"
"b sysret\n"
"sysgo:"
/*"break\n"*/ /* debug only */
"syscall\n"
"sysret:"
"li $3,~0\n"
"bnez $7,sysbad\n"
"jr $31\n"
"sysbad:"
"or $2,$2,$3\n"
"jr $31"
: "=r"(v0)
: "r"(v0), "r"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(t0), "r"(t1)
);
return (void *)v0;
}
static ssize_t read(int fd, void *buf, size_t len)
{
#define __NR_read (3+ 4000)
register int const a0 asm("a0") = fd;
register void * const a1 asm("a1") = buf;
register size_t const a2 asm("a2") = len;
register size_t v0 asm("v0");
__asm__ __volatile__(
"bal sysgo"
: "=r"(v0)
: [v0] "r"(__NR_read), "r"(a0), "r"(a1), "r"(a2)
);
return v0;
}
static void *brk(void *addr)
{
#define __NR_brk (45+ 4000)
register void *const a0 asm("a0") = addr;
register void * v0 asm("v0");
__asm__ __volatile__(
"bal sysgo"
: "=r"(v0)
: [v0] "r"(__NR_brk), "r"(a0)
);
return v0;
}
static int close(int fd)
{
#define __NR_close (6+ 4000)
register int const a0 asm("a0") = fd;
register int v0 asm("v0");
__asm__ __volatile__(
"bal sysgo"
: "=r"(v0)
: [v0] "r"(__NR_close), "r"(a0)
);
return v0;
}
static void exit(int code) __attribute__ ((__noreturn__));
static void exit(int code)
{
#define __NR_exit (1+ 4000)
register int const a0 asm("a0") = code;
register int v0 asm("v0");
__asm__ __volatile__(
"bal sysgo"
: "=r"(v0)
: [v0] "r"(__NR_exit), "r"(a0)
: "memory"
);
for (;;) {}
}
#if 0 /*{ UNUSED */
static int munmap(void *addr, size_t len)
{
#define __NR_munmap (91+ 4000)
register void *const a0 asm("a0") = addr;
register size_t const a1 asm("a2") = len;
register size_t v0 asm("v0");
__asm__ __volatile__(
"bal sysgo"
: "=r"(v0)
: [v0] "r"(__NR_munmap), "r"(a0), "r"(a1)
);
return v0;
}
#endif /*}*/
static int mprotect(void const *addr, size_t len, int prot)
{
#define __NR_mprotect (125+ 4000)
register void const *const a0 asm("a0") = addr;
register size_t const a1 asm("a1") = len;
register int const a2 asm("a2") = prot;
register size_t v0 asm("v0");
__asm__ __volatile__(
"bal sysgo"
: "=r"(v0)
: [v0] "r"(__NR_mprotect), "r"(a0), "r"(a1), "r"(a2)
);
return v0;
}
static ssize_t open(char const *path, int kind, int mode)
{
#define __NR_open (5+ 4000)
register char const *const a0 asm("a0") = path;
register int const a1 asm("a1") = kind;
register int const a2 asm("a2") = mode;
register size_t v0 asm("v0");
__asm__ __volatile__(
"bal sysgo"
: "=r"(v0)
: [v0] "r"(__NR_open), "r"(a0), "r"(a1), "r"(a2)
);
return v0;
}
#if 0 /*{ UNUSED */
static ssize_t write(int fd, void const *buf, size_t len)
{
#define __NR_write (4+ 4000)
register int const a0 asm("a0") = fd;
register void const * const a1 asm("a1") = buf;
register size_t const a2 asm("a2") = len;
register size_t v0 asm("v0");
__asm__ __volatile__(
"bal sysgo"
: "=r"(v0)
: [v0] "r"(__NR_write), "r"(a0), "r"(a1), "r"(a2)
);
return v0;
}
#endif /*}*/
#else /*}{ generic */
void *brk(void *);

View File

@ -76,9 +76,8 @@ adru: .long ADRU
adrc: .long ADRC
lenu: .long LENU
adrx: .long ADRX
lenx: .long LENX
_start: .globl _start
break
//// break # debug only
bal main
addiu s7,ra, decompressor - 0f // s7= &decompress
0:
@ -214,8 +213,6 @@ die:
uncompressed program. [This is a significant kernel misfeature.]
*/
unfold: // s7= &decompress; s6= &b_info(fold); s5= sz_pack2
// compute s5= &decompressor - &b_info(user)
addiu s5,s5,(decompressor - sz_pack2) - (sz_Ehdr + 2*sz_Phdr + sz_l_info + sz_p_info)
/* Get some pages. If small, then get 1 page located just after the end
of the first PT_LOAD of the compressed program. This will still be below
@ -242,7 +239,6 @@ unfold: // s7= &decompress; s6= &b_info(fold); s5= sz_pack2
lw s3,adru - decompressor(s7) // for unmap in fold
lw s2,lenu - decompressor(s7) // for unmap in fold
lw s1,adrx - decompressor(s7) // for upx_main
lw s0,lenx - decompressor(s7) // for upx_main
beq a0,a1,L80 // no copy
subu t0,a0,a1 // (ADRM - ADRC) == relocation amount

View File

@ -38,6 +38,9 @@
PAGE_SHIFT= 12
PAGE_MASK= 0xffffffffffffffff<<PAGE_SHIFT
sz_Ehdr= 52
sz_Phdr= 32
sz_b_info= 12
sz_unc= 0
sz_cpr= 4
@ -58,7 +61,6 @@ BAL=0x04110000
s3= ADRU
s2= LENU
s1= ADRX
s0= LENX
sp= -sp_frame + &{argc,argv...,0,env...,0,auxv...,0...,strings}
*/
fold_begin:
@ -76,7 +78,7 @@ L20: # stop when a3= &auxv[0]
addiu sp,sp,sp_frame - MAX_ELF_HDR # alloca
move a2,sp # &Elf32_Ehdr tmp space
move a1,s1 # LENX FIXME 2007-05-07: bad value
addiu a1,s5,-(sz_Ehdr + 2*sz_Phdr + sz_l_info + sz_p_info)
/* We need a position-independent call of upx_main, which is external.
"bal upx_main" cannot be assembled by mipsel-elf-as-20060406.
@ -92,7 +94,7 @@ L20: # stop when a3= &auxv[0]
subu v0,ra,v0
addiu v0,v0,%lo(upx_main)
jalr v0
move a0,s0 # ADRX FIXME: 2007-05-07 bad value
move a0,s1
/* entry= upx_main(b_info *a0, total_size a1, Elf32_Ehdr *a2,
Elf32_Auxv_t *a3, f_decompr t0, f_unfilter t1 )
*/

View File

@ -2,17 +2,17 @@ tmp/mipsel.r3000-linux.elf-entry.bin: file format elf32-littlemips
Sections:
Idx Name Size VMA LMA File off Algn Flags
0 ELFMAINX 0000002c 00000000 00000000 00000034 2**0 CONTENTS, RELOC, READONLY
1 NRV2E 00000218 00000000 00000000 00000060 2**0 CONTENTS, RELOC, READONLY
2 NRV2D 000001f0 00000000 00000000 00000278 2**0 CONTENTS, RELOC, READONLY
3 NRV2B 000001b4 00000000 00000000 00000468 2**0 CONTENTS, RELOC, READONLY
4 LZMA_ELF00 0000006c 00000000 00000000 0000061c 2**0 CONTENTS, READONLY
5 LZMA_DEC10 00000ad8 00000000 00000000 00000688 2**0 CONTENTS, READONLY
6 LZMA_DEC20 00000ad8 00000000 00000000 00001160 2**0 CONTENTS, READONLY
7 LZMA_DEC30 00000004 00000000 00000000 00001c38 2**0 CONTENTS, READONLY
8 NRV_TAIL 00000000 00000000 00000000 00001c3c 2**0 CONTENTS, READONLY
9 ELFMAINY 0000005e 00000000 00000000 00001c3c 2**0 CONTENTS, RELOC, READONLY
10 ELFMAINZ 000000c0 00000000 00000000 00001c9a 2**0 CONTENTS, READONLY
0 ELFMAINX 00000024 00000000 00000000 00000034 2**0 CONTENTS, RELOC, READONLY
1 NRV2E 00000218 00000000 00000000 00000058 2**0 CONTENTS, RELOC, READONLY
2 NRV2D 000001f0 00000000 00000000 00000270 2**0 CONTENTS, RELOC, READONLY
3 NRV2B 000001b4 00000000 00000000 00000460 2**0 CONTENTS, RELOC, READONLY
4 LZMA_ELF00 0000006c 00000000 00000000 00000614 2**0 CONTENTS, READONLY
5 LZMA_DEC10 00000ad8 00000000 00000000 00000680 2**0 CONTENTS, READONLY
6 LZMA_DEC20 00000ad8 00000000 00000000 00001158 2**0 CONTENTS, READONLY
7 LZMA_DEC30 00000004 00000000 00000000 00001c30 2**0 CONTENTS, READONLY
8 NRV_TAIL 00000000 00000000 00000000 00001c34 2**0 CONTENTS, READONLY
9 ELFMAINY 0000005e 00000000 00000000 00001c34 2**0 CONTENTS, RELOC, READONLY
10 ELFMAINZ 000000b8 00000000 00000000 00001c92 2**0 CONTENTS, READONLY
SYMBOL TABLE:
00000000 l d ELFMAINY 00000000 ELFMAINY
00000000 l d ELFMAINZ 00000000 ELFMAINZ
@ -32,8 +32,7 @@ SYMBOL TABLE:
00000000 *UND* 00000000 ADRC
00000000 *UND* 00000000 LENU
00000000 *UND* 00000000 ADRX
00000000 *UND* 00000000 LENX
00000020 g O ELFMAINX 00000000 _start
0000001c g O ELFMAINX 00000000 _start
RELOCATION RECORDS FOR [ELFMAINX]:
OFFSET TYPE VALUE
@ -44,8 +43,7 @@ OFFSET TYPE VALUE
00000010 R_MIPS_32 ADRC
00000014 R_MIPS_32 LENU
00000018 R_MIPS_32 ADRX
0000001c R_MIPS_32 LENX
00000024 R_MIPS_PC16 ELFMAINZ
0000001c R_MIPS_PC16 ELFMAINZ
RELOCATION RECORDS FOR [NRV2E]:
OFFSET TYPE VALUE