Commit graph

476 commits

Author SHA1 Message Date
Nekotekina
3dd6961ee5 Use g_fxo in PPUThread.cpp misc
Replace fxm::get_always
2019-08-27 03:50:15 +03:00
eladash
050339bb3e PPU/LV2: Make thread-lists scheduling atomic 2019-08-17 22:46:36 +03:00
Nekotekina
f8f3067deb Always check page_allocated in vm::check_addr 2019-08-14 20:28:34 +03:00
eladash
4f00af6000 ppu interpreter: Allow non-ssse3 to use fast path
byte shuffle is now removed which was the barrier for ssse3 check.
2019-08-13 04:56:00 +03:00
Eladash
3ce18fd960 Implement vm::page_executable (#6330)
Fixes segfaults when attenpting to set segfaults on non-executable memory.
2019-08-11 21:04:17 +03:00
Nekotekina
949f33c8a4 Fix sys_config_get_io_event syscall name 2019-07-29 21:55:59 +03:00
Eladash
85b1152e29 Timers scaling and fixes 2019-07-23 00:09:01 +01:00
Eladash
537d3f2548 Log last function on debug pause or exception, dump cpu_thread state on access violation 2019-07-10 17:35:39 +03:00
Lassi Hämäläinen
499035512b Split Emu/Memory into more logical headers
- Add vm_locking.h and vm_reservation.h and move relevant functions
  and types to these headers.
- Change include order and make vm_ptr.h, vm_var.h and vm_ref.h headers
  usable invidually and them including vm.h instead of other way around
- Because usage of vm::ptr now requires including vm_ptr.h instead of
  vm.h updated multiple #includes
- Added additional #includes to vm_reservation.h and vm_locking to
  where vm::reservation_* and locking related functions are used
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
Eladash
d52953fca6 minor UB fix 2019-06-17 02:52:43 +03:00
Nekotekina
7de3c410cf SPU/PPU: update reservation logic on TSX path transactions
Make use of lock bits in reservation counters.
On PPU, fallback to compare_and_swap instead of desperate retry.
On SPU, lighten write set on retry by 'locking' outside of the transaction.
2019-05-20 14:32:50 +03:00
Nekotekina
9abb303569 vm: expand reservation lock bit area to 7 bit
This is minor change.
2019-05-19 17:46:55 +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
ea1c9a2e17 Fix PPU Breakpoints and ppu_check_toc 2019-04-29 23:04:16 +03:00
Nekotekina
524aac75ed LLVM DSL: rewrite bitcast, zext, sext, trunc, select, min, max ops
Are made composable in expressions similar to arithmetic ops.
Implement noncast in addition to bitcast (no-op case).
Implement bitcast constant folding.
Fixed some misuse of sext<>.
2019-04-24 23:55:41 +03:00
eladash
b307aff9eb Prefetch byteswapped opcodes in ppu interpreter 2019-04-11 17:47:52 +03:00
eladash
f028737db8 Implement fallback for PPU LLVM
This matches with interpreter implementation, fixing unregistered functions in lost cases
2019-04-11 17:47:52 +03:00
eladash
e21504d52d ppu interpreter: Improve FPCC field handling 2019-04-11 17:47:52 +03:00
Nekotekina
3354f068fc PPU/SPU transactions: ease cache line interference (TSX path)
Touch memory on the same memory page, but different cache lines.
2019-04-10 13:58:12 +03:00
Nekotekina
d873802b9c Use LLVM 9
Use new add/sub with saturation intrinsics
2019-03-30 01:36:48 +03:00
Nekotekina
849411693a PPU LLVM: add MemoryManager3
For temporary allocations.
Add flags in jit_compiler constructor.
2019-03-23 02:43:41 +03:00
Nekotekina
7f6a410770 Add dummy __has_builtin macro, use rotate builtins if possible 2019-03-01 00:08:19 +03:00
eladash
0861226271 Make more use of the new atomic_t<>::release 2019-02-10 00:16:57 +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
a419e98acb Move PPU and shader cache
New hash-based location (already used for SPU)
Bump PPU cache version, improve naming and decrease size

Remove fs::get_data_dir
Disable boot.elf cache
2019-01-14 01:24:05 +03:00
Nekotekina
bd9131ae1c Implement fs::get_cache_dir
Win32: equal to config dir for now
Linux: respect XDG_CACHE_HOME if specified
OSX: possibly incomplete
2019-01-13 14:45:36 +03:00
Megamouse
a4f67ccb87 Add log messages for PPU compilation 2018-12-31 23:03:03 +03:00
Nekotekina
96cabeadff Rewrite condition variables
Implement helper functions balanced_wait_until and balanced_awaken
They include new path for Windows 8.1+ (WaitOnAddress)

shared_mutex, cond_variable, cond_one, cond_x16 modified to use it
Added helper function utils::popcnt16
Replace most semaphore<> with shared_mutex
2018-11-29 01:30:05 +03:00
eladash
3a7f5b970f ppu: Fix stack base 2018-11-02 02:16:29 +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
f2229a5f53 PPU reservations: ensure aligned atomic ops
Store aligned 64 bits to ppu.rdata
Don't save reservation size
2018-09-15 17:09:56 +03:00
eladash
cd11ae5d8b ppu: Fix extreme reservation corner case 2018-09-12 23:17:53 +03:00
Nekotekina
d750e955c3 Use std::uncaught_exceptions()
Also remove wrong attributes
2018-09-08 00:32:04 +03:00
Nekotekina
ca5158a03e Cleanup semaphore<> (sema.h) and mutex.h (shared_mutex)
Remove semaphore_lock and writer_lock classes, replace with std::lock_guard
Change semaphore<> interface to Lockable (+ exotic try_unlock method)
2018-09-03 23:00:36 +03:00
Nekotekina
8abe6489ed Mega-cleanup for atomic_t<> and named bit-sets bs_t<>
Remove "atomic operator" classes
Remove test, test_and_set, test_and_reset, test_and_complement global functions
Simplify atomic_t<> with constexpr if, remove some garbage
Redesign bs_t<> to use class, mark its methods constexpr
Implement atomic_bs_t<> for optimizations
Remove unused __bitwise_ops concept (should be in other header anyway)
Bitsets can now be tested via safe bool conversion
2018-09-03 21:40:36 +03:00
Nekotekina
85fa0942e7 vm: allow 4k-aligned allocations for vm::stack
Fix utils::shm::map logic for MapViewOfFileEx
2018-08-30 14:56:45 +03:00
Ani
6fc869e21b Revert d1fd4d5000 2018-08-20 00:12:30 +04:00
eladash
f349695a75 Rsx: rewrite address translation 2018-08-13 16:16:34 +03:00
Nekotekina
801089cf44 PPU LLVM: always link syscall_## functions
Regardless of whether they have name or not
Should fix "Linkage failed" errors introduced after #4886
2018-08-12 15:42:47 +03:00
Nekotekina
d1fd4d5000 PPU: don't use transactions (test) 2018-08-12 02:42:32 +03:00
Chris Weermann (TGE)
fdcc5adc8d Fix overflow in PPUThread stack frame dump 2018-08-11 20:56:19 +04:00
Nekotekina
a0bf103e8b Implement cpu_translator::pshufb<>()
Remove spu_translator::pshufb<>()
Improve PSHUFB emulation (pre-SSSE3)
Emit static shufflevector for the constant mask
PPU: Inline VPERM instruction
2018-07-06 00:33:52 +03:00
isJuhn
83f096c435 Add conditional reservation update to STW 2018-06-23 23:13:34 +04:00
Nekotekina
6229b3ca8d Fixes for booting PS1 games 2018-06-23 17:30:16 +03:00
Nekotekina
e4da284176 SPU: analyser v4 and fixes
Build SPU cache after PPU, fix mixing progress
SPU ASMJIT: add support for Giga mode
SPU ASMJIT: use the same spu.log location as SPU LLVM
SPU: improve spu.log disasm
SPU: improve trampolines, unify with SPU ASMJIT
SPU: decode interrupt handler address from BR/BRA at 0x0
SPU LLVM: support Mega/Giga modes
SPU LLVM: implement function chunks
SPU LLVM: use PHI nodes, value visibility across basic blocks
SPU LLVM: implement function chunk table
New simple memory manager for LLVM (bugfix)
2018-06-21 22:29:34 +03:00
Nekotekina
b0ee369135 Rewrite LLVM compilation progress dialog
Use a single dialog
2018-05-30 20:35:35 +03:00
Nekotekina
72574b11ff SPU: use reservation spinlocks on writes (non-TSX)
This should decrease contention by avoiding global lock
2018-05-21 21:56:14 +03:00
Nekotekina
6fd402bcf8 Transactions: drop RDTSC usage
Use simple increment (minor optimization)
2018-05-21 00:18:37 +03:00
Nekotekina
33a1c743a4 Transactions: move loops inside
Rewrite loops in assembler (minor optimization)
2018-05-21 00:18:37 +03:00