This commit is contained in:
John Reiser
2008-04-26 13:08:13 -07:00
31 changed files with 53 additions and 52 deletions
+1 -1
View File
@@ -276,7 +276,7 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
#if 0
// DEBUG - set sizes so that we use a maxmimum amount of stack.
// These settings cause res->num_probs == 3147574, i.e. we will
// need about 6 MB of stack during runtime decompression.
// need about 6 MiB of stack during runtime decompression.
pr[1].uintVal = 4;
pr[2].uintVal = 8;
#endif
+1 -1
View File
@@ -47,7 +47,7 @@ static int F(Filter *f)
unsigned calls = 0, noncalls = 0, noncalls2 = 0;
unsigned lastnoncall = size, lastcall = 0;
// find a 16MB large empty address space
// find a 16 MiB large empty address space
{
unsigned char buf[256];
memset(buf,0,256);
+1 -1
View File
@@ -51,7 +51,7 @@ static int F(Filter *f)
unsigned calls = 0, noncalls = 0, noncalls2 = 0;
unsigned lastnoncall = size, lastcall = 0;
// find a 16MB large empty address space
// find a 16 MiB large empty address space
{
unsigned char buf[256];
memset(buf,0,256);
+2 -2
View File
@@ -123,8 +123,8 @@ static int F(Filter *f)
N_MRU : 0;
#endif //}
// FIXME: We must fit into 8MB because we steal one bit.
// find a 16MB large empty address space
// FIXME: We must fit into 8 MiB because we steal one bit.
// find a 16 MiB large empty address space
{
int which;
unsigned char buf[256];
+1 -1
View File
@@ -52,7 +52,7 @@ static int F(Filter *f)
unsigned calls = 0, noncalls = 0, noncalls2 = 0;
unsigned lastnoncall = size, lastcall = 0;
// find a 16MB large empty address space
// find a 16 MiB large empty address space
{
unsigned char buf[256];
memset(buf,0,256);
+1 -1
View File
@@ -263,7 +263,7 @@ void show_help(int verbose)
fg = con_fg(f,fg);
con_fprintf(f,
" --8-bit uses 8 bit size compression [default: 32 bit]\n"
" --8mb-ram 8 megabyte memory limit [default: 2 mb]\n"
" --8mib-ram 8 megabyte memory limit [default: 2 MiB]\n"
" --boot-only disables client/host transfer compatibility\n"
" --no-align don't align to 2048 bytes [enables: --console-run]\n"
"\n");
+2 -1
View File
@@ -881,7 +881,7 @@ static int do_option(int optc, const char *arg)
opt->ps1_exe.do_8bit = true;
break;
case 673:
opt->ps1_exe.do_8mb = false;
opt->ps1_exe.do_8mib = false;
break;
case '\0':
@@ -1045,6 +1045,7 @@ static const struct mfx_option longopts[] =
{"boot-only", 0x10, 0, 670},
{"no-align", 0x10, 0, 671},
{"8-bit", 0x10, 0, 672},
{"8mib-ram", 0x10, 0, 673},
{"8mb-ram", 0x10, 0, 673},
// mp (meta) options
+1 -1
View File
@@ -134,7 +134,7 @@ struct options_t {
bool boot_only;
bool no_align;
bool do_8bit;
bool do_8mb;
bool do_8mib;
} ps1_exe;
struct {
unsigned blocksize;
+2 -2
View File
@@ -714,7 +714,7 @@ void PackArmPe::pack(OutputFile *fo)
// limit stack size needed for runtime decompression
upx_compress_config_t cconf; cconf.reset();
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28KB stack
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28 KiB stack
compressWithFilters(&ft, 2048, &cconf, filter_strategy,
ih.codebase, rvamin, 0, NULL, 0);
// info: see buildLoader()
@@ -898,7 +898,7 @@ void PackArmPe::pack(OutputFile *fo)
// set_le32(ibuf + ic,get_le32("UPX "));
ibuf.clear(0, oh.filealign);
info("Image size change: %u -> %u kBytes",
info("Image size change: %u -> %u KiB",
ih.imagesize / 1024, oh.imagesize / 1024);
infoHeader("[Writing compressed file]");
+1 -1
View File
@@ -303,7 +303,7 @@ void PackDjgpp2::pack(OutputFile *fo)
// compress
upx_compress_config_t cconf; cconf.reset();
// limit stack size needed for runtime decompression
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28KB stack
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28 KiB stack
compressWithFilters(&ft, 512, &cconf);
// patch coff header #2
+1 -1
View File
@@ -506,7 +506,7 @@ void PackExe::pack(OutputFile *fo)
// compress (max_match = 8192)
upx_compress_config_t cconf; cconf.reset();
cconf.conf_ucl.max_match = MAXMATCH;
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28KB stack
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28 KiB stack
compressWithFilters(&ft, 32, &cconf);
if (M_IS_NRV2B(ph.method) || M_IS_NRV2D(ph.method) || M_IS_NRV2E(ph.method))
+2 -2
View File
@@ -95,7 +95,7 @@ PackPs1::PackPs1(InputFile *f) :
COMPILE_TIME_ASSERT(SZ_IH_BKUP == 40)
fdata_size = file_size - PS_HDR_SIZE;
ram_size = !opt->ps1_exe.do_8mb ? 0x200000 : 0x800000;
ram_size = !opt->ps1_exe.do_8mib ? 0x200000 : 0x800000;
}
const int *PackPs1::getCompressionMethods(int method, int level) const
@@ -500,7 +500,7 @@ void PackPs1::pack(OutputFile *fo)
// compress (max_match = 65535)
upx_compress_config_t cconf; cconf.reset();
cconf.conf_ucl.max_match = 65535;
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28KB stack
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28 KiB stack
compressWithFilters(&ft, sa_cnt, &cconf);
if (overlap)
+1 -1
View File
@@ -242,7 +242,7 @@ void PackTmt::pack(OutputFile *fo)
// compress
upx_compress_config_t cconf; cconf.reset();
// limit stack size needed for runtime decompression
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28KB stack
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28 KiB stack
compressWithFilters(&ft, 512, &cconf);
const unsigned lsize = getLoaderSize();
+1 -1
View File
@@ -507,7 +507,7 @@ void PackTos::pack(OutputFile *fo)
// compress (max_match = 65535)
upx_compress_config_t cconf; cconf.reset();
cconf.conf_ucl.max_match = 65535;
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28KB stack
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28 KiB stack
compressWithFilters(&ft, 512, &cconf);
//
+5 -5
View File
@@ -269,7 +269,7 @@ void PackVmlinuxBase<T>::pack(OutputFile *fo)
upx_compress_config_t cconf; cconf.reset();
// limit stack size needed for runtime decompression
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28KB stack
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28 KiB stack
unsigned ppc32_extra = 0;
if (Ehdr::EM_PPC==my_e_machine) {
@@ -837,7 +837,7 @@ const int *PackVmlinuxPPC32::getFilters() const
bool PackVmlinuxI386::is_valid_e_entry(Addr e_entry)
{
return 0==(0x000fffff & e_entry); // entry on whole 1MB
return 0==(0x000fffff & e_entry); // entry on whole 1 MiB
}
@@ -1390,8 +1390,8 @@ bool PackVmlinuxAMD64::has_valid_vmlinux_head()
// pushl $0
// pushl $ MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED
// pushl $ PROT_EXEC | PROT_WRITE | PROT_READ
// pushl $0x600000 # 6MB length
// pushl $0x100000 # 1MB address
// pushl $0x600000 # 6 MiB length
// pushl $0x100000 # 1 MiB address
// call mmap
// leal -0x9000(%esp),%esi # expect "lea 0x9000(%esi),%esp" later
///* Fall into .text of upx-compressed vmlinux. */
@@ -1440,7 +1440,7 @@ const int *PackVmlinuxAMD64::getFilters() const
bool PackVmlinuxAMD64::is_valid_e_entry(Addr e_entry)
{
return 0x200000<=e_entry; // 2MB
return 0x200000<=e_entry; // 2 MiB
}
Linker* PackVmlinuxAMD64::newLinker() const
+5 -5
View File
@@ -202,14 +202,14 @@ int PackVmlinuzI386::decompressKernel()
}
// Find "ljmp $__BOOT_CS,$__PHYSICAL_START" if any.
if (0==memcmp("\xEA\x00\x00", p, 3) && 0==(0xf & p[3]) && 0==p[4]) {
/* whole megabyte < 16MB */
/* whole megabyte < 16 MiB */
physical_start = get_te32(1+ p);
break;
}
}
if (base && relocated) {
p = base + relocated;
for (int j= 0; j < 0x200; ++j, ++p) {
for (j = 0; j < 0x200; ++j, ++p) {
if (0==memcmp("\x01\x9c\x0b", p, 3) // addl %ebx,d32(%ebx,%ecx)
) {
page_offset = 0u - get_te32(3+ p);
@@ -401,7 +401,7 @@ void PackVmlinuzI386::pack(OutputFile *fo)
// compress
upx_compress_config_t cconf; cconf.reset();
// limit stack size needed for runtime decompression
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28KB stack
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28 KiB stack
compressWithFilters(&ft, 512, &cconf);
const unsigned lsize = getLoaderSize();
@@ -516,7 +516,7 @@ void PackBvmlinuzI386::pack(OutputFile *fo)
upx_compress_config_t cconf; cconf.reset();
// limit stack size needed for runtime decompression
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28KB stack
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28 KiB stack
// FIXME: new stub allows most of low memory as stack for Bvmlinuz ?
//cconf.conf_lzma.max_num_probs = (0x99000 - 0x10250)>>1; // ushort: 560560 stack
@@ -624,7 +624,7 @@ int PackVmlinuzI386::canUnpack()
void PackVmlinuzI386::unpack(OutputFile *fo)
{
// no uncompression support for this format, so that
// it is possible to remove the original deflate code (>10KB)
// it is possible to remove the original deflate code (>10 KiB)
// FIXME: but we could write the uncompressed "vmlinux" image
+1 -1
View File
@@ -1037,7 +1037,7 @@ void PackW32Pe::pack(OutputFile *fo)
// set_le32(ibuf + ic,get_le32("UPX "));
ibuf.clear(0, oh.filealign);
info("Image size change: %u -> %u kBytes",
info("Image size change: %u -> %u KiB",
ih.imagesize / 1024, oh.imagesize / 1024);
infoHeader("[Writing compressed file]");
+1 -1
View File
@@ -433,7 +433,7 @@ void PackWcle::encodeImage(Filter *ft)
// prepare filter [already done]
// compress
upx_compress_config_t cconf; cconf.reset();
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28KB stack
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28 KiB stack
compressWithFilters(ibuf, isize,
oimage + RESERVED,
ibuf + ft->addvalue, ft->buf_len,
+1 -1
View File
@@ -225,7 +225,7 @@ unfold:
/* 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
all of the uncompressed program. If large (>=3MB uncompressed), then enough
all of the uncompressed program. If large (>=3 MiB uncompressed), then enough
to duplicate the entire compressed PT_LOAD, plus 1 page, located just after
the brk() of the _un_compressed program. The address and length are pre-
calculated by PackLinuxElf64amd::defineSymbols().
+1 -1
View File
@@ -56,7 +56,7 @@ decompress_kernel: # (char *out, char *tmp, char *tmp_end, int arch_id)
// Value stored from r1 to memory will be overwritten by outsize.
stmdb r1!,{r0,r1,r2,r3,sp} // &indata, space, &outdata, arch_id, sp_in
loadcon8 3,METHOD // mov r3,#METHOD
mov sp,r1 // switch stacks to tmp_end area (64KB)
mov sp,r1 // switch stacks to tmp_end area (64 KiB)
ldr r1,1f // insize
str r3,[sp,#-4]! // method
ldr r3,2f // outsize
+1 -1
View File
@@ -99,7 +99,7 @@ section EXEENTRY
push ds
.byte 0xa9
do_copy:
mov ch, 0x80 /* 64 kbyte */
mov ch, 0x80 /* 64 KiB */
mov ax, cs
addaxds:
add ax, offset source_segment /* MSB is referenced by the "sub" below */
+1 -1
View File
@@ -38,7 +38,7 @@ PHDRS
}
SECTIONS
{
/* 0x00c01000: 12MB+4KB for Fedora Core 5 vDSO at 0xc00000 */
/* 0x00c01000: 12 MiB + 4 KiB for Fedora Core 5 vDSO at 0xc00000 */
. = 0x00c01000 + SIZEOF_HEADERS + 12; /* 12==sizeof(l_info) */
.text : {
*(.text)
+1 -1
View File
@@ -162,7 +162,7 @@ setcursor:
mov al,15; call outb_p; inc edx
mov al,cl
// jmp outb_p
outb_p:
outb dx,al
call 0f; 0: // insure minimum delay between 'outb'
+1 -1
View File
@@ -371,7 +371,7 @@ umax(unsigned a, unsigned b)
// OpenBSD 3.9 wants all .text from all modules together, then (above that)
// all .data from all modules together, in order to maximize the effectiveness
// of lowering the segment limit on %cs as an implementation of "no-execute
// .data". Thus OpenBSD 3.9 puts a gap of 0x20000000 (512MB) between the
// .data". Thus OpenBSD 3.9 puts a gap of 0x20000000 (512 MiB) between the
// origins of .text and .data in each module. So, mapping ET_DYN must "level"
// the excursion in .text and .data of anything which preceeded it,
// then add the new PT_LOAD.
+1 -1
View File
@@ -281,7 +281,7 @@ unfold: // s7= &decompress; s6= &b_info(fold); s5= sz_pack2
/* 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
all of the uncompressed program. If large (>=3MB uncompressed), then enough
all of the uncompressed program. If large (>=3 MiB uncompressed), then enough
to duplicate the entire compressed PT_LOAD, plus 1 page, located just after
the brk() of the _un_compressed program. The address and length are pre-
calculated by PackLinuxElf64amd::defineSymbols().
+1 -1
View File
@@ -71,7 +71,7 @@ L90:
lwz a1,-8(r31) # offset to {l_info; p_info; b_info}
subf a0,a1,r31 # &l_info
lwz a3,sz_unc+sz_p_info+sz_l_info(a0) # sz_mach_headers
cmpli 0,a3,2048; bgt L100; li a3,2048 # at least 2KB for /usr/lib/dyld
cmpli 0,a3,2048; bgt L100; li a3,2048 # at least 2 KiB for /usr/lib/dyld
L100:
movr r29,sp # remember for restoring later
subf sp,a3,sp # alloca