You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to modernize ps3toolchain and psl1ght, and thanks to the lessons learnt in https://github.com/vitasdk, I propose the following changes to psl1ght:
The latest versions of newlib include all the necessary C headers (socket.h, etc) so we should remove them from psl1ght (they generate conflicts...), and the implementation of those functions should go to newlib.
Add a NID database (like this one) and use it to generate the *_stub.a with a tool/script
Make the function prototypes/enums/structs consistent: if the header is for an import named cell*, all the symbols in such header should begin with cell for functions, Cell for structs / enums, and CELL_ for constants (e.g., netCtlInit should be named cellNetCtlInitand the struct net_ctl_nat_infoshould be typedef struct CellNetCtlNatInfo { ... } CellNetCtlNatInfo;.
All the syscalls should be in lowercase snake_case with the sys_ prefix.
As a PoC, I've already written a python script (I can port it to C if necessary) that generates an assembly file that gets compiled into the *_stub.a given a yml database. For example, given this input, it generates this output, which is easily compilable with ppu-as -mregnames -c cellCamera.s -o libcellCamera_stub.o.
This script can be useful to dump NIDs and libraries/modules information from an ELF file.
Reacted by Alexandro Sanchez Bach, 0x199, Sunguk Lee, Francisco José García García, Naomi Peori, Z80, zecoxao, emukidid, Damián Parrino, crystalct and 2 more
I guess the renaming of typedefs and constants will break API compatibility; should we provide a backwards compat header to add the old names back as aliases? I'm guessing it's not that important and that we should not mess up the new code because of it.
Well, my idea was that old homebrews can continue using the old version while new ones (or if they want to port) can use the newer version. Both versions could co-exist on the same system by changing the PSL1GHT environment variable when compiling.
Another important feature that we should target is the ability to generate PRXes.
EDIT: After thinking a bit more about PRXes:
A PRX needs to have:
ELF's e_entry = 0 (or any value?, it isn't used)
The first LOAD segment contains the sys_prx_module_info_t struct
A PRXRELOC segment
So the options for the base ELF are:
Generate a PIE executable (DYN ELF).
Generate a regular executable ELF with the linker option -q(--emit-relocs). ← This is what VitaSDK does.
Then run a tool, let's call it psl1ght-prx-gen, that given the ELF and a list of exports, it walks the symtable, creates the sys_prx_module_info_tand converts the standard ELF relocations to the PRXRELOC segment.
For the imports, simply by linking with lib*_stub.a would add a .lib.stub section, then psl1ght-prx-gen will make the sys_prx_module_info_t::imports_start point to them.
Another utility of psl1ght-prx-gen (or psl1ght-libs-gen) would be to generate the .yml file of the exports, so other .sprx/.self can import those exports.
@grepwood I mean if we implement what I propose on this ticket, then those headers would be in newlib. Actually your comment at #67 (comment) started a totally off-topic discussion.
I'm really happy to see that this RFC is being discussed again 👍
getting PSL1GHT to build .sprx binaries would be a dream, providing a full open-source solution for PS3 development. 😄
I'm not the most senior developer in these kind of topics and a lot of stuff might be way over my head, but I'll be happy to help. Even with just basic stuff like building the NID database, by going to the psdevwiki and copying all the stuff to the db.yml file.
Biggest problem I always have is setting up the whole enviroment, I'm from the kind of developer that just installs the IDE and starts developing. I once started with PS3 dev through a virtual machine, but after a couple of upgrades of Linux and every single time something was broken, I just gave up, also tried through the one on windows but that also went fubar after I had to reinstall windows, never got around of reinstalling it again.
I was working on a Tiny Tower port for the PS3 (didn't get really far yet as at that time an linux upgrade fubarred the whole setup).
@xerpi I hate to rain on your parade but the headers I'm looking for to realize the Quake 3 port are still available only in the phoenix, rtems and Linux targets of newlib. Which one is psl1ght using?
@xerpi I hate to rain on your parade but the headers I'm looking for to realize the Quake 3 port are still available only in the phoenix, rtems and Linux targets of newlib. Which one is psl1ght using?
Linux ppc64 - we would patch it to target the ppc64 arch if it wasn't supported, on a different branch. Then we would check out that branch for the submodule.
Sorry to "bump" the thread, especially since I'm brand new to the scene, but I'd be more than happy to help make this happen. I was planning on working on porting/moving the net code over to newlib myself as a start (and to add some missing stubs in net code I need), but maybe having the NID DB and generating the .a's would be a better place to start.
Before you start using newlib-3.3.0 you might want to see how every version of newlib since 2.5.0.20170519 is broken for the spu target https://bugs.gentoo.org/732206
I've managed to get from my old laptop the folder containing the v3 experiments I was doing regarding stub generation. I have re-uploaded the files that had broken links (now those files should be permanent, I'm using gist.github):
For example, given this input, it generates this output, which is easily compilable with ppu-as -mregnames -c cellCamera.s -o libcellCamera_stub.o.
I have also uploaded a tool that can be helpful to examine the NIDs and libraries/modules of ELF files: nidreader.py.
Is there still interest in this?
By modifying the python script xerpii posted above and pairing it with the nids.txt file from PS3GhidraScripts I was able to make a complete db.yml of all the prx in /dev_flash/sys/external, although some functions are unfortunately unnamed (but should be possible to brute force them)
Activity
zeldin commentedon Dec 2, 2017
Sounds nice.
I guess the renaming of typedefs and constants will break API compatibility; should we provide a backwards compat header to add the old names back as aliases? I'm guessing it's not that important and that we should not mess up the new code because of it.
xerpi commentedon Dec 2, 2017
Well, my idea was that old homebrews can continue using the old version while new ones (or if they want to port) can use the newer version. Both versions could co-exist on the same system by changing the
PSL1GHTenvironment variable when compiling.Another important feature that we should target is the ability to generate PRXes.
EDIT: After thinking a bit more about PRXes:
A PRX needs to have:
e_entry = 0(or any value?, it isn't used)LOADsegment contains thesys_prx_module_info_tstructSo the options for the base ELF are:
-q(--emit-relocs). ← This is what VitaSDK does.Then run a tool, let's call it
psl1ght-prx-gen, that given the ELF and a list of exports, it walks the symtable, creates thesys_prx_module_info_tand converts the standard ELF relocations to the PRXRELOC segment.For the imports, simply by linking with
lib*_stub.awould add a.lib.stubsection, thenpsl1ght-prx-genwill make thesys_prx_module_info_t::imports_startpoint to them.Another utility of
psl1ght-prx-gen(orpsl1ght-libs-gen) would be to generate the .yml file of the exports, so other.sprx/.selfcan import those exports.psl1ght-prx-gen -> .yml -> psl1ght-libs-gen -> .a{.elf + exports.yml} -> psl1ght-prx-gen -> .sprxxerpi commentedon Dec 4, 2017
A lot of the explained ideas are inspired by: https://wiki.henkaku.xyz/vita/images/a/a2/Vita_SDK_specifications.pdf.
grepwood commentedon Jun 16, 2020
3 cents anyone? Proper network stack support. I'm currently breaking my back porting github.com/ec-/Quake3e.
miigotu commentedon Jun 16, 2020
@grepwood what do you need from us? Ill help if I can.
grepwood commentedon Jun 17, 2020
@miigotu https://github.com/ec-/Quake3e/issues/55 we are missing a lot of headers normally found on Linux and BSD:
xerpi commentedon Jun 17, 2020
@grepwood I think those headers should be installed by newlib and not provided by this PSL1GHT. Check the first bullet of the first comment.
grepwood commentedon Jun 17, 2020
@xerpi Right. I'll recompile ps3toolchain then. Is https://github.com/ps3dev/ps3toolchain this the correct repo?
xerpi commentedon Jun 17, 2020
@grepwood I mean if we implement what I propose on this ticket, then those headers would be in newlib. Actually your comment at #67 (comment) started a totally off-topic discussion.
miigotu commentedon Jun 17, 2020
@xerpi I'm with you all the way except the db/stub. How are those addresses generated?
xerpi commentedon Jun 18, 2020
There's a list of NIDs here: https://www.psdevwiki.com/ps3/VSH_Exports
bucanero commentedon Jun 18, 2020
I'm really happy to see that this RFC is being discussed again 👍
getting PSL1GHT to build
.sprxbinaries would be a dream, providing a full open-source solution for PS3 development. 😄I'm not the most senior developer in these kind of topics and a lot of stuff might be way over my head, but I'll be happy to help. Even with just basic stuff like building the NID database, by going to the psdevwiki and copying all the stuff to the
db.ymlfile.crystalct commentedon Jun 19, 2020
I'm new in PS3 homebrew development.. but i'm here.
SuperDre commentedon Jun 19, 2020
Biggest problem I always have is setting up the whole enviroment, I'm from the kind of developer that just installs the IDE and starts developing. I once started with PS3 dev through a virtual machine, but after a couple of upgrades of Linux and every single time something was broken, I just gave up, also tried through the one on windows but that also went fubar after I had to reinstall windows, never got around of reinstalling it again.
I was working on a Tiny Tower port for the PS3 (didn't get really far yet as at that time an linux upgrade fubarred the whole setup).
grepwood commentedon Jun 19, 2020
@xerpi I hate to rain on your parade but the headers I'm looking for to realize the Quake 3 port are still available only in the phoenix, rtems and Linux targets of newlib. Which one is psl1ght using?
miigotu commentedon Jun 19, 2020
Linux ppc64 - we would patch it to target the ppc64 arch if it wasn't supported, on a different branch. Then we would check out that branch for the submodule.
dee12452 commentedon Jul 1, 2020
Sorry to "bump" the thread, especially since I'm brand new to the scene, but I'd be more than happy to help make this happen. I was planning on working on porting/moving the net code over to newlib myself as a start (and to add some missing stubs in net code I need), but maybe having the NID DB and generating the .a's would be a better place to start.
miigotu commentedon Jul 1, 2020
@dee12452 absolutely. Since we will have several things going on at the same time, just make the PRs to the develop branch.
grepwood commentedon Jul 11, 2020
Before you start using newlib-3.3.0 you might want to see how every version of newlib since 2.5.0.20170519 is broken for the spu target https://bugs.gentoo.org/732206
xerpi commentedon Sep 10, 2020
I've managed to get from my old laptop the folder containing the v3 experiments I was doing regarding stub generation. I have re-uploaded the files that had broken links (now those files should be permanent, I'm using gist.github):
I have also uploaded a tool that can be helpful to examine the NIDs and libraries/modules of ELF files: nidreader.py.
Fancy2209 commentedon Jul 18, 2025
Is there still interest in this?
By modifying the python script xerpii posted above and pairing it with the nids.txt file from PS3GhidraScripts I was able to make a complete db.yml of all the prx in /dev_flash/sys/external, although some functions are unfortunately unnamed (but should be possible to brute force them)
Fancy2209 commentedon Jul 18, 2025
Here's the DB for External and Internal PRX Exports:
db_external.yml.txt
db_internal.yml.txt
Here's the modified script:
Fancy2209 commentedon Aug 20, 2025
I have made a database of all SPRX (and some vsh exports)
https://github.com/Fancy2209/Cell-Headers/tree/master/db
now we just need to update the headers based on the real func names and make ones for all the previously missing functions