Detabified.
committer: mfx <mfx> 1089731601 +0000
This commit is contained in:
+5
-5
@@ -54,11 +54,11 @@ struct Elf_LE32_Ehdr
|
|||||||
|
|
||||||
// Values for e_type
|
// Values for e_type
|
||||||
enum {
|
enum {
|
||||||
ET_NONE =0, /* No file type */
|
ET_NONE = 0, /* No file type */
|
||||||
ET_REL =1, /* Relocatable file */
|
ET_REL = 1, /* Relocatable file */
|
||||||
ET_EXEC =2, /* Executable file */
|
ET_EXEC = 2, /* Executable file */
|
||||||
ET_DYN =3, /* Shared object file */
|
ET_DYN = 3, /* Shared object file */
|
||||||
ET_CORE =4 /* Core file */
|
ET_CORE = 4 /* Core file */
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
__attribute_packed;
|
__attribute_packed;
|
||||||
|
|||||||
+41
-41
@@ -367,7 +367,7 @@ void PackVmlinuxI386::unpack(OutputFile *fo)
|
|||||||
fo->write(obuf, ph.u_len);
|
fo->write(obuf, ph.u_len);
|
||||||
obuf.dealloc();
|
obuf.dealloc();
|
||||||
ibuf.dealloc();
|
ibuf.dealloc();
|
||||||
|
|
||||||
ph = ph_tmp;
|
ph = ph_tmp;
|
||||||
fi->seek(p_text->sh_offset, SEEK_SET);
|
fi->seek(p_text->sh_offset, SEEK_SET);
|
||||||
fi->readx(&call, 5);
|
fi->readx(&call, 5);
|
||||||
@@ -412,39 +412,39 @@ void PackVmlinuxI386::unpack(OutputFile *fo)
|
|||||||
//# create a compressed vmlinux image from the original vmlinux
|
//# create a compressed vmlinux image from the original vmlinux
|
||||||
//#
|
//#
|
||||||
//
|
//
|
||||||
//targets := vmlinux upx-head.o upx-piggy.o
|
//targets := vmlinux upx-head.o upx-piggy.o
|
||||||
//
|
//
|
||||||
//LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup_32
|
//LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup_32
|
||||||
//
|
//
|
||||||
//$(obj)/vmlinux: $(obj)/upx-head.o $(obj)/upx-piggy.o FORCE
|
//$(obj)/vmlinux: $(obj)/upx-head.o $(obj)/upx-piggy.o FORCE
|
||||||
// $(call if_changed,ld)
|
// $(call if_changed,ld)
|
||||||
// @:
|
// @:
|
||||||
//
|
//
|
||||||
//$(obj)/upx-piggy.o: vmlinux FORCE
|
//$(obj)/upx-piggy.o: vmlinux FORCE
|
||||||
// rm -f $(obj)/upx-piggy.o
|
// rm -f $(obj)/upx-piggy.o
|
||||||
// upx -o $(obj)/upx-piggy.o $<
|
// upx -o $(obj)/upx-piggy.o $<
|
||||||
//-----
|
//-----
|
||||||
//
|
//
|
||||||
//----- arch/i386/boot/compressed/upx-head.S
|
//----- arch/i386/boot/compressed/upx-head.S
|
||||||
//#include <asm/segment.h>
|
//#include <asm/segment.h>
|
||||||
//
|
//
|
||||||
// .text
|
// .text
|
||||||
//startup_32: .globl startup_32 # In: %esi=0x90000 setup data "real_mode pointer"
|
//startup_32: .globl startup_32 # In: %esi=0x90000 setup data "real_mode pointer"
|
||||||
// cli # but if it matters, then there is a race!
|
// cli # but if it matters, then there is a race!
|
||||||
//
|
//
|
||||||
// movl $ __BOOT_DS,%eax
|
// movl $ __BOOT_DS,%eax
|
||||||
// movl %eax,%ss; movl $0x99000,%esp # 2.6.7 setup had ss:sp of 9000:8ffe
|
// movl %eax,%ss; movl $0x99000,%esp # 2.6.7 setup had ss:sp of 9000:8ffe
|
||||||
// /* Avoid EBDA (Extended BIOS Data Area) below 0xA0000. */
|
// /* Avoid EBDA (Extended BIOS Data Area) below 0xA0000. */
|
||||||
//
|
//
|
||||||
// pushl $0; popf # subsumes "cli; cld"; also clears NT for buggy BIOS
|
// pushl $0; popf # subsumes "cli; cld"; also clears NT for buggy BIOS
|
||||||
//
|
//
|
||||||
// movl %eax,%ds # all non-code segments identical
|
// movl %eax,%ds # all non-code segments identical
|
||||||
// movl %eax,%es
|
// movl %eax,%es
|
||||||
// movl %eax,%fs
|
// movl %eax,%fs
|
||||||
// movl %eax,%gs
|
// movl %eax,%gs
|
||||||
//
|
//
|
||||||
// movl $ 0x100000,%eax # destination of uncompression (and entry point)
|
// movl $ 0x100000,%eax # destination of uncompression (and entry point)
|
||||||
// pushl $ __BOOT_CS
|
// pushl $ __BOOT_CS
|
||||||
///* Fall into .text of upx-compressed vmlinux. */
|
///* Fall into .text of upx-compressed vmlinux. */
|
||||||
//-----
|
//-----
|
||||||
|
|
||||||
@@ -458,32 +458,32 @@ void PackVmlinuxI386::unpack(OutputFile *fo)
|
|||||||
//#include <asm/unistd.h>
|
//#include <asm/unistd.h>
|
||||||
//
|
//
|
||||||
//dump:
|
//dump:
|
||||||
// movl $0x456789,%edx # length MODIFY THIS VALUE TO SUIT YOUR CASE
|
// movl $0x456789,%edx # length MODIFY THIS VALUE TO SUIT YOUR CASE
|
||||||
// movl $0x100000,%ecx # base
|
// movl $0x100000,%ecx # base
|
||||||
// movl $1,%ebx # stdout
|
// movl $1,%ebx # stdout
|
||||||
// movl $ __NR_write,%eax
|
// movl $ __NR_write,%eax
|
||||||
// int $0x80
|
// int $0x80
|
||||||
// nop
|
// nop
|
||||||
// hlt
|
// hlt
|
||||||
//mmap:
|
//mmap:
|
||||||
// pushl %ebx
|
// pushl %ebx
|
||||||
// leal 2*4(%esp),%ebx
|
// leal 2*4(%esp),%ebx
|
||||||
// pushl $ __NR_mmap; popl %eax
|
// pushl $ __NR_mmap; popl %eax
|
||||||
// int $0x80
|
// int $0x80
|
||||||
// popl %ebx
|
// popl %ebx
|
||||||
// ret $6*4
|
// ret $6*4
|
||||||
//
|
//
|
||||||
//_start: .globl _start
|
//_start: .globl _start
|
||||||
// nop
|
// nop
|
||||||
// int3 # enter debugger!
|
// int3 # enter debugger!
|
||||||
// pushl $0
|
// pushl $0
|
||||||
// pushl $0
|
// pushl $0
|
||||||
// pushl $ MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED
|
// pushl $ MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED
|
||||||
// pushl $ PROT_EXEC | PROT_WRITE | PROT_READ
|
// pushl $ PROT_EXEC | PROT_WRITE | PROT_READ
|
||||||
// pushl $0x600000 # 6MB
|
// pushl $0x600000 # 6MB
|
||||||
// pushl $0x100000 # 1MB
|
// pushl $0x100000 # 1MB
|
||||||
// call mmap
|
// call mmap
|
||||||
// push %cs
|
// push %cs
|
||||||
///* Fall into .text of upx-compressed vmlinux. */
|
///* Fall into .text of upx-compressed vmlinux. */
|
||||||
//-----
|
//-----
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user