Discussioni, news, guide, non pertinenti con le altre sezioni hacking del forum.
Avatar utente
User

KyRt

Livello

Ps3ita Team

Messaggi

801

Iscritto il

17 ott 2010, 10:17

Località

Bologna

PSN ID

kyrtolo

FW

3.55Kmeaw, 4.50 DEX Ps3Ita

How to call Syscalls By Deroad

da KyRt » 9 feb 2012, 8:40

Deroad è uno dei tanti dev che stanno contribuendo alla scena con le sue spiegazioni e homebrew, l'ultimo suo tutorial riguarda una guida su come richiamare le syscalls del monolite nero...
Buona lettura :super:
In computing, a system call (aka Syscall) is how a program requests a service from an operating system's kernel. This may include hardware related services (e.g. accessing the hard disk), creating and executing new processes, and communicating with integral kernel services (like scheduling). System calls provide the interface between a process and the operating system.
(Wikipedia - System Call)

With PSL1GHT we can call all the 989 Syscalls.
it's really simple to call one, but you need to know how many parameters it needs; there are some syscalls that needs just 1 parameter, there are others that needs 8 parameters.

You can find the list of syscalls with the numbers of the parameters here: Ps3DevWiki Syscalls

Once you know the numbers of the parameter that you need (and the type of the parameters if they are written), you are ready to call one:

first thing add the following include:

#include <ppu-lv2.h>

Then you can call the syscall:

lv2syscallN(number_of_the_syscall, parameters... );
Change N with the number of the parameters, and put the number of the syscall that you need to call with the parameters.
some examples:

Shutdown the PS3:
1)Look into the dev wiki and you will see that the syscall to shutdown the PS3 is number 379 ( sys_sm_shutdown ) and it wants 4 parameters:
2)So now i can call the syscall with 4 parameters:

lv2syscall4(379,SHUTDOWN_PARAM,0,0,0);
now on the wiki it says, that the shutdown value is 0x1100 or 0x100, so i will write:
lv2syscall4(379,0x100,0,0,0)

now if i call this on a stupid homebrew like:
#include <ppu-lv2.h>
int main(){
lv2syscall4(379,0x100,0,0,0);
return 0;
}

it will really shutdown the ps3.

now if you are not sure to completely understood this, i will make another example:
Get current time:
now this example comes from the PSL1GHT SDK:

this is the function that get the current time on the ps3.

#include <ppu-lv2.h>
s32 sysGetCurrentTime(u64 *sec,u64 *nsec)
{
lv2syscall2(145,(u64)sec,(u64)nsec);
return_to_user_prog(s32);
}

now it uses 2 parameters so it calls lv2syscall2, then it needs the parameters that will get the value sec and nsec. now, in this function you can see that it ask the return of this syscall; to call any return of a determinate syscall, you can simply ask it by calling:

return_to_user_prog(type_of_the_variable);

you need to define the type of the returning variable. in that case it was s32 (aka signed int).
so it calls:
return_to_user_prog(s32);

if it was a normal integer, you had to call:
return_to_user_prog(int);

to compile it correctly you need to simply add the following flags:

-llv2

Fonte: http://ps3tutorials.wikispaces.com/How+to+call+Syscalls
Avatar utente
User

Rancid(o)

Livello

Ps3ita Team

Messaggi

4205

Iscritto il

19 dic 2006, 15:22

Località

nell' anno 1977

PSN ID

Rancid0x0

FW

4.05

Re: How to call Syscalls By Deroad

da Rancid(o) » 9 feb 2012, 14:57

Molto utile.. :amen:
Avatar utente
User

Zz_SACRO_zZ

Livello

Ps3ita Team

Messaggi

1512

Iscritto il

16 mar 2011, 1:03

PSN ID

Zz_SACRO_zZ

FW

ofw-4.05

Re: How to call Syscalls By Deroad

da Zz_SACRO_zZ » 9 feb 2012, 16:04

...veramente molto utile per tutti gli sviluppatori e smanettoni :super: !
...non pensavo che fossero 989 8| !
Zz_SACRO_zZ
-PSXITA TEAM-
Avatar utente
User

KyRt

Livello

Ps3ita Team

Messaggi

801

Iscritto il

17 ott 2010, 10:17

Località

Bologna

PSN ID

kyrtolo

FW

3.55Kmeaw, 4.50 DEX Ps3Ita

Re: How to call Syscalls By Deroad

da KyRt » 9 feb 2012, 16:20

Se vuoi studiartele eccoti il link con l'elenco da completare :diable:
http://www.ps3devwiki.com/wiki/LV2_Functions_and_Syscalls
auguri :happy1:
Avatar utente
User

Zz_SACRO_zZ

Livello

Ps3ita Team

Messaggi

1512

Iscritto il

16 mar 2011, 1:03

PSN ID

Zz_SACRO_zZ

FW

ofw-4.05

Re: How to call Syscalls By Deroad

da Zz_SACRO_zZ » 9 feb 2012, 16:24

...bella kyrtolo !
...adesso che ci sono più strumenti con cui lavorare direi che qualcuno deve sbrigarsi con le benedette clip e finire il suo periodo di ferie, o no :hehe: !
Zz_SACRO_zZ
-PSXITA TEAM-
Avatar utente
User

Rancid(o)

Livello

Ps3ita Team

Messaggi

4205

Iscritto il

19 dic 2006, 15:22

Località

nell' anno 1977

PSN ID

Rancid0x0

FW

4.05

Re: How to call Syscalls By Deroad

da Rancid(o) » 9 feb 2012, 16:34

:siffle:

Chi c’è in linea

Visitano il forum: Nessuno e 0 ospiti

Powered by phpBB ® | phpBB3 Style by KomiDesign