1
0
mirror of https://github.com/upx/upx synced 2025-10-05 19:20:23 +08:00

get_le32 reimplemented in assembly

committer: ml1050 <ml1050> 1143473260 +0000
This commit is contained in:
László Molnár 2006-03-27 15:27:40 +00:00
parent 8773649de6
commit 8142d3474d
3 changed files with 53 additions and 52 deletions

View File

@ -1,4 +1,4 @@
/* l_armpe.h -- created from l_armpe.bin, 569 (0x239) bytes /* l_armpe.h -- created from l_armpe.bin, 561 (0x231) bytes
This file is part of the UPX executable compressor. This file is part of the UPX executable compressor.
@ -27,45 +27,45 @@
*/ */
#define NRV_LOADER_SIZE 569 #define NRV_LOADER_SIZE 561
#define NRV_LOADER_ADLER32 0x6e94ce29 #define NRV_LOADER_ADLER32 0xa4adcc1c
#define NRV_LOADER_CRC32 0x6b87ce4a #define NRV_LOADER_CRC32 0x5606a013
unsigned char nrv_loader[569] = { unsigned char nrv_loader[561] = {
15, 64, 45,233, 56, 0,143,226, 14, 0,144,232, 2, 16,129,224, /* 0x 0 */ 15, 64, 45,233, 72, 0,143,226, 14, 0,144,232, 2, 16,129,224, /* 0x 0 */
0, 32,147,229, 1, 58,131,226, 1, 0, 83,225,251,255,255,154, /* 0x 10 */ 0, 32,147,229, 1, 58,131,226, 1, 0, 83,225,251,255,255,154, /* 0x 10 */
4,224,143,226, 23,192,143,226, 28,255, 47,225, 15, 64,189,232, /* 0x 20 */ 4,224,143,226, 23,192,143,226, 28,255, 47,225, 15, 64,189,232, /* 0x 20 */
44,192,159,229, 28,255, 47,225, 8, 75, 27,104, 24, 71, 8, 75, /* 0x 30 */ 60,192,159,229, 28,255, 47,225, 12, 75, 27,104, 24, 71, 12, 75, /* 0x 30 */
251,231, 29,224, 83, 82, 67, 48, 83, 82, 67, 76, 68, 83, 84, 48, /* 0x 40 */ 251,231, 25,224, 3, 33, 67, 92, 18, 2,210, 24, 1, 57,250,213, /* 0x 40 */
68, 83, 84, 76, 66, 73, 77, 80, 79, 78, 65, 77, 71, 69, 84, 80, /* 0x 50 */ 16, 28,112, 71, 83, 82, 67, 48, 83, 82, 67, 76, 68, 83, 84, 48, /* 0x 50 */
76, 79, 65, 68, 69, 78, 84, 82, 16,181, 4, 28, 3, 33, 0, 32, /* 0x 60 */ 68, 83, 84, 76, 66, 73, 77, 80, 79, 78, 65, 77, 71, 69, 84, 80, /* 0x 60 */
99, 92, 2, 2,208, 24, 1, 57,250,213, 16,188, 2,188, 8, 71, /* 0x 70 */ 76, 79, 65, 68, 69, 78, 84, 82,240,181,163,176, 0, 34, 2,146, /* 0x 70 */
240,181,163,176, 0, 34, 2,146,130,104, 1,146, 66,105, 3, 28, /* 0x 80 */ 130,104, 1,146, 66,105, 3, 28, 4,105, 0,146, 89,104, 0,104, /* 0x 80 */
4,105, 0,146, 89,104, 0,104, 1,154, 2,171, 0,240, 76,248, /* 0x 90 */ 1,154, 2,171, 0,240, 76,248, 37, 28, 40, 28,255,247,210,255, /* 0x 90 */
37, 28, 40, 28,255,247,224,255, 4, 30, 61,208, 0,155, 40, 29, /* 0x a0 */ 4, 30, 61,208, 0,155, 40, 29,228, 24,255,247,203,255, 1,154, /* 0x a0 */
228, 24,255,247,217,255, 1,154,134, 24, 3,168, 2, 28, 35,120, /* 0x b0 */ 134, 24, 3,168, 2, 28, 35,120, 27, 6, 0, 43, 4,208, 27, 14, /* 0x b0 */
27, 6, 0, 43, 4,208, 27, 14, 19,128, 1, 52, 2, 50,246,231, /* 0x c0 */ 19,128, 1, 52, 2, 50,246,231, 0, 35, 19,128,255,247,183,255, /* 0x c0 */
0, 35, 19,128,255,247,179,255, 8, 53, 7, 28, 43,120, 27, 6, /* 0x d0 */ 8, 53, 7, 28, 43,120, 27, 6, 0, 43, 31,208, 27, 14, 1, 53, /* 0x d0 */
0, 43, 31,208, 27, 14, 1, 53, 1, 43, 2,208,255, 43, 13,208, /* 0x e0 */ 1, 43, 2,208,255, 43, 13,208,244,231, 56, 28, 41, 28,255,247, /* 0x e0 */
244,231, 56, 28, 41, 28,255,247,159,255, 52, 28, 32, 96, 4, 54, /* 0x f0 */ 163,255, 52, 28, 32, 96, 4, 54, 43,120, 27, 6, 1, 53, 0, 43, /* 0x f0 */
43,120, 27, 6, 1, 53, 0, 43,250,209,231,231,105,120, 43,120, /* 0x 100 */ 250,209,231,231,105,120, 43,120, 9, 2, 56, 28, 89, 24,255,247, /* 0x 100 */
9, 2, 56, 28, 89, 24,255,247,143,255, 52, 28, 2, 53, 4, 54, /* 0x 110 */ 147,255, 52, 28, 2, 53, 4, 54, 32, 96,219,231, 1, 53,188,231, /* 0x 110 */
32, 96,219,231, 1, 53,188,231, 35,176,240,188, 1,188, 0, 71, /* 0x 120 */ 35,176,240,188, 1,188, 0, 71, 1,192,143,226, 28,255, 47,225, /* 0x 120 */
1,192,143,226, 28,255, 47,225,252,181, 15, 24, 1, 36,101, 66, /* 0x 130 */ 252,181, 15, 24, 1, 36,101, 66,228, 7, 5, 38, 54, 2, 15,224, /* 0x 130 */
228, 7, 5, 38, 54, 2, 15,224, 24,188,192, 27,210, 26, 34, 96, /* 0x 140 */ 24,188,192, 27,210, 26, 34, 96,240,188, 2,188, 8, 71, 4,120, /* 0x 140 */
240,188, 2,188, 8, 71, 4,120,100, 65, 1, 48, 36, 6,247, 70, /* 0x 150 */ 100, 65, 1, 48, 36, 6,247, 70, 3,120, 1, 48, 19,112, 1, 50, /* 0x 150 */
3,120, 1, 48, 19,112, 1, 50, 36, 25,254, 70,243,208,247,210, /* 0x 160 */ 36, 25,254, 70,243,208,247,210, 1, 33, 4,224, 1, 57, 36, 25, /* 0x 160 */
1, 33, 4,224, 1, 57, 36, 25,254, 70,236,208, 73, 65, 36, 25, /* 0x 170 */ 254, 70,236,208, 73, 65, 36, 25,254, 70,232,208, 73, 65, 36, 25, /* 0x 170 */
254, 70,232,208, 73, 65, 36, 25,254, 70,228,208,242,211,203, 30, /* 0x 180 */ 254, 70,228,208,242,211,203, 30, 0, 33, 8,211, 27, 2, 5,120, /* 0x 180 */
0, 33, 8,211, 27, 2, 5,120, 1, 48, 29, 67,237, 67,211,208, /* 0x 190 */ 1, 48, 29, 67,237, 67,211,208,109, 16, 19,210, 3,224, 36, 25, /* 0x 190 */
109, 16, 19,210, 3,224, 36, 25,254, 70,212,208, 14,210, 1, 33, /* 0x 1a0 */ 254, 70,212,208, 14,210, 1, 33, 36, 25,254, 70,207,208, 9,210, /* 0x 1a0 */
36, 25,254, 70,207,208, 9,210, 36, 25,254, 70,203,208, 73, 65, /* 0x 1b0 */ 36, 25,254, 70,203,208, 73, 65, 36, 25,254, 70,199,208,247,211, /* 0x 1b0 */
36, 25,254, 70,199,208,247,211, 4, 49, 4,224, 36, 25,254, 70, /* 0x 1c0 */ 4, 49, 4,224, 36, 25,254, 70,193,208, 73, 65, 2, 49,238, 66, /* 0x 1c0 */
193,208, 73, 65, 2, 49,238, 66, 0,210, 1, 49, 19,120, 83, 93, /* 0x 1d0 */ 0,210, 1, 49, 19,120, 83, 93, 19,112, 1, 50, 1, 57,250,209, /* 0x 1d0 */
19,112, 1, 50, 1, 57,250,209,190,231, 0, 0, 85, 80, 88, 33, /* 0x 1e0 */ 190,231, 0, 0, 85, 80, 88, 33,161,216,208,213, 0, 0, 0, 0, /* 0x 1e0 */
161,216,208,213, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 1f0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 1f0 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 65, 82, 77, 87, /* 0x 200 */ 0, 0, 0, 45, 65, 82, 77, 87, 80, 69, 48, 48, 0, 0, 0, 0, /* 0x 200 */
80, 69, 48, 48, 0, 0, 0, 0, 0, 85, 80, 88, 49, 72, 69, 65, /* 0x 210 */ 0, 85, 80, 88, 49, 72, 69, 65, 68, 0,228, 1, 0, 0, 65, 82, /* 0x 210 */
68, 0,236, 1, 0, 0, 65, 82, 77, 87, 80, 69, 57, 57, 0, 12, /* 0x 220 */ 77, 87, 80, 69, 57, 57, 0, 4, 2, 0, 0,255,255,255,255, 4, /* 0x 220 */
2, 0, 0,255,255,255,255, 12, 2 /* 0x 230 */ 2 /* 0x 230 */
}; };

View File

@ -35,19 +35,7 @@ int thumb_nrv2e_d8(const unsigned char * src, unsigned src_len,
void *LoadLibraryW(const unsigned short *); void *LoadLibraryW(const unsigned short *);
void *GetProcAddressA(const void *, const void *); void *GetProcAddressA(const void *, const void *);
void *get_le32(const unsigned char *p);
static void *get_le32(const unsigned char *p)
{
//return (void *) (p[0] + p[1] * 0x100 + p[2] * 0x10000 + p[3] * 0x1000000);
// the code below is 4 bytes shorter than the above when compiled
unsigned ret = 0;
int ic = 3;
do {
ret = ret * 0x100 + p[ic];
} while (--ic >= 0);
return (void *) ret;
}
static void handle_imports(const unsigned char *imp, unsigned name_offset, static void handle_imports(const unsigned char *imp, unsigned name_offset,
unsigned iat_offset) unsigned iat_offset)

View File

@ -89,6 +89,19 @@ call_upxmain:
@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@
.global get_le32
.thumb_func
get_le32: @ optimized for size
mov r1, #3
g0:
ldrb r3, [r0, r1]
lsl r2, r2, #8
add r2, r2, r3
sub r1, #1
bpl g0
mov r0, r2
bx lr
#if 0 #if 0
// debugging stuff - helpers for dumping memory to a file or deleting a file // debugging stuff - helpers for dumping memory to a file or deleting a file