forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

RE on pspnet.prx...

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
ab5000



Joined: 06 May 2008
Posts: 74

PostPosted: Sun Jun 22, 2008 10:28 pm    Post subject: RE on pspnet.prx... Reply with quote

Hi.
I've done some RE on pspnet.prx (3.52) and i've discovered some interesting things. The first file I analysed was the "wlanscan" PSPSDK example. Then I've reversed the sceNetConfigUpInterface (also sceNet_lib_5216CBF5) function. In this function there are 2 IoCtls.
First the function saves the first argument $a0 (normally it's the string "wlan") to $s0. Then using memset it fills with 0 32 bytes from $a0 (so $a0 = 32 bytes). Using strncpy it inserts $s0 into the stack. then it does the first ioctl:

Code:
a0 = 0 -> File Descriptor
a1 = (0xC020 << 16) | 0x6911 = 0xC0206911 -> Command
a2 = $sp -> Arguments (in the stack, with strncpy, the function saved the first argument, normally "wlan")


if the ioctl fails (return code != 0) it returns. else do another ioctl:

Code:
a0 = 0 -> File Descriptor
a1 = (0x8020 << 16) | 0x6910 = 0x80206910 -> Command
a2 = $sp -> Arguments (normally "wlan")
a3 = 1


i've found an interesting page. simply google "C0206911 ioctl" and open the first result. then search "C0206911" on it. the two commands are in this page. can someone identify this page? another strange thing is the FD: 0 is a valid FD, but when was it opened? i think this FD is a "bridge" to the kernel. if it is, the argument "wlan" can be simply a way to tell the kernel on what device you want to control.
what do you think?

ab5000.


Last edited by ab5000 on Sun Jun 22, 2008 11:43 pm; edited 1 time in total
Back to top
View user's profile Send private message
adrahil



Joined: 16 Mar 2006
Posts: 277

PostPosted: Sun Jun 22, 2008 11:20 pm    Post subject: Reply with quote

What you stumbled on on google is the OpenVMS TCP/IP services specification, which is probably the base of the PSP's networking system. (Is SCE so cheap that they hire retired OpenVMS engineers as system designers?)

Anyways, it's good you found that page, as now it will be possible to map the sceNet ioctls and probably find out a few more sceNet function names...
Back to top
View user's profile Send private message
ab5000



Joined: 06 May 2008
Posts: 74

PostPosted: Sun Jun 22, 2008 11:42 pm    Post subject: Reply with quote

i've looked at other IoCtls on pspnet. The form of the command is the same:

Code:
lui $v0, 0xAAAA
ori $a1, $v0, 0xBBBB


so:

Code:
$v0 = 0xAAAA << 16
$a1 = $v0 | 0xBBB


Code:
$a1 = (0xAAAA << 16) | 0xBBBB
Back to top
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Mon Jun 23, 2008 3:18 am    Post subject: Reply with quote

adrahil wrote:
What you stumbled on on google is the OpenVMS TCP/IP services specification, which is probably the base of the PSP's networking system. (Is SCE so cheap that they hire retired OpenVMS engineers as system designers?)

Anyways, it's good you found that page, as now it will be possible to map the sceNet ioctls and probably find out a few more sceNet function names...


nah ! this command is SIOCGIFFLAGS and if you google it, you'll find it is present in several OSes like Linux/SOLARIS/HP-UX. So i'm doubtful Sony hire any OpenVMS engineers :P.
Back to top
View user's profile Send private message
adrahil



Joined: 16 Mar 2006
Posts: 277

PostPosted: Mon Jun 23, 2008 3:41 am    Post subject: Reply with quote

http://starlet.deltatel.ru/sys$common/syslib/ucx$inetdef.for

This is from OpenVMS... Check out the link "OpenVMS SYS$LIBRARY directory" on http://starlet.deltatel.ru/tech-stuff.htm ...

And http://www.uni-giessen.de/faq/archiv/dec-faq.ucx/msg00000.html says that UCX is a TCP/IP stack on VMS...

You're right in saying that the SIO* ioctls are present in BSD sockets, but their values are different from the VMS implementation.
Back to top
View user's profile Send private message
ab5000



Joined: 06 May 2008
Posts: 74

PostPosted: Mon Jun 23, 2008 4:20 am    Post subject: Reply with quote

A partial list of commands:

Code:
sceNet_lib_B755FA98

Command 1 = (0xC020 << 16) | 0x69D4 = 0xC02069D4
Command 2 = (0xC018 << 16) | 0x69D6 = 0xC01869D6


Code:
sceNet_lib_D5B64E37

Command 1 = (0xC020 << 16) | 0x69D4 = 0xC02069D4
Command 2 = (0xC018 << 16) | 0x69D6 = 0xC01869D6
Command 3 = (0xC020 << 16) | 0x69D4 = 0xC02069D4
Command 4 = (0xC018 << 16) | 0x69D6 = 0xC01869D4
Command 5 = (0xC018 << 16) | 0x69D5 = 0xC01869D5


Code:
sceNet_lib_DA02F383

Command 1 = (0xC014 << 16) | 0x69D8 = 0xC01469D8


Code:
sceNet_lib_83FE280A

Command 1 = (0x8014 << 16) | 0x69DD = 0x801469DD


Note that:

Code:
(0xAAAA << 16) | 0xBBB = 0xAAAABBBB


because:

Code:
0xAAAA << 16 = 0xAAAA0000

1 OR 1 = 1
1 OR 0 = 1
0 OR 1 = 1
0 OR 0 = 0

0xAAAA0000 | 0x0000BBBB = 0xAAAABBBB
Back to top
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Mon Jun 23, 2008 5:09 am    Post subject: Reply with quote

and ?

why are you trying to teach us how to get a 32-bit constant through a LUI/ORI pair so hard ?

Quote:
Note that:

Code:
(0xAAAA << 16) | 0xBBB = 0xAAAABBBB


i would say : 0xAAAA0BBB :P

more seriously, if you plan to give us a detail list, you should insist on getting their (hypothetical) associated names rather teaching us how to get those numbers.
Back to top
View user's profile Send private message
adrahil



Joined: 16 Mar 2006
Posts: 277

PostPosted: Mon Jun 23, 2008 5:13 am    Post subject: Reply with quote

Try to find out what those commands DO.... It will be better :)
Back to top
View user's profile Send private message
ab5000



Joined: 06 May 2008
Posts: 74

PostPosted: Mon Jun 23, 2008 9:56 pm    Post subject: Reply with quote

Look at this: http://starlet.deltatel.ru/disk$axpdocsep042/network/tcpip54/socket/6529pro_023.html#app_ioctl_commands

but I can't find the codes...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group