Skip to content

feat(libkernel): hinted and no-overwrite mappings, virtual range names and usleep - #50

Merged
boykopovar merged 2 commits into
boykopovar:mainfrom
oneandonlydean:feat/libkernel-mappings
Sep 28, 2026
Merged

boykopovar merged 2 commits into
boykopovar:mainfrom
oneandonlydean:feat/libkernel-mappings

Conversation

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Stacked on #44 (both touch DirectMemory/Export.cpp).

What

  • Non-fixed mapping with an address hint: MapAligned threw Non-fixed mapping address hints are not implemented. On the PS5 the hint is where the search starts. On Linux the mapping is now placed at the first free, aligned range at or above the hint, found from /proc/self/maps and mapped with MAP_FIXED_NOREPLACE so nothing existing can be replaced. RequireAvailable is now only checked for fixed mappings, because a hint may point at used memory. Windows still throws.
  • SCE_KERNEL_MAP_NO_OVERWRITE (0x80): it was rejected as an unknown flag. With MAP_FIXED on Linux it maps with MAP_FIXED_NOREPLACE, and it no longer takes the "remap fixed into registered" path, so it fails instead of replacing a registered range. The unsupported-flags error now includes the flag value.
  • Virtual range names: sceKernelSetVirtualRangeName was NotImplemented and sceKernelClearVirtualRangeName wasn't exported. Names are now kept in a registry, split and trimmed on overlap. sceKernelVirtualQuery reports the name and splits its reported region at name boundaries. sceKernelMapNamedDirectMemory and sceKernelMapNamedFlexibleMemory now name the range instead of ignoring the name.
  • usleep is exported (POSIX, beside nanosleep).

Testing

guest_memory test extended: named flexible map and VirtualQuery name, naming and clearing a sub-range, and (Linux) a hinted map that lands above an occupied hint and a no-overwrite map over a registered range that throws.

oneandonlydean and others added 2 commits September 28, 2026 13:32
The host-region fallback added with the Demon's Souls work calls VirtualQuery and
includes windows.h unconditionally, so libkernel no longer compiles on Linux.
On Linux, read the containing mapping and its permissions from /proc/self/maps.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ButHENCbXXt8h4EZuWUabJ
…s and usleep

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ButHENCbXXt8h4EZuWUabJ
@boykopovar
boykopovar merged commit d653d85 into boykopovar:main Sep 28, 2026
@oneandonlydean
oneandonlydean deleted the feat/libkernel-mappings branch September 29, 2026 03:44
Kikoarl pushed a commit to Kikoarl/AnyPS5 that referenced this pull request Nov 18, 2026
…upscaling

feat(kyty): scale presentation with FSR 1 under ANYPS5_UPSCALE=fsr
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.

2 participants