diff --git a/src/stub/src/powerpc-darwin.macho-entry.S b/src/stub/src/powerpc-darwin.macho-entry.S index 2324a762..8332e824 100644 --- a/src/stub/src/powerpc-darwin.macho-entry.S +++ b/src/stub/src/powerpc-darwin.macho-entry.S @@ -26,18 +26,58 @@ * */ -#include "arch/powerpc/32/regs.h" +#include "arch/powerpc/32/ppc_regs.h" +#define section .section -/*__MACOS000__*/ + section MACOS000 _start: .globl _start call main # must be exactly 1 instruction; link_register= &decompress + + section NRV_HEAD +SZ_DLINE=128 # size of data cache line in Apple G5 + +/* PowerPC has no 'cmplis': compare logical [unsigned] immediate shifted [by 16] */ +#define hibit r0 /* holds 0x80000000 during decompress */ + +#define src a0 +#define lsrc a1 +#define dst a2 +#define ldst a3 /* Out: actually a reference: &len_dst */ +#define meth a4 + +#define off a4 +#define len a5 +#define bits a6 +#define disp a7 + + section NRV2E #include "arch/powerpc/32/nrv2e_d.S" -/* Temporary until we get the buildLoader stuff working ... */ - .ascii "\n$Id: UPX (C) 1996-2006 the UPX Team. " - .asciz "All Rights Reserved. http://upx.sf.net $\n" - .p2align 2 # (1<<2) + section NRV2D +#include "arch/powerpc/32/nrv2d_d.S" + section NRV2B +#include "arch/powerpc/32/nrv2b_d.S" + +#include "arch/powerpc/32/lzma_d.S" + + section NRV_TAIL +eof_nrv: +#define tmp r0 /* hibit is dead */ + lwz tmp,0(ldst) // original dst + mtlr t3 // return address + addi dst,dst,1 // uncorrect for 'stbu' + addi src,src,1 // uncorrect for 'lbzu' + subf dst,tmp,dst // dst -= tmp; // dst length +#undef tmp + subf a0,lsrc,src // src -= eof; // return 0: good; else: bad + stw dst,0(ldst) + ret + + section ELFMAINY + // IDENTSTR goes here + + section ELFMAINZ sz_b_info= 12 sz_unc= 0 sz_cpr= 4 @@ -67,9 +107,6 @@ L100: GAP= 128 # > farthest_prefetch; must match ../p_mach.cpp b GAP+L100 # 'isync' has trouble on Macintosh G4? /* { b_info={sz_unc, sz_cpr, {4 char}}, folded_loader...} */ -eof: -/*__XTHEENDX__*/ - /* vi:ts=8:et:nowrap */