PS3 Psl1ght development

DaddyL33T

Forum Noob
Hello, this is my first post on psx-place. I am new to developing for the ps3. I have 10years in c experience, and modded ps3 back in 2015.

My question is how can I use system calls on latest ps3 toolchain and psl1ght. I cannot find any syscall functions within the psl1ght header files. I built using ps3 toolchain ./toolchain.sh

I have a simple Gui menu program I am developing. The idea is to be able to dump, write, and extract info from my flash. I messed up not installing hfw 2 times so my ROS doesn't match. I believe reflashing my dump will solve this issue but I cannot find resources besides hardware flashers for this. I cannot boot into recovery is my issue.

I run evilnat cfw and when I press cobra information in the custom firmware tools I get this response.

fw type: dex cobra
cobra version: 8.5 (debug)
cobra fw version: 4.92
syscall 8: enabled
external cobra: disabled

Im trying to use the cobra system calls in psl1ght to write and dump my flash. AI hasnt been useful for this. Like I said above I cannot find a syscall function, however AI has provided asm functions as a replacement. Syscall 8 with op code 0x7777 is supposed to check if cobra is enabled but this just crashes my ps3 to a blinking red light. I cannot find any documents on using the cobra system calls.

Will someone share some examples code on using cobra system calls or provide some documentation on this topic? It would be appreciated.
 
iirc, how to use syscall functions is on psdevwiki. I haven't checked in years, but I could've sworn it explained how to use each syscall. there's around 1,000 of them, I believe, so I'd look there.
 
There is a guide for psl1ght and cygwin here on site, but it's like 5 years ago. We could use some updated version. I tried recently, but I had a lot of errors when tried to compile something as-is from GitHub. So, I guess something has changed
 
none of the replies are very useful. I am not using the official SDK like in xai_plugin or the ps3-advanced-toolset like in the provided answers. I am using psl1ght and ps3toolchain. There are some provided syscall functions but they do not compile properly.

Make file errors are here
Code:
excreation5859@penguin:/mnt/chromeos/removable/L33THAX/PS3HACKS/programs/ps3_hello_world$ make
gui.c
In file included from /mnt/chromeos/removable/L33THAX/PS3HACKS/programs/ps3_hello_world/source/gui.c:6:0:
/mnt/chromeos/removable/L33THAX/PS3HACKS/programs/ps3_hello_world/source/gui.c: In function 'is_cobra_enabled':
/opt/ps3dev/ppu/include/ppu-lv2.h:46:9: error: expected expression before 'register'
         register u64 p1 asm("3") = (a1);                                         \
         ^
/mnt/chromeos/removable/L33THAX/PS3HACKS/programs/ps3_hello_world/source/gui.c:72:15: note: in expansion of macro 'lv2syscall2'
     u64 ret = lv2syscall2(SYSCALL8_OPCODE, SYSCALL8_COBRA_STATUS_POINTER, (u64)&firmware_version_check);
               ^~~~~~~~~~~
/opt/ps3dev/ppu/include/ppu-lv2.h:56:37: error: 'p1' undeclared (first use in this function); did you mean 'p8'?
                              : "=r"(p1), "=r"(p2), "=r"(p3), "=r"(p4),           \
                                     ^
/mnt/chromeos/removable/L33THAX/PS3HACKS/programs/ps3_hello_world/source/gui.c:72:15: note: in expansion of macro 'lv2syscall2'
     u64 ret = lv2syscall2(SYSCALL8_OPCODE, SYSCALL8_COBRA_STATUS_POINTER, (u64)&firmware_version_check);
               ^~~~~~~~~~~
/opt/ps3dev/ppu/include/ppu-lv2.h:56:37: note: each undeclared identifier is reported only once for each function it appears in
                              : "=r"(p1), "=r"(p2), "=r"(p3), "=r"(p4),           \
                                     ^
/mnt/chromeos/removable/L33THAX/PS3HACKS/programs/ps3_hello_world/source/gui.c:72:15: note: in expansion of macro 'lv2syscall2'
     u64 ret = lv2syscall2(SYSCALL8_OPCODE, SYSCALL8_COBRA_STATUS_POINTER, (u64)&firmware_version_check);
               ^~~~~~~~~~~
Here is the actual code for that list of make errors
Code:
#define SYSCALL8_OPCODE 8
#define SYSCALL8_COBRA_STATUS_POINTER 0x7000 // Common function ID for getting status/version

int is_cobra_enabled() {
    int cobra_status_address = 0; // Pointer to receive data
    int firmware_version_check = 0; // The actual version/status written here

    // Syscall 8 is the opcode. The first argument (r3) is the function ID (0x7000).
    // The second argument (r4) is the pointer to the destination.
    u64 ret = lv2syscall2(SYSCALL8_OPCODE, SYSCALL8_COBRA_STATUS_POINTER, (u64)&firmware_version_check);
    // If you used lv2syscall1: it would be lv2syscall1(8, 0x7000) (no pointer arg) which is wrong.

    // Your original code structure is closer to the correct format:
    // int ret = lv2syscall1(COBRA_SYSCALL_FIRMWARE_INFO, (u64)&cobra_status);
    // This implies COBRA_SYSCALL_FIRMWARE_INFO IS the opcode 8, and the function ID
    // is hardcoded internally, which is highly unlikely for a CFW status call.
    
    // **The most common, correct structure for a pointer-based check is lv2syscall2:**
    if (ret == 0 && firmware_version_check != 0) { // Check for success and a non-zero version
        return 1;
    }
    return 0;
}

When I finally found the systemcall functions this is my command prompt output.
Code:
excreation5859@penguin:/opt/ps3dev/psl1ght/ppu/include$ cat $PSL1GHT/ppu/include/ppu-lv2.h | grep "syscall"
#define lv2syscall0(syscall)                                                     \
        register u64 scn asm("11") = (syscall);                                  \
#define lv2syscall1(syscall,a1)                                                  \
        register u64 scn asm("11") = (syscall);                                  \
#define lv2syscall2(syscall,a1,a2)                                               \
        register u64 scn asm("11") = (syscall);                                  \
#define lv2syscall3(syscall,a1,a2,a3)                                            \
        register u64 scn asm("11") = (syscall);                                  \
#define lv2syscall4(syscall,a1,a2,a3,a4)                                         \
        register u64 scn asm("11") = (syscall);                                  \
#define lv2syscall5(syscall,a1,a2,a3,a4,a5)                                      \
        register u64 scn asm("11") = (syscall);                                  \
#define lv2syscall6(syscall,a1,a2,a3,a4,a5,a6)                                   \
        register u64 scn asm("11") = (syscall);                                  \
#define lv2syscall7(syscall,a1,a2,a3,a4,a5,a6,a7)                                \
        register u64 scn asm("11") = (syscall);                                  \
#define lv2syscall8(syscall,a1,a2,a3,a4,a5,a6,a7,a8)                             \
        register u64 scn asm("11") = (syscall);                                  \
excreation5859@penguin:/opt/ps3dev/psl1ght/ppu/include$

I really need to figure this out so I can start developing on my PS3. I need syscall 8 so I can mount my ex fat drive. Ps3 doesn't recognize it and I need to move files from the drive. I also still need to reflash my nor backup. Any ideas?
 
Back
Top