Style: start using correct IEC binary prefix (KiB, MiB, ...) - see

http://en.wikipedia.org/wiki/Binary_prefix for more details.
This commit is contained in:
Markus F.X.J. Oberhumer 2008-04-26 08:48:13 +02:00
parent 2c3e841d8a
commit d453cc27a3
31 changed files with 52 additions and 51 deletions

2
BUGS
View File

@ -28,7 +28,7 @@ dos/exe
watcom/le
---------
* 16-bit selector alias fixups
* 16-bit offset relocation for objects larger than 4 kB
* 16-bit offset relocation for objects larger than 4 KiB
* 16:16 fixups
If you need any of the above (they're very rare), send us an URL of a

2
NEWS
View File

@ -4,7 +4,7 @@ User visible changes for UPX
Changes in 3.03 (27 Apr 2008):
* implement cache flushing for PowerPC (esp. model 440)
* fix cache flushing on MIPS (>3MB compressed, or with holes)
* fix cache flushing on MIPS (>3 MiB compressed, or with holes)
* fix MIPS big-endian
* bug fixes

View File

@ -46,8 +46,8 @@ may not be used to take the address of a function.
The address 0x00400000 was chosen to be out of the way of the usual
load address 0x08048000, and to minimize fragmentation in kernel
page tables; one page of page tables covers 4MB. The address
0x00401000 was chosen as 1 page up from a 64KB boundary, to
page tables; one page of page tables covers 4 MiB. The address
0x00401000 was chosen as 1 page up from a 64 KiB boundary, to
make the startup code and its constants smaller.
Decompression of the executable begins by decompressing the Elf32_Ehdr

View File

@ -108,14 +108,14 @@ then skip another one - the unfiltering process needs some information
to be able to reverse the filtering.
UPX uses the following idea, which works nicely. First we assume that
the size of the area that should be filtered is less than 16MB. Then
the size of the area that should be filtered is less than 16 MiB. Then
UPX scans over this area and keeps a record of the bytes that are
following the 0xE8 bytes. If we are lucky, there will be bytes that
were not found following 0xE8. These bytes are our candidates to be
used as markers.
Do you still remember that we assumed that the size of scanned area is
less than 16MB? Well, this means that when we process a real call, the
less than 16 MiB? Well, this means that when we process a real call, the
resulting offset will be less than 0x00FFFFFF too. So the MSB is always
0x00. Which is a nice place to store our marker. Of course we should
reverse the byte order in the resulting offset - so this marker will

View File

@ -51,8 +51,8 @@ B<UPX> is a versatile executable packer with the following features:
- excellent compression ratio: compresses better than zip/gzip,
use UPX to decrease the size of your distribution !
- very fast decompression: about 10 MB/sec on an ancient Pentium 133,
about 200 MB/sec on an Athlon XP 2000+.
- very fast decompression: about 10 MiB/sec on an ancient Pentium 133,
about 200 MiB/sec on an Athlon XP 2000+.
- no memory overhead for your compressed executables for most of the
supported formats
@ -153,7 +153,7 @@ as compared to the first decompressed version.]
B<UPX> offers ten different compression levels from B<-1> to B<-9>,
and B<--best>. The default compression level is B<-8> for files
smaller than 512 kB, and B<-7> otherwise.
smaller than 512 KiB, and B<-7> otherwise.
=over 4
@ -349,7 +349,7 @@ Extra options available for this executable format:
First of all, it is recommended to use B<UPX> *instead* of B<strip>. strip has
the very bad habit of replacing your stub with its own (outdated) version.
Additionally B<UPX> corrects a bug/feature in strip v2.8.x: it
will fix the 4 KByte alignment of the stub.
will fix the 4 KiB alignment of the stub.
B<UPX> includes the full functionality of stubify. This means it will
automatically stubify your COFF files. Use the option B<--coff> to
@ -660,8 +660,8 @@ Specific drawbacks:
- Because of temporary decompression to disk the decompression speed
is not as fast as with the other executable formats. Still, I can see
no noticeable delay when starting programs like my ~3 MB emacs (which
is less than 1 MB when compressed :-).
no noticeable delay when starting programs like my ~3 MiB emacs (which
is less than 1 MiB when compressed :-).
Extra options available for this executable format:
@ -681,7 +681,7 @@ nostalgic feelings of one of the authors.
Packed programs will be byte-identical to the original after uncompression,
until further notice.
Maximum uncompressed size: ~1.89 / ~7.60 Mbytes.
Maximum uncompressed size: ~1.89 / ~7.60 MiB.
Notes:
@ -708,7 +708,7 @@ Extra options available for this executable format:
--8-bit Uses 8 bit size compression [default: 32 bit]
--8mb-ram PSone has 8 MB ram available [default: 2 MB]
--8mib-ram PSone has 8 MiB ram available [default: 2 MiB]
--boot-only This format is for main exes and CD-Mastering only !
It may slightly improve the compression ratio,
@ -838,7 +838,7 @@ must end with ".scr" (as screensavers are handled slightly different
than normal exe files).
UPX compressed PE files have some minor memory overhead (usually in the
10 - 30 kbytes range) which can be seen by specifying the "-i" command
10 - 30 KiB range) which can be seen by specifying the "-i" command
line switch during compression.
Extra options available for this executable format:

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

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);

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);

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];

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);

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");

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

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;

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]");

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

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))

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)

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();

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);
//

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

View File

@ -193,14 +193,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);
@ -392,7 +392,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();
@ -611,7 +611,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

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]");

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,

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().

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

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 */

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)

View File

@ -159,7 +159,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'

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.

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().

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