docs(debt): count the flags local titles pass to sceNetSend and sceNetSendto #12707
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12707"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-29T03:57:18Z.
What
The entry then reads (the new part is its last sentence; a full stop was added before it):
Changed:
docs/dev/debt/libSceNet.md, one existing entry extended by one sentence. No code change.Method: for each of 53 local titles the import table of the title's executable was read, and every direct
callto thesceNetSendorsceNetSendtoimport was located in that executable. The flags argument (the fourth,ecx) is read from the last instruction before the call that writesecx/rcx:xor %ecx,%ecxcounts as 0 andmov $imm,%ecxas that constant; any other writer counts as not constant. Tail jumps (jmp) to the import are counted separately and not read. Title libraries (sce_module,prx) were not read, and calls through function pointers are not found. Static reading only, nothing run on a console; no game code is attached.Per-title results and the counting script are attached to this PR. Counting: a site is a direct
callto the import; the 2 tail jumps tosceNetSendto(one title) are listed but not read, sosceNetSendtohas 49 read sites plus 2 tail jumps (51). A site whose last writer ofecxis notxorormov $immis counted as not constant (1 for each function; both are pass-through wrappers that load the value from memory).Limitation of the reading: the backward walk stops at the first branch or call, but does not detect a branch target between the writer and the call, so a writer on another path could be counted. One of ten hand-checked sites had its writer further back than six instructions; it was still on the straight-line path. Calls through the GOT (
call [rip+got]) would not be read either; in these executables every registry call site of both imports is a stubjmp [rip+got], so there are none.Per-title result (35 titles call at least one of the two)
sceNetSendsites (flag)sceNetSendtosites (flag)Totals:
sceNetSend49 sites (0 x47, 0x80 x1, not constant x1);sceNetSendto51 (0 x39, 0x80 x9, not constant x1, tail jump x2). Titles without either import are not listed.Overlap
Twelve open PRs change
docs/dev/debt/libSceNet.md; none changes this entry. #12665 changes thesceNetInetPton/sceNetInetNtopentry; #12455, #12104, #11968, #11966, #11571, #11272, #10629, #9948 and #9578 change other entries, andgit merge-treeof this branch against each of their heads is clean. #9932 and #5836 already conflict withmainin other parts of the file (and, for #5836, in code); their conflicts are the same with this branch. Measured on the file sets of all open PRs (git diff --name-onlyfrom each PR head's merge base withmain).Tested
Documentation only.
tools/check_conventions.py --base upstream/mainpasses; based on currentmainb433c40f2f. Not built, not run.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)AI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-29T04:04:45Z.
Review: COMMENTED
I reviewed the attached data and script. I ran nothing on title code: I don't have the 53 executables, and I only ran the posted script on synthetic input.
What I checked (head
ae4fbac236, mainb433c40f2f)git merge-tree --write-tree upstream/maincheck_conventions.py --base upstream/main --headgit diff --checksceNetSend49 = 47×0 / 1×0x80 / 1 non-constant;sceNetSendto51 = 39×0 / 9×0x80 / 1 non-constant / 2 tail jumps → 86 / 10 / 2 / 2. These match the new sentenceExport.cppL1273/L1300 (DONTWAIT | NOSIGNALaccepted)The attachment has what #12665's reviewers asked for: per-site addresses, the script, and how tail jumps and non-constant values were handled. Thanks.
Two gaps in the posted script (tested on synthetic input)
1.
classify()skips some instructions that writeecx.DEST = r',%(rcx|ecx|cx|cl)$'only matches a register in the last operand after a comma. When one of these instructions sits between the counted writer and the call, the script still reports the earlier constant:callxor %ecx,%ecx; push %rax; pop %rcx0xor %ecx,%ecx; inc %ecx0mov $0x80,%ecx; neg %ecx0x80xor %ecx,%ecx; bswap %ecx/xchg %ecx,%eax/mov $0x2,%ch/cpuid0mov $0x10,%rcx; rep stos …0x10mov $0x80,%ecx; bnd jmp …0x80None of these is likely right before a call in compiler output, so the totals probably don't change. Still, the sentence's "never 0x40000000 or 0x20000" and "0 at 86" rest on this walk. A stricter
classify(diff below) gives the right column for all 18 synthetic cases I tried and the same answer as the posted script for the 9 ordinary ones (xor, mov imm, movq, lea, memory load,cmp/push/source reads of ecx). Could you rerun with it and say in the body whether any site changes?2. Calls straight through the GOT are not counted. The relinker's
callSites(CallSiteResolver.cppL67-104) are every RIP-relativeFF /2../6orREX.W 8Bthat refers to the import's slot. That includes the PLT stub'sjmp [rip+got], and also a title's owncall [rip+got](FF 15) andmov rax,[rip+got]. The script treats each listed address as a stub and only countsE8/E9 rel32that target one. I built a one-segment ELF plus registry with a PLTjmp [got], a tailjmpto it, acall [rip+got]and amov rax,[rip+got], all onsceNetSend. The script reports only the tail jump; theFF 15call is silently left out. The body says "every directcallto thesceNetSendorsceNetSendtoimport was located", so could you report, per title, how many registrycallSitesare not stub-startFF 25(0 would settle it)? Otherwise, add "calls through the GOT (call [rip+…]) are not read" to the limits.Wording nit
"(libraries, 2 tail jumps unread)" is hard to parse. Maybe: "in their executables (title libraries and 2 tail jumps not read), flags are …".
Docs-only change, and the sentence is consistent with the code. Neither gap is likely to change the numbers, so this is a comment, not a change request.
AI-assisted: yes