1/* 2; powerpc-darwin.macho-upxsubr.S -- system calls 3; 4; This file is part of the UPX executable compressor. 5; 6; Copyright (C) 1996-2020 Markus Franz Xaver Johannes Oberhumer 7; Copyright (C) 1996-2020 Laszlo Molnar 8; Copyright (C) 2000-2020 John F. Reiser 9; All Rights Reserved. 10; 11; UPX and the UCL library are free software; you can redistribute them 12; and/or modify them under the terms of the GNU General Public License as 13; published by the Free Software Foundation; either version 2 of 14; the License, or (at your option) any later version. 15; 16; This program is distributed in the hope that it will be useful, 17; but WITHOUT ANY WARRANTY; without even the implied warranty of 18; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19; GNU General Public License for more details. 20; 21; You should have received a copy of the GNU General Public License 22; along with this program; see the file COPYING. 23; If not, write to the Free Software Foundation, Inc., 24; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 25; 26; Markus F.X.J. Oberhumer Laszlo Molnar 27; <markus@oberhumer.com> <ml1050@users.sourceforge.net> 28; 29; John F. Reiser 30; <jreiser@users.sourceforge.net> 31; 32*/ 33 .machine ppc 34 35SYS_exit =1 36SYS_fork =2 37SYS_read =3 38SYS_write =4 39SYS_open =5 40SYS_close =6 41 42SYS_pread =153 43SYS_mmap =197 44SYS_munmap= 73 45SYS_mprotect= 74 46 47_start: .globl _start 48 //trap // debug 49 lwz r3,0(r1) // argc 50 la r4,4(r1) // argv 51 la r1,-(1+6)*4(r1) // 6:frame convention, 1: mhdrpp 52 bl _main 53 mtctr r3 // entry to dyloader 54 la r1, (0+6)*4(r1) // undo frame; retain mhdrp 55 li r0,0 56 mtlr r0 // paranoia 57 bctrl 58 trap // should never happen 59 60/* SYS_mmap takes a 64-bit off_t, but gcc-3.4.1-20040827 passes long long 61 in wrong registers. So change C interface to use size_t (32-bits) instead 62 of off_t (64 bits), and convert here. 63*/ 64_pread: .globl _pread 65 mr r7,r6 66 li r6,0 67 li r0,153 68 b sysgo 69_mmap: .globl _mmap 70 mr r9,r8 71 li r8,0 72 li r0,197 73sysgo: 74 sc 75 li r3,-1 76 blr 77 78_exit: .globl _exit 79 li r0,SYS_exit 80 b sysgo 81_read: .globl _read 82 li r0,SYS_read 83 b sysgo 84_open: .globl _open 85 li r0,SYS_open 86 b sysgo 87_close: .globl _close 88 li r0,SYS_close 89 b sysgo 90_mprotect: .globl _mprotect 91 li r0,SYS_mprotect 92 b sysgo 93_munmap: .globl _munmap 94 li r0, SYS_munmap 95 b sysgo 96 97dyld_stub_binding_helper: .globl dyld_stub_binding_helper 98 b dyld_stub_binding_helper 99