Skip to content

feat(libkernel): export preadv, pwritev and sync - #21

Closed
AlxcBTW wants to merge 1 commit into
mainfrom
fix/libkernel-preadv-pwritev-sync
Closed

AlxcBTW wants to merge 1 commit into
mainfrom
fix/libkernel-preadv-pwritev-sync

Conversation

@AlxcBTW

@AlxcBTW AlxcBTW commented Oct 10, 2026

Copy link
Copy Markdown
Owner

What

Exports the POSIX preadv, pwritev and sync from libkernel. preadv and pwritev go through the existing sceKernelPreadv and sceKernelPwritev, which already have Windows and POSIX implementations, and return -1 with the guest errno on failure. sync calls sceKernelSync.

Why

Prospero Vibrate (PPSA99920 v1.0) imports all three from libkernel. Its absent imports on main b5f5362 are exactly these three plus pthread_sigmask (boykopovar#2106). Each one is the title's next stop in turn:

Build First stop
main FAIL: unresolved ELF import JZKw5+Wrnaw from libkernel.prx (pthread_sigmask)
main + boykopovar#2106 ZaRzaapAZwM (preadv)
main + boykopovar#2106 + preadv FCcmRZhWtOk (pwritev)
main + boykopovar#2106 + preadv + pwritev Y2OqwJQ3lr8 (sync)
main + boykopovar#2106 + this PR loader passes: no absent imports, Transferring control to ELF entry point

After the entry point, the title (a .NET NativeAOT program) reads /proc/self/mountinfo, /proc/meminfo and the CPU cache sizes and starts its .NET Finalizer thread. It then stops with an access violation reading 0x28, on a stack-protector load of %fs:0x28 that the relinker left unpatched. That is a separate relinker issue.

Tested

Windows 11, WinLibs GCC 15.2.0 r7.

  • guest_file_vector: pwritev and preadv at an offset through two iovecs, checking the file contents. A negative offset gives -1 with EINVAL and a bad descriptor -1 with EBADF.
  • guest_kernel_sync: sync() clears a recorded entry of a deleted file.
  • Non-GPU tests: 443/443. check_conventions.py passed.
  • The title runs above, on main with feat(libkernel): implement pthread_sigmask boykopovar/AnyPS5#2106 merged locally only for the evidence runs.

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 in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: feat(libkernel): implement pthread_sigmask boykopovar/AnyPS5#2106 for the title evidence (the code does not depend on it)
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

Prospero Vibrate (PPSA99920 v1.0) imports preadv (ZaRzaapAZwM), pwritev
(FCcmRZhWtOk) and sync (Y2OqwJQ3lr8) from libkernel. On main its first
stop is pthread_sigmask (JZKw5+Wrnaw, boykopovar#2106); with boykopovar#2106 merged it stops
at

    FAIL: unresolved ELF import ZaRzaapAZwM from libkernel.prx

preadv and pwritev go through sceKernelPreadv and sceKernelPwritev and
return -1 with the guest errno on failure. sync calls sceKernelSync.

With boykopovar#2106 and this change the title has no absent imports and reaches
its entry point. It then stops at an access violation reading 0x28 on a
stack-protector load of %fs:0x28 that the relinker left unpatched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AlxcBTW

AlxcBTW commented Oct 11, 2026

Copy link
Copy Markdown
Owner Author

Covered upstream: preadv and pwritev by boykopovar#3005, sync by boykopovar#3104 (both merged).

@AlxcBTW AlxcBTW closed this Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant