feat(libSceJsc): implement WTF::pageMask #19989
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19989"
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 MatteoSid on 2026-11-14T10:23:43Z.
What
Implements
WTF::pageMask()in libSceJsc (_ZN3WTF8pageMaskEv, NIDrIKEui9oRJg), until now aNotImplemented_nid_no_patchstub. It follows pinned WebKitc55364d53f97, the revision the other libSceJsc WTF code already pins.~(pageSize() - 1). OnOS(UNIX),pageSize()issysconf(_SC_PAGESIZE). The PS5 compiler defines__FreeBSD__, which givesOS(FREEBSD)and soOS(UNIX)(PlatformOS.h, L124-L136).sysconf(47)(_SC_PAGESIZE). It returnsPS5_PAGE_SIZE, 16384, the value thehw.pagesizeentry indocs/dev/debt/libkernel.mdmeasured on a PS5 (firmware 13.60, by name and by MIB) and found as a constant in firmware 10.01 kernel data. SopageMask()is0xFFFFFFFFFFFFC000. libSceJsc now links libkernel privately, as libSceNKWebKit already does.RELEASE_ASSERTs that the page size is a power of two and not aboveCeilingOnPageSize, which PageBlock.h sets to 16 KiB forPLATFORM(PLAYSTATION). Both checks throwstd::runtime_errorwhere WebKit crashes. The page size and mask are computed once, as WebKit caches them.src/WtfPageBlock.cppfollows that control flow, so it starts with the PageBlock notice copied verbatim, plus aDerived fromline, as the other libSceJsc WTF files do.Reachability:
pageMask()takes no arguments and needs no object, so any module that imports it from libSceJsc reaches it directly. JSC and WebKit code use it, throughPageBlockand page-rounding helpers, to align allocation sizes and addresses.Gaps, in a new debt entry: not compared with a console module, and the console WTF version is unverified. libSceNKWebKit's own
WTF::pageSize()(src/WtfSystem.cpp) returns 4096, which does not match this 16 KiB mask; that export is outside this PR. The "Additional callable exports" count goes from main's 322 to 321.Tested
Linux (Ubuntu 24.04 container, GCC 13.3), Release,
-DBUILD_TESTING=ON, on headfa8461e12bbased onmainb96058f793: builtlibSceJsc, the patchedcore/libs/libs/libSceJsc.prxand every libSceJsc test target.ctest -R '^(guest_jsc_string|jsc_placement_new|jsc_wtf_string_search|jsc_wtf_random|jsc_wtf_url|guest_jsc_trivial_returns|jsc_wtf_helpers|jsc_wtf_page_block|guest_jsc_register_sets_and_constructors|jsc_wtf_sha1|guest_jsc_script_value|jsc_wtf_bit_vector|public_headers)$'passes 13 of 13.The new
jsc_wtf_page_blockchecks exact values:pageMask()is0xFFFFFFFFFFFFC000;~mask + 1is 16384;0x12345678 & maskis0x12344000.All 6 mutations, applied one at a time, make it fail:
sysconf(48)instead of 47;~pageSize();pageSize() - 1without the~;nm -Don the patchedlibSceJsc.prxlistsrIKEui9oRJgat the address of_ZN3WTF8pageMaskEv.tools/check_conventions.py --base origin/main --head HEADpasses andgit diff --checkis clean.tools/pr_overlap.py --branchmerged the open PRs it could and found no overlap. It could not compare #18430, #18442 and #19772, which conflict withmain, so I checked them by hand:WTF::Unicodedeclarations and table rows two lines abovepageMask, withJSONImpl::Value::escapeStringunchanged in between;None of them touches
pageMask, and no open PR mentionspageMaskorrIKEui9oRJg. No title tested.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)Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-14T10:46:48Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
fa8461e12b:tools/check_conventions.pypassed;git diff --checkclean.jsc_wtf_page_block_testsbuilt cleanly.jsc_wtf_page_block):core/libs/prx/libSceJsc/Export.cpp,core/libs/prx/libSceJsc/include/InventoryExports.hpp,core/libs/prx/libSceJsc/libSceJsc.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T13:19:50Z.
Review: COMMENTED
Reviewed — no blocking findings
No blocking defect was found in the inspected implementation; approval is not justified because the reported checks were not run in this review and console behavior remains unverified.
What I ran
Inspected the prepared diff and targeted source at head
fa8461e12b74f12539fa4765b9d31b1337a036cdusingrepo_read.pyreader tools. No build or tests were run here; test results in the PR description are author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Sources
sysconf(47), checks the page size, and caches the mask.PS5_PAGE_SIZE.Not verified
No build, test, or console run was performed during this review. The reported Linux build and 13 passing tests are author-reported. The changed source, header, and test files excluded from the prepared diff by rule were read through the reader; other repository files were not exhaustively read.
To get this to a good state
Nothing is required. Optional: confirm the behavior against a console module or console WTF implementation.