Skip to content

feat(libc): implement overlap-safe bcopy - #2059

Closed
QRMOE wants to merge 3 commits into
boykopovar:mainfrom
QRMOE:feat/libc-bcopy
Closed

QRMOE wants to merge 3 commits into
boykopovar:mainfrom
QRMOE:feat/libc-bcopy

Conversation

@QRMOE

@QRMOE QRMOE commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

What

Adds bcopy (RMo7j0iTPfA) with its source-first argument order and overlap-safe memmove behavior. Zero-length calls do not access either pointer. Reference: FreeBSD bcopy.

Tested

guest_bcopy passes: every valid source offset, destination offset and length in a 64-byte region is checked against an unchanged-source snapshot, including identical ranges, both overlap directions, adjacent and disjoint ranges, and whole-buffer guards. Also covers separate buffers, binary data, null pointers for zero bytes, and errno preservation.

Windows 11, WinLibs MinGW-w64 GCC 15.2.0 r7 UCRT/posix/SEH, Ninja Release, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=ON; base f145139676a48306681d3a4d5fabf83938759daf.

Combined validation of these three independent branches: full libs target built successfully, including NID patching; guest_memmem, guest_bcopy, both line-input tests, guest_standard_streams, and guest_errors pass (6/6). All four NIDs are present in patched libc.prx. Conventions, diff whitespace and test registration checks pass. The branches were also built and tested individually before integration.

Before publication, actual library diffs of 559 candidate PR heads were checked for these names and NIDs, including broad PRs and newer heads; no other implementation of these four exports was found. The candidates cover the cached open-PR list and every newer PR head; some candidates may have closed since that list was read.

Linux, console behavior, games and the complete CTest suite have not been run. This adds documented libc interfaces; no particular title starting successfully is claimed.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR
  • No comments added in code
  • No silent success stubs added
  • No investigation notes, reports or images added to the repository
  • No third-party dependencies added
  • Generic behavior, not specific to one title
  • Depends on: none
  • AI-assisted: yes — OpenAI Codex assisted with implementation, tests and this description.

QRMOE added 3 commits October 9, 2026 08:16
AI-assisted: yes. Part of the locally tested library change. Full libs build and six focused Windows tests pass; Linux and games have not been run.
AI-assisted: yes. Part of the locally tested library change. Full libs build and six focused Windows tests pass; Linux and games have not been run.
AI-assisted: yes. Part of the locally tested library change. Full libs build and six focused Windows tests pass; Linux and games have not been run.
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Same as #2058, for bcopy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants