shadPS4/src/core/libraries/kernel
Stephen Miller bb3f8af81a
Core: Protect fixes (#3029)
* Swap do-while to while

If we use a do-while loop, we waste time if `aligned_size = 0`.  This is also still accurate to FreeBSD behavior, where it returns success if `start == end` during mprotect.
This also effectively prevents the memory assert seen in updated versions of RESIDENT EVIL 2 (CUSA09193)

* Move prot validation outside loop

The prot variable shouldn't change during a mprotect call, so we can check the flags before protecting instead.
Also cleans up the code for prot validation.
This should improve performance, and is more accurate to FreeBSD code.

* Add logging for protect calls

This will help in debugging future problems
2025-06-03 09:29:25 +03:00
..
sync semaphore: Attempt to acquire before checking timeout 2024-12-24 15:39:17 +02:00
threads event_flag: Lower error logs to debug. 2025-05-13 14:46:59 -07:00
aio.cpp kernel: Clean up and fix some mistakes. (#2907) 2025-05-11 14:22:17 -07:00
aio.h sceKernelAio* implementation (#2160) 2025-01-16 18:27:52 +02:00
debug.cpp Minor libkernel changes (#2721) 2025-03-30 01:27:33 +02:00
debug.h Minor libkernel changes (#2721) 2025-03-30 01:27:33 +02:00
equeue.cpp equeue: Move small timer check to WaitForEvents. (#3000) 2025-05-28 19:54:47 +03:00
equeue.h equeue: Clean up timers implementation. (#2925) 2025-05-13 14:05:29 -07:00
file_system.cpp Only perform early read-write open when truncating is needed (#2874) 2025-05-02 11:22:05 -07:00
file_system.h libkernel: Filesystem code cleanup (#2554) 2025-03-26 18:03:35 +02:00
kernel.cpp externals: Remove winpthreads. (#2932) 2025-05-15 13:59:34 -07:00
kernel.h kernel: Clean up and fix some mistakes. (#2907) 2025-05-11 14:22:17 -07:00
memory.cpp Core: Protect fixes (#3029) 2025-06-03 09:29:25 +03:00
memory.h Core: More Memory Cleanup & Fixes (#2997) 2025-05-29 18:56:03 +03:00
orbis_error.h core: Library cleanup (#1631) 2024-11-30 22:37:36 +02:00
posix_error.h core: Library cleanup (#1631) 2024-11-30 22:37:36 +02:00
process.cpp Implement sceKernelGetModuleInfo, sceKernelGetModuleInfoInternal, and sceKernelGetModuleList (#2850) 2025-04-27 09:32:01 +03:00
process.h Handle error behavior in sceSysmoduleGetModuleInfoForUnwind stub (#2629) 2025-03-09 23:17:33 +02:00
threads.cpp kernel: Rewrite pthread emulation (#1440) 2024-11-21 22:59:38 +02:00
threads.h kernel: Implement scePthreadGetaffinity (#2916) 2025-05-12 10:46:53 -07:00
time.cpp externals: Remove winpthreads. (#2932) 2025-05-15 13:59:34 -07:00
time.h externals: Remove winpthreads. (#2932) 2025-05-15 13:59:34 -07:00