Commit graph

287 commits

Author SHA1 Message Date
Nekotekina 4bc431ec31 Silence deprecation warning (implicit capture of this on [=]) 2020-02-10 14:47:12 +03:00
eladash f901846acb RawSPU: execute MFC proxy cmd after reading CMDStatus
Implement MFC proxy argument sequence checking.
2020-02-06 20:43:38 +00:00
Nekotekina c0f80cfe7a Use attributes for LIKELY/UNLIKELY
Remove LIKELY/UNLIKELY macro.
2020-02-05 10:42:34 +03:00
Nekotekina 6dfd97f0b6 Modernize SPU logging (spu_log variable) and remove log legacy
Remove legacy macro (LOG_ERROR, etc)
2020-02-01 11:52:52 +03:00
Nekotekina ddda09607d SPU: fixup for STOP 0w0 2020-01-21 16:32:00 +03:00
Eladash 9958a83d10 Make spu_channel_4_t::clear() atomic
By removing separate value3 write, fixes a rare race introduced by #6917.
2019-12-31 19:05:06 +03:00
Eladash 3257552227 Minor spu_channel_4_t optimization 2019-12-31 19:05:06 +03:00
Eladash 45cff1219c Allow sys_raw_spu_create_tag to be called more than once 2019-12-30 23:46:45 +03:00
Eladash 5631382623 sys_spu: Fix SPU Thread Id
* Removed wrong code in sys_spu_thread_group_terminate.
* SPU Thread ID is accurate, including 5th thread id "rule".
* Fixed possible use-after-free access of spu_thread::group member.
* RawSPU ID management simplified.
2019-12-06 19:59:29 +03:00
Eladash b99992d570 sys_spu: Fix SNR and Inbound Mailbox state reset
Also remove bugged ESTAT check at sys_spu_thread_write_spu_mb.
2019-10-29 18:34:28 +03:00
Nekotekina b329bb604c SPU LLVM: implemented asynchronous compilation
Implemented interpreter-based pre-recompiler.
Interpreter functions are build with SPU LLVM.
2019-10-21 19:29:34 +03:00
eladash 95752607ea sys_spu: Don't reset snr config at group_start()
Also first check for EINVAL in sys_spu_thread_set_spu_cfg
2019-10-16 21:11:29 +03:00
Eladash 43f919c04b Fixup after #6143 (#6146)
vm::spu max address was overflowing resulting in issues, so cast to u64 where needed. Fixes #6145.
    Use vm::get_addr instead of manually substructing vm::base(0) from pointer in texture cache code.
    Prefer std::atomic_thread_fence over _mm_?fence(), adjust usage to be more correct.
    Used sequantially consistent ordering in semaphore_release for TSX path as well.
    Improved memory ordering for sys_rsx_context_iounmap/map.
    Fixed sync bugs in HLE gcm because of not using atomic instructions.
    Use release memory barrier in lwsync for PPU LLVM, according to this xbox360 programming guide lwsync is a hw release memory barrier.
    Also use release barrier where lwsync was originally used in liblv2 sys_lwmutex and cellSync.
    Use acquire barrier for isync instruction, see https://devblogs.microsoft.com/oldnewthing/20180814-00/?p=99485
2019-06-29 18:48:42 +03:00
Lassi Hämäläinen e9e87b8bd9 Add missing #includes to header files
- Multiple header files where missing #includes to other headers that
  where used in the header. Correct header was included in correct
  order in source files which caused everything to compile.
- Added missing #includes so header files correctly include all their
  dependencies and fixes problems with IDEs being unable to parse
  headers correctly due to missing symbols
2019-06-25 17:11:10 +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
Nekotekina 5d33d9a3d9 Enable most warnings in GCC 2019-05-11 02:13:19 +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 0861226271 Make more use of the new atomic_t<>::release 2019-02-10 00:16:57 +03:00
Nekotekina 2b66abaf10 Implement atomic_t<>::release
More relaxed store with release memory order
2019-01-29 03:32:16 +03:00
Nekotekina 50922faac9 Remove SPUThread::jit_dispatcher
Use global array - save memory
Move the array to JIT memory
2019-01-29 03:32:16 +03:00
elad fc92ae4085 SPU/PPU atomics performance and LR event fixes (#5435)
* Fix SPU LR event setting in atomic commands according to hw test
* MFC: increment timestamp for PUT cmd in non-tsx path
* MFC: fix reservation lost test on non-tsx path in regard to the lock bit
* Reservation notification moved out of writer_lock scope to reduce its lifetime
* Use passive_lock/unlock in ppu atomic inctrustions to reduce redundancy
* Lock only once for dma transfers (non-TSX)
* Don't use RDTSC in reservation update logic
* Remove MFC cmd args passing to process_mfc_cmd
* Reorder check_state cpu_flag::memory check for faster unlocking
* Specialization for 128-byte data copy in SPU dma transfers
* Implement memory range locks and isolate PPU and SPU passive lock logic
2019-01-15 18:31:21 +03:00
Nekotekina 0044eb44e2 Cleanup after #5310 (SPU thread groups)
Move lambda into a cpu_stop()
Use running thread counter to synchronize with sys_spu_thread_group_join()
Use SPU_STATUS_STOPPED_BY_STOP exclusively for sys_spu_thread_exit() as before
Remove unnecessary waiting in sys_spu_thread_group_exit()
Rollback some minor unnecessary changes
Use shared_mutex in SPU TG
2018-11-14 12:50:24 +03:00
Nekotekina 1b37e775be Migration to named_thread<>
Add atomic_t<>::try_dec instead of fetch_dec_sat
Add atomic_t<>::try_inc
GDBDebugServer is broken (needs rewrite)
Removed old_thread class (former named_thread)
Removed storing/rethrowing exceptions from thread
Emu.Stop doesn't inject an exception anymore
task_stack helper class removed
thread_base simplified (no shared_from_this)
thread_ctrl::spawn simplified (creates detached thread)
Implemented overrideable thread detaching logic
Disabled cellAdec, cellDmux, cellFsAio
SPUThread renamed to spu_thread
RawSPUThread removed, spu_thread used instead
Disabled deriving from ppu_thread
Partial support for thread renaming
lv2_timer... simplified, screw it
idm/fxm: butchered support for on_stop/on_init
vm: improved allocation structure (added size)
2018-10-19 22:22:35 +03:00
Nekotekina 12eee6a19e SPU ASMJIT: Implement Mega block mode (experimental)
Disable extra modes for SPU LLVM for now.
In Mega mode, SPU Analyser tries to determine complete functions.
Recompiler tries to speed up returns via 'stack mirror'.
2018-06-05 12:35:26 +03:00
Nekotekina 759370ea1b SPU: rewrite FSM/FSMH/FSMB instructions
Remove lookup tables
2018-05-30 20:35:35 +03:00
Nekotekina 55e9d437a9 Fix warning (ignored attributes) 2018-05-30 20:35:35 +03:00
Nekotekina 8d5bbfb850 Update SPU dump: print current MFC cmd 2018-05-21 00:18:37 +03:00
Nekotekina 767dfa271e SPU ASMJIT: internal jumptable
Allow indirect calls within current function using a jumptable
This restores some functionality removed in SPU ASMJIT 2.0
Change SPUThread::get_ch_value prototype
2018-05-08 13:05:29 +03:00
Nekotekina 9ad5fc8a08 SPU: rewrite spu_channel_t 2018-04-22 00:06:49 +03:00
Nekotekina 3ffafb741c SPU ASMJIT: übertrampolines and spu_runtime
Use opt-out shared spu_runtime to save memory (Option: SPU Shared Runtime)
Implement "übertrampolines" for dispatching compiled blocks
Patch fixed branch points to use trampolines after check failure
2018-04-22 00:06:49 +03:00
Nekotekina 8ca33bcb94 SPU ASMJIT v2.0
Use X86Assembler and blocks
2018-04-22 00:06:48 +03:00
Nekotekina 0797164fac SPU: fix possible livelock
The bug affects TSX path
2018-04-07 20:51:21 +03:00
Nekotekina 2b5cf2455f SPU: improve TSX usage
Reduce transaction failure amount
Remove vm::try_to_lock
2018-04-06 21:47:54 +03:00
Nekotekina d392379c7a Use vm::passive_lock for SPU threads 2018-04-06 15:47:00 +03:00
Nekotekina e88508b679 SPU: cache barrier/fence masks 2018-04-06 15:47:00 +03:00
Nekotekina 898637f830 Remove mfc_thread
Clear mfc_queue on reset
Improve MFC Proxy a bit
2018-03-31 21:13:12 +03:00
Talkashie a35bcb131e unimportant teepo fix (#4328)
* ultra teepo fix part 1

* super mega teepo fix part 2
2018-03-24 20:21:50 +04:00
eladash 3426531e38 qt/spu: remove max dma write size setting
This wasn't really used for anything tbh
2018-03-20 02:49:53 +04:00
Nekotekina 76be7d40ac Remove PSP2 2018-02-09 15:24:46 +03:00
scribam 50f2be57f7 Spaces to tabs 2017-12-10 16:48:33 +04:00
Jake d17093e65b spu: Fix interrupt jump check - also change interrupt variable to atomic bool for ease of setting/checking 2017-12-01 20:29:59 +03:00
Nekotekina 3a08dd7dde RawSPU: implement Prxy_TagStatus_offs
Rollback to immediate MFC transfers
2017-08-31 22:03:47 +03:00
Nekotekina 291ec1eeb2 SPU recompiler: minor optimization 2017-07-20 17:22:09 +03:00
kd-11 99828a8f15 spu: Clean up asmjit - avoid touching the shared db whenever possible
- Gets around the locking issues when fetching from the shared db
2017-07-19 23:28:33 +03:00
kd-11 df7b466656 spu: Speed hacks - Do not starve PPU threads
optionally hint to the OS scheduler to give less attention to SPUs

ui: Add speed 'hacks' as configurable options
2017-05-10 21:50:14 +03:00
Nekotekina 4739eb3601 Reservation fix 2017-03-11 15:48:43 +03:00
Nekotekina 5e3bacbd9b New reservations
Memory system cleanup
sys_memory_get_page_attribute
2017-03-10 15:51:40 +03:00
Nekotekina d2ddb9882f SPU: IRET, SN event 2017-02-13 16:29:32 +03:00
Oil 1669d0fdbd Minor changes (#2352)
* More initial values for rsx method registers

* Implemented spu decrementer event

* Remove u32 cast
2017-02-07 23:59:59 +03:00
Nekotekina ec943b38a2 sys_spu... 2017-02-05 02:26:57 +03:00
Nekotekina 6537909fd2 sys_event_queue... 2017-02-04 20:39:04 +03:00
Nekotekina b21fce4d6f IdManager improved
lv2_obj for kernel objects
Simple lookup (vector)
Another idm API refactoring
2017-01-29 21:37:04 +03:00
Nekotekina a5a2d43d7c Thread.cpp refinement
Hide thread mutex
Safe notify() method
Other refactoring
2017-01-29 19:52:19 +03:00
Nekotekina 591a6c8671 IdManager improved 2017-01-25 23:29:36 +03:00
Nekotekina 5e0489dcc0 cpu_init removed 2016-08-14 18:07:34 +03:00
Nekotekina a7e808b35b EXCEPTION macro removed
fmt::throw_exception<> implemented
::narrow improved
Minor fixes
2016-08-08 19:19:32 +03:00
Nekotekina 5a36c57c57 Formatting system improved
`unveil<>` renamed to `fmt_unveil<>`, now packs args to u64 imitating va_args
`bijective...` removed, `cfg::enum_entry` now uses formatting system
`fmt_class_string<>` added, providing type-specific "%s" handler function
Added `fmt::append`, removed `fmt::narrow` (too obscure)
Utilities/cfmt.h: C-style format template function (WIP)
Minor formatting fixes and cleanup
2016-08-04 21:34:00 +03:00
Nekotekina f8719c1230 PPUThread refactoring
`CallbackManager` removed, added _gcm_intr_thread for cellGcmSys
`PPUThread` renamed to `ppu_thread`, inheritance allowed
Added lightweight command queue for `ppu_thread`
Implemented call stack dump for PPU
`get_current_thread_mutex` removed
`thread_ctrl::spawn`: minor initialization fix
`thread_ctrl::wait_for` added
`named_thread`: some methods added
`cpu_thread::run` added
Some bugs fixes, including SPU channels
2016-07-30 16:35:02 +03:00
Nekotekina 7a921cbdf9 cpu_thread compressed 2016-06-27 16:43:57 +03:00
Nekotekina e2d82394f6 Cell 2016-05-23 16:22:23 +03:00
John ce3fdeda5e Replace math macros by function calls from cmath. (#1695) 2016-05-19 19:15:56 +03:00
Ivan da7472fe81 Optimizations (#1680)
* Optimizations

1) Some headers simplified for better compilation time
2) Some templates simplified for smaller executable size
3) Eliminate std::future to fix compilation for mingw64
4) PKG installation can be cancelled now
5) cellGame fixes
6) XAudio2 fix for mingw64
7) PPUInterpreter bug fixed (Clang)

* any_pod<> implemented

Aliases: any16, any32, any64
rsx::make_command fixed
2016-04-25 13:49:12 +03:00
Ivan efc8779275 SPU channel optimization (#1675) 2016-04-19 16:04:02 +03:00
Nekotekina c4e99dbdb2 Partial commit: Cell 2016-04-15 19:22:34 +03:00
Nekotekina ca6783ba9a Threads improved, ID manager improved 2015-12-04 23:37:34 +03:00
Nekotekina a974ee009e vm::var improved, cleanup
Mostly vm::var initialization introduced.
Added vm::make_var function.
2015-10-14 18:17:37 +03:00
Nekotekina 8ae3401ffa Some things improved
shared_mutex_t implemented
GUI Emu Callbacks rewritten
fxm::import, fxm::import_always implemented
cellMsgDialog rewritten
Emu.CallAfter improved (returns std::future)
2015-09-22 16:48:21 +03:00
Nekotekina 7e01c81154 SPU Recompiler fixed 2015-09-07 00:36:32 +03:00
Nekotekina 817fec9684 SPU Cleanup
SPURecompiler improved
Old SPU decoder removed
SPU Interpreters merged
2015-09-02 00:38:44 +03:00
Nekotekina ce494f8847 fmt::by_value, fmt::Format removed 2015-08-24 21:22:42 +03:00
Nekotekina eb63558c6d KernelExplorer improved 2015-08-24 21:22:34 +03:00
Nekotekina 6f3c50eba2 u128 renamed to v128
Since it's vector union type
2015-08-24 21:22:23 +03:00
Danila Malyutin 5ae6586803 Add missing override specifiers 2015-07-26 18:37:14 +03:00
Nekotekina 2f7fe35f5c Minor style change 2015-07-21 23:14:31 +03:00
Nekotekina 8175630619 sys_cond/sys_mutex improved 2015-07-21 23:14:29 +03:00
Nekotekina 43d3ccce95 SPU Channels improved 2015-07-21 23:14:28 +03:00
Nekotekina 5bd83516ba SPU Interrupt Enable Status implemented
SPU Interrupts are still NOT implemented
2015-07-21 23:14:25 +03:00
Nekotekina a7668ff57f SPU_EVENT_LR improved 2015-07-21 23:14:22 +03:00
Nekotekina a8fcf71f9c Minor bugfix, cleanup 2015-07-21 23:14:04 +03:00
Nekotekina 3bc6c53eb3 sys_interrupt improved 2015-07-18 03:12:10 +03:00
Nekotekina b8a27d8a4c Silly bugs fixed 2015-07-18 03:12:08 +03:00
Nekotekina 82781e620a Small fixes 2015-07-10 04:31:36 +03:00
Nekotekina 22e1da5e76 Minor cleanup 2015-07-10 04:31:29 +03:00
Nekotekina 8f9e1100c8 SPU fixes, various fixes 2015-07-10 04:31:25 +03:00
Nekotekina 32d3d1fbe5 EXCEPTION() macro usage, sceNpTrophy improved 2015-07-10 04:31:20 +03:00
Nekotekina 3aefa2b4e1 ThreadBase rewritten (wip) 2015-07-10 04:31:16 +03:00
Nekotekina c598fe7aa9 atomic_op() rewritten, atomic.h refactoring
cellSync refactoring, wait_op() rewritten, bugfixes
2015-07-10 04:31:10 +03:00
Nekotekina 714da1aa7c vm::var fix, vm::ptr improved
GetCurrentPPUThread() removed
2015-07-10 04:31:00 +03:00
Nekotekina edb9595721 Using vm::ps3 namespace moved in proper places
Various fixes
2015-07-10 04:30:41 +03:00
Nekotekina 78fdcf75e7 Attribute macro changed
__forceinline -> force_inline
__noinline -> never_inline
printf_alike(x,y) added
2015-05-28 18:14:22 +03:00
Nekotekina 22b78fec71 IdManager improved, atomic_t improved
Various changes
2015-05-27 06:11:59 +03:00
Nekotekina f92c10ef71 Minor fixes 2015-05-08 12:45:21 +03:00
Hykem d18d19870f Merge pull request #1062 from Nekotekina/master
SPURecompiler improved
2015-04-25 19:32:47 +01:00
luxsie 0233fbff51 Thanks to @Nekotekina, about his patience on SPUThread.h. 2015-04-13 00:37:58 +08:00
luxsie 147c50e7ca Removed some useless comments, thank Neko. 2015-04-11 00:27:20 +08:00
luxsie 900389d857 CppCheck: Tried to classify and marked some lines that weird. 2015-04-10 20:13:25 +08:00
Nekotekina d1fbccc9ce SPURecompiler improved 2015-04-05 21:01:15 +03:00
Nekotekina c88e0a0eb9 Small cleanup 2015-03-13 04:09:53 +03:00
Nekotekina 5d768bd3cf Bugfix, sys_spu_thread_group_connect_event implemented 2015-03-05 16:18:06 +03:00
Nekotekina 9e49a33b3c SPU syscall improvements 2015-03-05 00:51:14 +03:00