Commit graph

336 commits

Author SHA1 Message Date
Eladash
ade291e73d Fix potential overflow in sys_vm 2019-06-21 00:02:52 +03:00
Nekotekina
517a2bc34a sys_lwcond: add vm::temporary_unlock 2019-06-20 14:46:32 +03:00
Nekotekina
a935203a18 sys_lwmutex: add vm::temporary_unlock 2019-06-20 14:46:32 +03:00
Nekotekina
5753b3222e sys_memory: add vm::temporary_unlock 2019-06-19 20:45:59 +03:00
Nekotekina
d021d9e14a sys_mutex: add vm::temporary_unlock 2019-06-19 20:39:39 +03:00
Nekotekina
89a31292dc sys_cond: add vm::temporary_unlock 2019-06-19 20:39:29 +03:00
Nekotekina
5d45a3e47d Implement cpu_thread::suspend_all
Remove Accurate PUTLLC option.
Implement fallback path for SPU transactions.
2019-06-19 20:36:12 +03:00
Ivan
0fe26f8293 Add sys_rsx_context_iomap workaround
Don't fail with CELL_EINVAL on vm::main.
2019-06-17 01:17:02 +03:00
Nekotekina
2bc0ea37ab sys_fs: yield PPU on disk access ops 2019-06-08 19:34:55 +03:00
scribam
09c9996f31 Use empty() instead of comparing size() with 0
Recommendation from Clang-Tidy: https://clang.llvm.org/extra/clang-tidy/checks/readability-container-size-empty.html
2019-06-01 22:59:23 +03:00
scribam
bf557ea6e6 Use the more efficient character literal overload for find_first_of/find_last_of
Recommendation from Clang-Tidy: https://clang.llvm.org/extra/clang-tidy/checks/performance-faster-string-find.html
2019-06-01 22:59:23 +03:00
Megamouse
cafa4521ee Better Support For Game Collections (#4450) 2019-06-01 01:12:30 +03:00
Nekotekina
ea554ae828 Implement 'Max SPURS Threads' option (hack)
Pauses SPURS threads beyond limit automatically if set.
2019-05-14 22:15:04 +03:00
Nekotekina
7492f335e9 SPU analyser: basic function detection in Giga mode
Misc: fix EH frame registration (LLVM, non-Windows).
Misc: constant-folding bitcast (cpu_translator).
Misc: add syntax for LLVM arrays (cpu_translator).
Misc: use function names for proper linkage (SPU LLVM).

Changed function search and verification in Giga mode.
Basic stack frame layout analysis.
Function detection in Giga mode.
Basic use of new information in SPU LLVM.
Fixed jump table compilation in SPU LLVM.
Disable broken optimization in Accurate xfloat mode.
Make compiled SPU modules position-independent in SPU LLVM.

Optimizations include but not limited to:
 * Compiling SPU functions as native functions when eligible
 * Avoiding register context write-out
 * Aligned stack assumption (CWD alike instruction)
2019-05-11 02:13:19 +03:00
eladash
13d8e33d9a Return ESRCH if ppu thread ID was not found in sys_cond_signal_to 2019-05-07 08:58:07 +03:00
eladash
4e2650af91 Fix sys_rwlock_wlock timedout event
If the rwlock is currently acquired by a writer signaling readers is wrong and will lead to EPERM for wunlock!
Only signal blocked readers if the rwlock is currently acquired by readers
2019-05-07 08:58:07 +03:00
eladash
ca08418dc1 Fix sys_rwlock_runlock on waiting readers
readers can wait on the sleep queue if a writer lock has been blocked before it, in this case after runlock: writer should acquire the lock but the r's sleep queue is still not empty!
2019-05-07 08:58:07 +03:00
eladash
6f76e34104 rsx: Fix race on clearing native_ui vs emu_requested flag 2019-04-20 01:04:41 +03:00
eladash
67f098627a Fix sys_spu group ID 2019-04-20 01:04:41 +03:00
eladash
f25587d24c rsx: Write vblank semahpre, minor semaphore acquire optimization 2019-04-20 01:04:41 +03:00
msuih
baf42430d6 Decrease severity of sys_net_bnet_close 2019-04-16 18:39:57 +03:00
Nekotekina
0d415407c7 sys_fs_unlink: add CELL_EISDIR check 2019-04-12 12:24:36 +03:00
TGEnigma
38cc92ec45 Add _sys_ppu_thread_create and sys_ppu_thread_rename error checks 2019-04-11 18:14:05 +03:00
eladash
d555eeb0f4 Check start status in sys_prx_start/stop_module 2019-04-11 17:47:52 +03:00
Inviuz
52a12185a0 Initial sys_overlay 2019-04-10 23:25:09 +03:00
Nekotekina
40142420c1 Implement vfs::host::unlink
Emulate POSIX behaviour in sys_fs_unlink.
This should allow to delete opened files transparently on Windows.
2019-04-10 13:58:12 +03:00
Nekotekina
9736773c04 Implement vfs::host::rename
With spurious access error workaround
2019-04-10 13:58:12 +03:00
eladash
182054b8af Implement sys_vm_append/return_memory 2019-03-31 14:57:21 +03:00
eladash
3c0564c9b7 Fix timer state after event queue was destroyed
* Hw tests show state is unaffected by external destruction of the event queue

* Minor race regarding state check fixed (can result in an undestroyable state)
2019-03-31 14:57:21 +03:00
eladash
90490f775d Fix sys_timer_usleep specifically with 0 sleep time
Remove context switch, replace it with host yield() for giving some cpu time for SPUs ans RSX
2019-03-31 14:57:21 +03:00
eladash
4a28319edf Implement SPU page faults notifications
* Implement both RawSPU and threaded SPU page fault recovery
* Guard page_fault_notification_entries access with a mutex
* Add missing lock in sys_ppu_thread_recover_page_fault/get_page_fault_context
* Fix EINVAL check in sys_ppu_thread_recover_page_fault, previously when the event was not found begin() was erased and
CELL_OK was returned.
* Fixed page fault recovery waiting logic:
- Do not rely on a single thread_ctrl notification (unsafe)
- Avoided a race where ::awake(ppu) can be called before ::sleep(ppu) therefore nop-ing out the notification
* Avoid inconsistencies with vm flags on page fault cause detection
* Fix sys_mmapper_enable_page_fault_notification EBUSY check
from RE it's allowed to register the same queue twice (on a different area) but not to enable page fault notifications twice
2019-03-12 13:28:31 +03:00
eladash
a43e7c172c Fix shared memory page flags
TODO: From hw testing, it seems like sys_memory_get_page_attribute and sys_rsx_context_iomap check page size a little differently

get_page_attribute() always go by area flags, sys_rsx_context_iomap checks page by the page granularity
This means that if the area page size 64k, but shared memory is mapped with SYS_MEMORY_GRANULARITY_1M
It can be mapped for rsxio, but the page attribute will indicate 64k page size :thonk:
rsxio memory is verified to need 1m pages.
2019-03-08 23:44:46 +03:00
eladash
7470388e5a Use error_code in sys_rsx 2019-03-08 23:44:46 +03:00
eladash
26bcd0a4de Small improvements to sys_event_flag
- From RE, only protocols SYS_SYNC_FIFO and SYS_SYNC_PRIORITY are valid
- Use conditional atomic op store in a few places
- Properly revert changes in sys_event_flag_set when aomic op fails
2019-03-08 23:44:46 +03:00
elad
fc253165e2 Correctness fix for RSXIOMem
- Make RSXIOMem volatile.
- Hint the compiler to check only once the address returned.
2019-03-08 23:44:46 +03:00
elad
f272a5f779 sys_lwmutex fixup after #5680
sys_lwcond_wait unlocks always with the 'usual' unlocking flags
2019-03-08 23:44:46 +03:00
elad
3c9f03968c Yield before flushing io buffers in fsync (sys_fs) (#5506) 2019-03-08 16:07:14 +00:00
eladash
e38b7aee5a check address in sys_rsx_context_iomap
* Fix 0 vm page flags to behave like 1m flags, follows c8a681e60
* check if address exists and valid for rsx io allcations (must be allocated on 1m pages)
2019-03-05 21:23:24 +03:00
Nekotekina
f143035af1 Fix sys_spu_thread_group_join wait condition
After waiting, thread group cannot be safely accessed
Following #5643
2019-03-01 00:08:19 +03:00
eladash
a22297f205 exception throwing fix in sys_lwmutex_create
arg6 doesnt exist, if arg4 is not negative name is discarded and treated as 0.
2019-02-27 22:16:08 +03:00
eladash
d4459af4b3 Implement _sys_lwmutex_unlock (SYS_SYNC_RETRY mode) 2019-02-27 22:16:08 +03:00
elad
63a9421634 Fix race in sys_lwcond_wait on error code 2019-02-16 21:41:59 +03:00
eladash
d6995f40c7 Fixup for sys_lwcond_signal_x error checking 2019-02-11 01:13:29 +03:00
eladash
fa647bc121 Fix race condion in sys_spu_thread_group_join 2019-02-10 18:20:24 +03:00
eladash
84d42ecb65 Add EFAULT checks to spu_thread_group_join, ppu_thread_join
Order of checks is based on firmware
2019-02-10 00:16:57 +03:00
eladash
0861226271 Make more use of the new atomic_t<>::release 2019-02-10 00:16:57 +03:00
eladash
e3ee481f01 Make sys_spu_thread_group_join return once per termination 2019-02-10 00:16:57 +03:00
eladash
d4a24433e8 Fix DECR mode allocations (sys_memory) 2019-01-31 16:03:38 +03:00
eladash
56b7581ade Return error code in sys_ppu_thread_get_join_state 2019-01-25 18:04:33 +03:00
elad
afeacc171f Fix spurious abort in sys_rwlock_tryrlock and sys_semaphore_trywait (#5579)
Use full cmpxchg loop to prevent occasional return of CELL_EBUSY
2019-01-22 23:10:17 +03:00