Eladash
5e01ffdfd8
Debugger: Optimize cpu_thread::dump_regs()
...
Reuse string buffer. Copies and reallocations are expensive with such large strings.
2022-06-23 22:41:32 +02:00
Eladash
64399d45c1
vm: Make falloc return value bool
...
Allow to check properly for the success of 0 address allocation.
2022-06-22 21:01:37 +03:00
Nekotekina
5c1f79ab26
vm: remove g_mutex, use g_range_lock instead
...
Simplification and performance improvements.
2022-05-02 10:29:28 +03:00
Jan Beich
f04655c814
Thread: define how to access PC on BSD aarch64 after 580bd2b25e
...
Utilities/Thread.cpp:1799:51: error: no member named 'pc' in '__mcontext'
const bool is_executing = uptr(info->si_addr) == RIP(context);
^~~~~~~~~~~~
Utilities/Thread.cpp:1800:62: error: no member named 'pc' in '__mcontext'
const u32 insn = is_executing ? 0 : *reinterpret_cast<u32*>(RIP(context));
^~~~~~~~~~~~
Utilities/Thread.cpp:1836:90: error: no member named 'pc' in '__mcontext'
std::string msg = fmt::format("Segfault %s location %p at %p.\n", cause, info->si_addr, RIP(context));
^~~~~~~~~~~~
Utilities/Thread.cpp:1229:46: note: expanded from macro 'RIP'
#define RIP(context) ((context)->uc_mcontext.pc)
~~~~~~~~~~~~~~~~~~~~~~ ^
Based on https://github.com/mozilla/gecko-dev/commit/480b73c38c73
2022-04-24 15:40:33 +03:00
sguo35
e761b3235c
macos: fix build for arm64
...
Adds arm64 branches to some x86 specific code and modifies some casting
logic to make Clang happy
2022-04-18 17:53:54 +03:00
Nekotekina
0a617a05d0
PPU: correct behaviour under external debugger
...
May require setting "Assume External Debugger" to true.
2022-03-26 23:09:20 +03:00
Nekotekina
12c83b340d
Remove built_function
...
With today's branch prediction techniques, it's hardly useful.
2022-01-24 22:21:41 +03:00
Nekotekina
4704367382
Remove unnecessary asmjit::imm_ptr
2022-01-18 00:10:32 +03:00
Nekotekina
580bd2b25e
Initial Linux Aarch64 support
...
* Update asmjit dependency (aarch64 branch)
* Disable USE_DISCORD_RPC by default
* Dump some JIT objects in rpcs3 cache dir
* Add SIGILL handler for all platforms
* Fix resetting zeroing denormals in thread pool
* Refactor most v128:: utils into global gv_** functions
* Refactor PPU interpreter (incomplete), remove "precise"
* - Instruction specializations with multiple accuracy flags
* - Adjust calling convention for speed
* - Removed precise/fast setting, replaced with static
* - Started refactoring interpreters for building at runtime JIT
* (I got tired of poor compiler optimizations)
* - Expose some accuracy settings (SAT, NJ, VNAN, FPCC)
* - Add exec_bytes PPU thread variable (akin to cycle count)
* PPU LLVM: fix VCTUXS+VCTSXS instruction NaN results
* SPU interpreter: remove "precise" for now (extremely non-portable)
* - As with PPU, settings changed to static/dynamic for interpreters.
* - Precise options will be implemented later
* Fix termination after fatal error dialog
2022-01-15 06:48:04 +03:00
nastys
0d1c0e72a6
macOS: Increase thread stack size to 8 MiB
2022-01-11 08:05:17 +03:00
nastys
3571e6ef85
macOS: Set correct maxfiles (fixes shader cache and SPU LLVM)
2022-01-11 08:05:17 +03:00
Vestrel
1adc408ad7
More sys_uart packets ( #11332 )
...
* Additional sys_uart packets added
2022-01-10 03:43:54 +03:00
Nekotekina
cb2748ae08
Update ASMJIT (new upstream API)
2021-12-29 02:45:00 +03:00
Nekotekina
d836033212
LLVM: enable some JIT events (Intel, Perf)
...
Made some related adjustments.
Currently incomplete.
2021-12-26 16:41:37 +03:00
nastys
08333e0876
macOS moltenVK support and SIGBUS handling ( #11252 )
2021-12-12 21:35:56 +01:00
Eladash
cb4711203b
logging: Tell apart PPU access violation caused by executing unmapped memory
2021-12-05 01:22:32 +03:00
Eladash
e10c6cbaf7
SPU: cpu_work() fixup, fix recursion in AV handler
2021-09-18 19:43:55 +03:00
Eladash
bd66dfedc9
Do not allow to unpause after fatal error occured in emulation
...
* Plus fix #10590
2021-09-09 19:30:54 +02:00
Nekotekina
5ba8daf518
Fix thread time/cycles report with respect to thread pool
...
Fix all RUSAGE stats as well (POSIX)
2021-08-01 09:59:00 +03:00
Nekotekina
160b131de3
types.hpp: implement smin, smax, amin, amax
...
Rewritten the following global utility constants:
`umax` returns max number, restricted to unsigned.
`smax` returns max signed number, restricted to integrals.
`smin` returns min signed number, restricted to signed.
`amin` returns smin or zero, less restricted.
`amax` returns smax or umax, less restricted.
Fix operators == and <=> for synthesized rel-ops.
2021-05-22 12:10:57 +03:00
Eladash
638f20c80f
Improve get_current_cpu_thread()
2021-05-20 09:25:51 +03:00
David Carlier
b09970f159
couple of warning build fixes
2021-05-09 09:25:40 +02:00
Eladash
daa53b77cf
Simplify named_thread construction
2021-05-01 18:08:03 +03:00
David Carlier
b6732fbae9
MacOs build fix proposal.
...
Made on Big Sur, removing few unnecessary old specifics.
Build with LLVM homebrew.
2021-04-18 17:18:09 +03:00
p01arst0rm
c9d2aed286
small collection of fixes
2021-04-15 11:05:15 +03:00
Megamouse
a16d8ba3ea
More random changes
2021-04-11 14:01:51 +03:00
Eladash
73320d4180
Output all fatal log messages to Console/debugger as well
2021-04-03 08:47:58 +02:00
Eladash
5a3c218239
thread-pool: Fix default rounding mode
2021-03-30 11:13:47 +03:00
xddxd
9d895e6b15
Scheduler overhaul
2021-03-26 00:29:44 +03:00
Eladash
a67b347966
debugger: Fix SPU memory viewing ( #10007 )
...
* debugger: Fix SPU memory viewing
* Fix terminal recovery from page faults (hack allocation)
2021-03-23 13:33:07 +03:00
Eladash
a5bb925a3d
Thread.cpp: Add missing newline
2021-03-15 20:41:33 +03:00
Eladash
cd6ef2958b
Add information about unnamed/main threads in logs and fatal dialog
...
* If thread is unnamed, keep log name empty for main thread, otherwise print thread id. In fatal dialog, main thread can be handled differently (with special remark that it's main thread).
* Always print thread id in fatal dialog, regardless of thread type.
Co-authored-by: Nekotekina <nekotekina@gmail.com>
2021-03-11 22:55:06 +03:00
Nekotekina
a4fdbf0a88
Enable -Wstrict-aliasing=1 (GCC)
...
Fixed partially.
2021-03-09 03:10:15 +03:00
Nekotekina
3609eb25c9
Implement thread_ctrl::is_main()
2021-03-06 23:10:31 +03:00
Nekotekina
55c75d2c87
Implement thread_ctrl::get_tid()
2021-03-06 23:10:31 +03:00
Nekotekina
87af905018
Enable -Wunused-parameter
2021-03-06 18:07:08 +03:00
Nekotekina
ea5e837bd6
fixed_typemap.hpp: return reference
2021-03-02 16:08:14 +03:00
Nekotekina
bbf52f3cea
named_thread: fix bugs in std::forward usage
...
Fix few misused threads and other bugs.
2021-03-02 16:08:14 +03:00
Eladash
48cd56acc2
Report deadlocked thread names in failures to stop emulation ( #9865 )
...
* Report deadlocked thread names in failures to stop emulation
Co-authored-by: Nekotekina <nekotekina@gmail.com>
2021-03-01 01:06:48 +03:00
Nekotekina
de9d859f4a
named_thread: implement task queue
...
atomic_ptr: implement push_head()
thread_ctrl::state() triggers task queue execution.
2021-02-28 20:20:17 +03:00
Nekotekina
3aaa0172d5
named_thread: implement "default" event loop
...
Fixup "sleepy" thread at startup on Windows.
Permit threads which lack operator()() overload.
2021-02-28 20:16:13 +03:00
Nekotekina
038148bf06
Fix almost all GCC warnings
2021-02-17 22:59:04 +03:00
Eladash
f43260bd58
Atomic waiting refactoring ( #9208 )
...
* Use atomic waitables instead instead of global thread wait as often as possible.
* Add ::is_stopped() and and ::is_paued() which can be used in atomic loops and with atomic wait. (constexpr cpu flags test functions)
* Fix notification bug of sys_spu_thread_group_exit/terminate. (old bug, enhanced by #9117 )
* Function time statistics at Emu.Stop() restored. (instead of current "X syscall failed with 0x00000000 : 0")
2021-02-13 17:50:07 +03:00
Eladash
d3bc96a201
Fix minor issue with usage of STL thread::hardware_concurrency()
2021-01-29 18:23:29 +03:00
Eladash
a742501a4f
Do not account RSX for TSX pauses
2021-01-29 10:31:15 +03:00
Eladash
0652870204
New RSX Debugger
2021-01-28 17:40:26 +03:00
Nekotekina
34274ec391
Purge unused typeid() invocations
2021-01-28 10:23:29 +03:00
Eladash
28feea0447
Unfatal Segfaults
2021-01-27 21:54:29 +03:00
Nekotekina
c652d0b183
Detect execution access violation
...
Don't try to handle it, treat as fatal.
2021-01-27 11:53:10 +03:00
Nekotekina
22c55cbcfa
Add trace logging to thread_ctrl::set_thread_affinity_mask
2021-01-26 19:59:48 +03:00
Nekotekina
c24d89dd34
Threads: fix typo in emergency_exit (dump useful info)
2021-01-26 19:58:47 +03:00
Nekotekina
f10ea1fb9b
Thread pool: try to fix resetting affinity mask
...
Attempt to address #9657
2021-01-26 16:45:36 +03:00
Nekotekina
eb72cc9f04
Thread pool: reset thread affinity mask
2021-01-25 22:05:38 +03:00
Nekotekina
8480674708
Thread pool: reset priority
2021-01-24 16:45:28 +03:00
Eladash
dbecf0fa50
Introducing RSX debugger entry (main debugger)
2021-01-19 22:55:12 +03:00
Nekotekina
db8e6fe7a7
Enable -Wunused-variable
2021-01-12 14:34:14 +03:00
kd-11
5f8564c655
Update Utilities/Thread.cpp
...
Co-authored-by: Bird Egop <sampletext32@bk.ru>
2021-01-03 19:31:18 +03:00
kd-11
cbe0000d23
Improved Zen chip detection
2021-01-03 19:31:18 +03:00
JohnHolmesII
57621d1c4e
Types: Use nullptr over 0
2020-12-29 14:17:34 +03:00
JohnHolmesII
76b1acf99d
Warnings: Ensure death functions are all marked noreturn
2020-12-29 14:17:34 +03:00
Eladash
66581d115b
vm: Fix access violations on super memory, support super memory in vm::get_addr
2020-12-26 17:56:49 +03:00
Nekotekina
bd269bccaf
types.hpp: remove intrinsic includes
...
Replace v128 with u128 in some places.
Removed some unused files.
2020-12-21 21:11:25 +03:00
Nekotekina
db9b7db531
Cleanup and move sysinfo.h -> util/sysinfo.hpp
2020-12-18 12:55:54 +03:00
Nekotekina
05099e2ae1
Replace uint64_t with u64
2020-12-18 12:23:53 +03:00
Nekotekina
fb29933d3d
Add usz alias for std::size_t
2020-12-18 12:23:53 +03:00
Nekotekina
6b3f722ff0
Hotfix: useless error
2020-12-16 11:57:29 +03:00
Nekotekina
e321765c54
Split BEType.h to util/v128.hpp and util/to_endian.hpp
2020-12-13 16:34:45 +03:00
Nekotekina
a6a5292cd7
Use uptr (std::uintptr_t alias)
2020-12-12 16:29:55 +03:00
Nekotekina
36c8654fb8
Remove HERE macro
...
Some cleanup.
Add location to some functions.
2020-12-10 12:30:22 +03:00
Nekotekina
e055d16b2c
Replace verify() with ensure() with auto src location.
...
Expression ensure(x) returns x.
Using comma operator removed.
2020-12-09 15:43:38 +03:00
Nekotekina
77aa9e58f2
shared_ptr.hpp: add trivial conversion for shared/single types
...
These conversions don't exist in std::shared_ptr-alike types.
But I don't want to bother with == operators until we have proper C++20.
Removed trivial conversion for atomic_ptr because it's heavyweight.
2020-12-07 15:33:28 +03:00
Nekotekina
8efc22bd45
atomic.hpp: simplify and unify bit test instructions
...
Also make them available on all platform.
Rename some rare methods.
2020-12-04 14:33:38 +03:00
Nekotekina
0892758994
Minor debugging enhancement
...
Use raise(SIGTRAP) in failed SIGSEGV handling and return.
2020-11-26 20:11:26 +03:00
Nekotekina
22a24446c1
Threads: fix minor race
...
Has already been in "fixed" state in past...
2020-11-26 20:11:26 +03:00
Nekotekina
b5d498ffda
Homebrew atomic_ptr rewritten (util/shared_ptr.hpp)
...
It's analogous to C++20 atomic std::shared_ptr
The following things brought into global namespace:
single_ptr
shared_ptr
atomic_ptr
make_single
2020-11-26 20:11:26 +03:00
Nekotekina
43952e18e2
Implement prefetch_write() and prefetch_exec() wrappers
...
Do some refactoring to prefetch_read() in util/asm.hpp as well.
Make all these function constexpr because they are no-ops.
2020-11-24 12:31:11 +03:00
Nekotekina
b954a41f2a
Threads: minor simplification
2020-11-24 01:09:04 +03:00
Nekotekina
d4c17ecda5
Simplify communication with thread pool
...
Add "entry_point" member to "thread_base".
Don't use "m_thread" to exchange values.
2020-11-23 11:32:34 +03:00
Nekotekina
a4458e2c8c
Clean thread pool at exit.
...
Execute TLS destructors.
Test atomic wait list.
2020-11-23 10:20:42 +03:00
Nekotekina
71f1021648
Fix thread pool entry point and get_cycles()
...
Fix possible race between thread handle availability.
Don't treat zero thread as invalid one.
Now entry point is full is assembly.
Attempt to fix #9282
Also fix some TLS.
2020-11-21 17:18:42 +03:00
Nekotekina
d789250976
Add thread_ctrl::get_thread_stack
...
Returns addr and size of current thread's stack.
2020-11-17 05:33:46 +03:00
Nekotekina
dfae7bd073
SPU: Fix some stat printing
2020-11-15 04:41:16 +03:00
Nekotekina
badb3dc2dd
atomic.cpp/threads: remove old wait callback
...
Add new wait callback which simply collects statistics.
Shift workarounds towards actual problem detection.
2020-11-14 18:16:27 +03:00
Nekotekina
0c7f9458c0
Fix thread pool resource management.
...
Make sure no tail call happens (change ret address to a trampoline).
Make sure thread handles don't leak if the pool is full.
2020-11-13 17:17:45 +03:00
Nekotekina
ab365fe494
Fixed thread pool a bit
...
Use 128-bit allocator instead of queue.
When pool is full (128), threads just terminate as before.
2020-11-13 13:32:44 +03:00
Nekotekina
67785a918c
Implement simple thread pool
2020-11-13 03:32:24 +03:00
RipleyTom
1378645413
Adds SIGPIPE to ignored exceptions(unix)
2020-11-12 07:08:59 +03:00
Eladash
829a697c39
Fix vm::check_addr calls in Thread.cpp
2020-11-11 17:40:46 +03:00
Nekotekina
1c99a2e7fb
vm: add map_self() method to utils::shm
...
Add complementary unmap_self() method.
Move VirtualMemory to util/vm.hpp
Minor associated include cleanup.
Move asm.h to util/asm.hpp
2020-11-08 16:43:15 +03:00
Nekotekina
557f0c5a8a
atomic.cpp: remove load() from notify functions
...
Only compare masks for overlap for second overload (with mask provided).
Explicit "new value" can be provided in new 3-arg overloads.
Also rename atomic_storage_futex -> atomic_wait_engine.
2020-11-06 04:44:31 +03:00
Nekotekina
34fa010601
Improve cond_var notifiers
...
But nobody uses it anyway, so clean up includes.
2020-11-06 00:10:16 +03:00
Nekotekina
5248240e10
atomic.cpp: improvements.
...
Reduced static memory amount for waitable atomics.
Allow notifier to skip notifications if wait/notify masks don't overlap.
Improve raw_notify to wake up the thread by its id, add thread_id arg.
Add optional mask argument to notify_one() and notify_all().
2020-11-05 05:51:43 +03:00
Nekotekina
ba5ed5f380
Fix vm::lock_range wrong check
...
Minor header refactoring.
2020-11-04 14:59:26 +03:00
Megamouse
2cee26c3e7
Cleanup some includes
2020-10-31 11:53:46 +01:00
Nekotekina
f972fa26a4
Derive RSX Replay thread from cpu_thread
...
Its id is set to 0, so fix some id_type() usages.
2020-10-30 17:36:11 +03:00
Nekotekina
6806e3d5c7
atomic.cpp: implement notify callback
...
Notification can be very heavy, especially if we need to wake many threads.
Callback is set for cpu_thread in order to set wait flag accordingly.
2020-10-27 17:56:19 +03:00
Nekotekina
10caa2981f
Improve raw_notify a bit
2020-10-24 14:16:32 +03:00
Eladash
3c935f7834
SPU: Fix minor segfaults ( #9015 )
...
SPU: Remove "RawSPU Not Found" exception.
Fix edge case in access violation handler.
2020-10-11 14:59:18 +03:00
Eladash
a029a94c73
SPU: Use waitable atomics for SPU channels interface
2020-07-23 13:45:58 +03:00
Eladash
c37bc3c55c
SPU: Make spu_thread::offset private
2020-07-19 17:58:49 +03:00