Commit Graph

299 Commits

Author SHA1 Message Date
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
Eladash d86c9a2549 sys_mmapper: rewrite page fault thread notifications
* Fix a corner case where SPU thread has the same ID as a PPU thread.
* Fix a potential deadlock on Emu.Stop() while sending event in EBUSY loop.
* Thread specific notifications.
2020-06-18 20:13:54 +03:00
Eladash b8f86eb78d SPU: Fix page faults notifications 2020-05-23 00:48:28 +03:00
Nekotekina e1042bc631 Get rid of "module" keyword
Workaround some intellisense problems.
2020-05-06 18:20:11 +03:00
Nekotekina a6f0b1b532 Fix get_thread_affinity_mask (Linux/BSD)
Uninitialized variable (facepalm).
2020-05-05 21:44:32 +03:00
Nekotekina 31035608ee Use utils::get_cpu_brand when applicable 2020-05-01 22:00:57 +03:00
Nekotekina f6200ba635 Implement thread_ctrl::get_process_affinity_mask() 2020-05-01 22:00:56 +03:00
Nekotekina 76294beae1 Implement thread_ctrl::get_thread_affinity_mask() 2020-04-29 00:09:40 +03:00
Nekotekina d0c199d455 Replace utils::cnttz{32,64} with std::countr_{zero,one}
Make #include <bit> mandatory.
2020-04-14 16:05:58 +03:00
Eladash c3a4e57efe Reduce log level of page fault notifications
Log current hle function.
2020-04-12 10:30:38 +01:00
Nick Renieris 1231274e0f CPUThread: Split dump() info to separate methods 2020-04-03 01:36:35 +01:00
Megamouse a76a4d8136 change sig_log to SIG 2020-03-31 18:06:37 +02:00
Jan Beich 777f0a7c82
Implement IsDebuggerPresent on BSDs (#7880) 2020-03-28 01:57:41 +00:00