Skip to content

docs(debt): record libSceFios2 init parameters and error mapping from the PS4 module - #14869

Merged
oneandonlydean merged 3 commits into
boykopovar:mainfrom
ntamas94:claude/elegant-pascal-2uae4z
Nov 4, 2026
Merged

oneandonlydean merged 3 commits into
boykopovar:mainfrom
ntamas94:claude/elegant-pascal-2uae4z

Conversation

@ntamas94

@ntamas94 ntamas94 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

What

Documentation only. Records in docs/dev/debt/libSceFios2.md what the PS4 firmware module settles for sceFiosInitialize, sceFiosUpdateParameters and sceFiosIsInitialized, the SceFiosParams defaults, the kernel error mapping and the error code names. Main now implements these functions and declares the error constants. The entries record the remaining differences in parameter validation, defaults, update semantics and kernel-error mapping; no code changes.

Source, per reading titles and libraries: the PS4 libSceFios2.sprx whose init banner reports SDK 0x10710001, read from its disassembly. No binary is attached.

PS4 console probe supplement — firmware 10.710.001, SDK 0x05050001, neo_mode=0: all 62 exports in this debt list received a dump-guided probe invocation. These are bounded observations of selected inputs and branches, not a complete valid-input conformance suite. An initial incorrect sceFiosTraceTimestamp signature crashed; the dump-guided mutable-buffer call then returned two terminated timestamp strings with adjacent guard bytes intact. The null-descriptor sceFiosIOFilterPsarcDearchiver path repeatedly returned 0x80820006. Three async directory-create attempts returned raw 0 and created no kernel-visible directory.

The last sceFiosArchiveSetDecompressorThreadCount probe used a fresh, uninitialized module: getter 0, setter(1) raw 0, getter still 0, then successful module stop/unload. This does not exercise initialized worker callbacks. Probe results are PS4 evidence only and do not establish PS5 parity.

What the module shows:

  • NULL params: test rbx,rbx; je leads to mov r15d,0x80820006 (BAD_PTR) and "sceFiosInitialize: NULL parameters."
  • paramsSize: bextr esi,[rbx],0xf01; cmp esi,0xb0; jne leads to 0x80820008 (BAD_SIZE) and "Unsupported paramsSize (%d, most recent is %d)".
  • schedulerAlgorithm: movzx esi,BYTE PTR [rbx+0x19]; cmp esi,0x4; jae leads to 0x80820021 (BAD_FLAGS).
  • Reserved fields: the u32 at 0x04, the bytes at 0x1a and 0x1b and the u64s at 0x20, 0x28 and 0x80 are compared with zero, and extraFlags fails on cmp eax,0x3; ja or and eax,0x1; jne. All lead to 0x80820008 and "A reserved, padding, or extraFlags field is not zero."
  • Second call: prints "FIOS has already been initialized. Updating parameters with new values.", calls sceFiosUpdateParameters and returns 0 before the size check.
  • sceFiosUpdateParameters: and eax,[rdi] with 0xfffe, then cmp eax,0x160; it also returns early before init. It copies 0x14, 0x70, 0x78 and 0x88 to 0x9c.
  • Defaults: each cmp against -1, 0 or a minimum is followed by a store of the default listed in the entry.
  • Before init: test BYTE PTR [params],0x1; je skips the scheduler, and the call goes to sceKernelRead, sceKernelOpen or sceKernelTruncate directly.
  • Kernel errors: one routine with 47 callers indexes a jump table with lea ecx,[rax+0x7ffdffff]; cmp ecx,0x58. Its default case, test eax,eax; jle, returns any other negative code unchanged. In a PS4 libkernel_sys.sprx, 122 wrappers end in lea ecx,[rax-0x7ffe0000]; test eax,eax; cmovne eax,ecx, so a kernel code is 0x80020000 plus the errno.
  • Error names: the error-to-string routine switches on lea eax,[rcx+0x7f7e0000]; cmp eax,0x24 over 37 cases. Each case loads one SCE_FIOS_ERROR_* string, and 0x20 falls through to a number.

Sources disagree on one point. sonny-tel/libSceFios2 declares void sceFiosInitialize(SceFiosParams) with the struct by value. The module tests and dereferences rdi and returns the codes above. Every offset of that header's SceFiosParams matches the module.

The implementation is now on main. This PR preserves its debt entries and adds PS4 evidence for the remaining gaps; it implements nothing.

Tested

The 62 final PS4 probe cases passed their runner self-checks on firmware 10.710.001 (SDK 0x05050001, neo_mode=0). The AnyPS5 implementation was not run on console; no title-compatibility test or PS5 equivalence check was performed. python3 tools/check_conventions.py --base upstream/main reports 0 errors; its one warning is the existing over-long entry on line 5, which this change shortens. tools/pr_overlap.py needs GitHub GraphQL, which was unavailable where this was prepared; a REST search of open pull requests found only #12269 touching libSceFios2.

Refresh — 2026-11-03 (Codex, AI-assisted): Merged main 086c068. Rewrote the findings against Control.cpp, Runtime.cpp and Types.hpp: the exports and error constants already exist; the remaining gaps are parameter validation/layout/defaults, update semantics and kernel-error mapping. Documentation only. Conventions: 0 errors (the existing long pending-list warning remains); diff against main has no whitespace errors. No console or runtime tests were run for this refresh.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

… the PS4 module

Read from the disassembly of the PS4 libSceFios2.sprx whose init banner
reports SDK 0x10710001: the sceFiosInitialize, sceFiosUpdateParameters and
sceFiosIsInitialized contract, the SceFiosParams defaults, the kernel error
mapping and the error code names. Not measured on a console and not checked
against a PS5 module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wm5hiXXANzPqoVGkSdDP4q
@github-actions github-actions Bot added the docs label Nov 1, 2026
@oneandonlydean oneandonlydean self-assigned this Nov 1, 2026

@BunnyFl BunnyFl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A note on the source: the PS5 13.42 system dump I have has no libSceFios2.sprx under system/ or system_ex/, so I couldn't cross-check any of this against a PS5 module, unlike the PS4 one you read. If PS5 titles ship libSceFios2 themselves (in sce_module), those copies would be the stronger source, and AGENTS.md's rule on title-shipped modules may apply to how far this library gets reimplemented. It might be worth one line in the entry.

I can't verify the PS4 10.71 reading from here, so this is a comment rather than an approval. The new entries read cleanly. check_conventions.py warns only about main's existing long pending-list line (line 5), not about these entries.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Hi ntamas94,

#14869 now conflicts with main in docs/dev/debt/libSceFios2.md, and this one can't be merged mechanically, because main has implemented much of what the new entries describe as missing:

  • sceFiosInitialize, sceFiosIsInitialized and sceFiosUpdateParameters are implemented in core/libs/prx/libSceFios2/src/Control.cpp with their parameters (const SceFiosParams* returning int, SceFiosParams* returning bool, const SceFiosParams* returning void), so "still throw and declare no parameters" no longer holds, and they have left the pending list on main.
  • include/Types.hpp declares the SCE_FIOS_ERROR_ codes, so "none are declared" no longer holds. SceFiosParams is forward-declared there but has no layout yet, so your 0xb0-byte layout and defaults may still add something.
  • Main also split the long entries into separate bullets and removed the date/handle-validity entry (the dates and intervals are implemented).

Could you merge current main and rewrite the new entries against it? Keep what main still lacks (for example the SceFiosParams layout and defaults, the BAD_SIZE/BAD_FLAGS checks in init if main doesn't make them, and the kernel-error mapping if main doesn't apply it yet), and drop what main now implements. Thanks for the disassembly notes; the error-name table and the defaults are useful detail.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 2, 2026
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 3, 2026
@ntamas94

ntamas94 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

95d9dd4 shortens the initialization debt entry to 849 characters and completes the kernel-error differences: ENFILE/EMFILE (23/24) map to CANT_ALLOCATE_FH in the implementation but return unchanged in the PS4 module; ENAMETOOLONG (63) maps to PATH_TOO_LONG here but BAD_PATH there. The kernel-error entry is 816 characters.

Conventions against upstream/main report no findings. Whitespace, UTF-8 without BOM and mojibake checks pass. Documentation only. Normal push, no history rewrite. AI-assisted: yes (Codex).

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ AMD GPU test: passed

PR head 95d9dd4 merged onto main 5b1d381 · tested 2026-11-04 13:41 UTC · 18 min

GPU AMD Radeon RX 6300 (RADV NAVI24), driver Mesa 25.2.8-0ubuntu0.24.04.4, Vulkan 1.4.318
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-42-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 1,037 passed · 1 failed (0 new, 1 also fail on main) · 4 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 1,042 of 3,883 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (524 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_image_sample_unnormalized 42.4 s, ⚠️ public_headers 34.8 s, ⚠️ agc_driver_lazy_resolved_abi 34.8 s
Failing on main too (1, not counted against this PR)
agc_driver_image_table
Validated but not compared (45, not in the main baseline's validation pass)
public_headers
public_headers_compile_20
public_headers_compile_21
public_headers_compile_22
public_headers_compile_23
public_headers_compile_24
public_headers_compile_25
public_headers_compile_26
public_headers_compile_27
public_headers_compile_28
public_headers_compile_29
public_headers_compile_30
public_headers_compile_31
public_headers_compile_32
public_headers_compile_33
public_headers_compile_34
public_headers_compile_35
public_headers_compile_36
public_headers_compile_37
public_headers_compile_38
public_headers_compile_39
public_headers_compile_40
public_headers_compile_41
public_headers_compile_42
public_headers_compile_43
public_headers_compile_44
public_headers_compile_45
public_headers_compile_46
public_headers_compile_47
public_headers_compile_48
public_headers_compile_49
public_headers_compile_50
public_headers_compile_51
public_headers_compile_52
public_headers_compile_53
public_headers_compile_54
public_headers_compile_55
public_headers_compile_56
public_headers_compile_57
public_headers_compile_58
public_headers_compile_59
public_headers_compile_60
public_headers_compile_61
public_headers_compile_62
public_headers_compile_63
Validation IDs already present on main (8 IDs in 404 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (404 tests): agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, agc_driver_bda_span_reads, agc_driver_bindless_images, and 396 more
VUID-vkCmdCopyImage-srcImage-01548 (4 tests): agc_driver_depth_clear_hle, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (4 tests): agc_driver_depth_clear_hle, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (1 test): agc_driver_prepared_exports
VUID-VkSamplerCreateInfo-addressModeU-01079 (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeU-parameter (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeV-parameter (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeW-parameter (1 test): agc_driver_image_gather_volume
Skipped (4)
agc_driver_copied_writer_label_order: skipped, the device reports a minStorageBufferOffsetAlignment of 4, so the dispatch binds its record at +0x1004 in place and nothing is written back; the test needs an alignment above 4
agc_driver_float16_unused_nan_payloads: skipped, the device has no native f16 conversions with RTE rounding and kept f16 denormals
agc_driver_gcn_display_present: skipped, no display: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
agc_driver_linear_target_direct_write_completion: skipped, the device does not keep host imports write-watched, so no completion stamp over the target is tracked
Reproduce
git fetch origin 95d9dd4e40727d7f1df618e397aa1284563a0dad 5b1d381d5ad5d9f923326b18479c3bd889cdd588
git checkout 5b1d381d5ad5d9f923326b18479c3bd889cdd588 && git merge --no-ff 95d9dd4e40727d7f1df618e397aa1284563a0dad
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 12 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 16 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@ntamas94

ntamas94 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

PS4 Fios2 probe summary

Firmware 10.710.001, SDK 0x05050001, neo_mode=0. All 62 exports in the debt list were invoked at least once using signatures/branches guided by the PS4 disassembly. The table groups the final probe observations; it is not a full valid-input conformance suite.

Area Exports Probe observation
Archives 10 Null/uninitialized mount calls and absent-ID unmounts returned repeatable raw values. The final setter probe used a fresh uninitialized module: getter 0, setter(1) raw 0, getter still 0, successful stop/unload.
Cache and prefetch 13 Absent paths, bounded ranges and invalid file handles; raw results captured and repeated where applicable.
Debug dumps 5 Error/date and invalid FH/DH/op diagnostics returned bounded text.
Time and logging 7 Timestamp save/print/clear; fixed-literal printf/vprintf; TraceTimestamp wrote two terminated strings into 32-byte buffers with adjacent guards intact.
Directories and handles 5 Sync directory create/remove succeeded reversibly. Async create returned raw 0 but made no kernel-visible directory; handle conversions and invalid passthrough handles were recorded.
IO filters 5 Invalid-index outputs stayed guarded; null-descriptor dearchiver mode 0 repeatedly returned 0x80820006 before mutation.
Operations 4 Absent INT32_MAX operation IDs returned repeatable raw observations.
Overlays 6 Invalid IDs and bounded get/list/resolve outputs; guards stayed intact on the output probes.
Paths and resolution 5 Path helpers plus absent-path resolve calls with bounded outputs.
DLL lifecycle 2 No-argument initialize/terminate bracketed an async-create attempt; no directory appeared.

A first incorrect TraceTimestamp signature crashed; only the later dump-guided buffer call is counted above. The 62 cases passed their final runner self-checks. These are PS4 observations only: they do not establish PS5 parity or all valid-input behavior. No firmware binary is attached.

@oneandonlydean
oneandonlydean merged commit ccef460 into boykopovar:main Nov 4, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants