mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-22 16:43:05 -05:00
5.9 KiB
5.9 KiB
libSceLibcInternal technical debt
Unknown function info
- _sceLibcInternalThreadAtexit, _sceLibcInternalThreadDtors (libSceLibcInternal) - FreeBSD
__cxa_thread_atexitsemantics assumed; a null or non-image destructor and an allocation failure throw - _sceLibcInternalForceTlsDestructor (libSceLibcInternal) - behaviour follows
sceLibcForceTlsDestructor(int)in a title'slibc.prx(disassembly): the calling thread's destructors whose dso belongs to the module run newest first, only if the dso's module is loaded and the dso points to itself, in up to 4 passes. The return type is unknown (that function returns nothing), 0 is returned. The module of each dso is looked up when the destructors are forced, not when they are registered aslibc.prxdoes
Functional
- makecontext (libSceLibcInternal) follows FreeBSD 11's
lib/libc/amd64/gen/makecontext.c: at most six arguments, a stack of at leastMINSIGSTKSZ(2048) bytes, andexit(0)when the function returns with nouc_link. The console's version is not verified - makecontext (libSceLibcInternal) on Windows pins its stack writable until a later
makecontextstack overlaps it, since nothing tells the library when the guest frees the stack - Thread exit destructors (libSceLibcInternal) run when a libkernel thread finishes; on the main or a host thread only
_sceLibcInternalThreadDtorsruns them, asexitdoes, else they are dropped - fdopendir (libSceLibcInternal) - the directory stream starts at the directory's first entry, while FreeBSD's
fdopendirreads from the descriptor's current offset, andFD_CLOEXECis not set on the descriptor. As in FreeBSD, a descriptor that is not open fails withEBADF, one that is not a directory withENOTDIR(both leave it open), andclosedircloses it - fstatvfs (libSceLibcInternal) converts
_fstatfsto the 88-bytestruct statvfsas FreeBSD 9.2'ssfs2svfsdoes (f_bsizefrom the transfer size,f_frsizefrom the block size,f_favailequal tof_ffree,f_fsid0,ST_RDONLYandST_NOSUIDonly). Differences:f_namemaxis thestatfsvalue, notfpathconf(_PC_NAME_MAX); negativef_bavailandf_ffreewrap to unsigned withoutEOVERFLOW, as the same-width copy in FreeBSD does; inode counts are 0 on Windows, inherited from_fstatfs; a null output returnsEFAULTafter the descriptor is validated, where FreeBSD would fault. Layout and conversion are unverified against the PS5 library (PS5MC importsfstatvfsbut was not run) - posix_spawn and posix_spawnp (libSceLibcInternal) throw: creating a child process is not supported. PPSA99305 (Dusklight) and PPSA99309 (Wind Waker) stop on
mainat unresolved import44hlATrd47U(posix_spawnattr_init); a run with this PR has not established how far either title gets, and process creation still throws. The attribute and file action calls keep FreeBSD 11.4's objects, so a realposix_spawnwould have to apply them in the child. Null or uninitialized objects, which FreeBSD dereferences, throw. - getopt, getopt_long (libSceLibcInternal) follow FreeBSD 11 getopt.c and getopt_long.c with
GNU_COMPATIBLE:getoptdoes not permute,getopt_longpermutes unlessPOSIXLY_CORRECTis set in the guest environment or the option string starts with+, and the exportedopterr,optind,optopt,optresetandoptargstart at 1, 1, 0, 0 and null. Warnings go to the guest's currentstderrprefixed with__progname, where FreeBSD'swarnxkeeps thestderrof its first call. A nullgetoptoption string, a null argument vector or argument, a negativeoptindand anoptindmoved inside a pending permutation throw where FreeBSD faults.getopt_long_onlyis not exported. That the console'slibSceLibcInternaluses this FreeBSD code is unverified - posix_spawnattr_getflags, getpgroup, getschedparam, getschedpolicy, getsigdefault, getsigmask, setpgroup, setschedparam, setschedpolicy and setsigmask (libSceLibcInternal) read and write the 0x30-byte attribute object at the offsets of the console's
libSceLibcInternal.sprx(SDK 4.5x build ofJ03950001, 0x8D860 to 0x8D910: flags at 0, process group at 4, scheduling parameter at 8, policy at 0xC, default and masked signal sets at 0x10 and 0x20), which never fail there and return 0; the layout matched on a PS5 (firmware 13.60). Uninitialized attributes and null pointers, which the console dereferences, throw as the existing setters do - sys_siglist and sys_nsig (libSceLibcInternal) hold the 32 descriptions and the count of FreeBSD 11.4
siglist.c(NSIG32, signal 0 toSIGUSR2); the console's table was not read - inet_aton, inet_addr, inet_ntoa and inet_ntoa_r (libSceLibcInternal) follow the FreeBSD code in the console's
libSceLibcInternal.sprx(SDK 4.5x build ofJ03950001, 0x8ADE0 to 0x8B3D0) and matched it on a PS5 (firmware 13.60) for 20inet_atoninputs; a null text, which the console dereferences, throws