Commit Graph

1173 Commits

Author SHA1 Message Date
Nekotekina c577bd2111 Implement thread_state::errored
State after calling thread emergency_exit() function.
Also default-construct thread result in this case.
2020-03-20 21:31:27 +03:00
Nekotekina aa5c6c4d2b Cleanup std::is_pod usage (deprecated in C++20) 2020-03-18 18:28:46 +03:00
Eladash c9b5ba4a5c BEType.h: use common initial sequance in v128
Partially obey 'strict type aliasing' rule.
2020-03-17 18:22:13 +03:00
Eladash cb4192bce9 vm: Log all guest memory bases at startup 2020-03-14 18:30:14 +02:00
Nekotekina 04dedb17eb Disable exception handling.
Use -fno-exceptions in cmake.
On MSVC, enable _HAS_EXCEPTION=0.
Cleanup throw/catch from the source.
Create yaml.cpp enclave because it needs exception to work.
Disable thread_local optimizations in logs.cpp (TODO).
Implement cpu_counter for cpu_threads (moved globals).
2020-03-12 16:03:08 +03:00
Nekotekina 6bd96a4590 Fix thread_base::finalize (and emergency_exit, collaterally)
Forgot to reset futex callback. Could cause crashes.
2020-03-10 23:23:32 +03:00
Bird Egop 4e25daffa6
Explicitly rename has_512 into has_avx512 (#7751) 2020-03-10 19:21:00 +03:00
Nekotekina 1678b37aa0 Use TRAP on segfault with debugger (Linux) 2020-03-10 14:06:06 +03:00
Nekotekina adfd8ab43c Break in the debugger in thread_ctrl::emergency_exit
Implement IsDebuggerPresent analog for non-Windows systems.
2020-03-10 13:28:24 +03:00
Nekotekina 87d4b14ca9 Pause only on fatal messages
Also make some access violation an error since we don't pause on it.
2020-03-10 11:26:42 +03:00
Nekotekina 07e1766a7c Implement thread_ctrl::emergency_exit()
Replace exception throws with this.
2020-03-08 15:11:02 +03:00
Nekotekina 12a3cdf0e8 Move Log.cpp to util/logs.cpp
Minor cleanup
2020-03-07 13:31:10 +03:00
Nekotekina e4a81b1d13 Move Log.h to util/logs.hpp 2020-03-07 12:29:23 +03:00
Nekotekina a166d3680e Don't throw on invalid whence (return fs::error::einval) 2020-03-07 11:52:54 +03:00
Nekotekina 8461a5cbe2 Add fs::error::unknown, don't throw 2020-03-07 11:22:04 +03:00
Nekotekina 66b0b78055 Logs.cpp: more code moved to main.cpp 2020-03-07 11:15:44 +03:00
Nekotekina 2209be5216 Logs: remove mem-mapped buffer and move instance lock to main.cpp
Part of the work to untangle utilities from RPCS3-specific things.
2020-03-07 10:49:09 +03:00
Adiost f776910966 Qt/Input: new ds4 LED settings 2020-03-05 22:37:48 +01:00
Nekotekina 7a8772dafa Replace std::string::npos with umax 2020-03-05 14:05:23 +03:00
Nekotekina Aux1 250736ece5 Fix warnings in emucore 2020-03-04 21:23:34 +03:00
Eladash bb1b4bac9b Update thread_base::notify_abort() 2020-03-04 14:39:41 +03:00
Nekotekina 8d847d6f1c Thread: internal cleanup
Use different, simpler algorithm in wait_for.
Although the very idea of such notifications was rotten.
2020-03-03 20:26:37 +03:00
Nekotekina d594490329 Thread: removed unused wait() with predicate.
It doesn't work this way anyway.
2020-03-03 18:33:02 +03:00
Nekotekina 6c66153372 Threads: move linux m_timer to static thread_local variable
Allows lazy allocation of the timer handle.
2020-03-03 18:33:02 +03:00
Nekotekina 5b0476e772 Update LLVM to new llvm-mirror (LLVM 11)
Use clang-cl to build LLVM on Windows.
2020-03-03 18:33:02 +03:00
Nekotekina cb252b1ce2 Partial revert of 5871c4e93f 2020-02-29 18:39:15 +03:00
Nekotekina d37e770497 Shut up all channels on exit at some point
Some object are getting destroyed.
Makes valgrind more quiet.
2020-02-29 18:29:32 +03:00
Eladash 5871c4e93f Segfault/exceptions reports: Get rid of unhandled exeption handler, log memory bases
* Getting rid of handled exception handler fixes 2 things:
- Visual Studio debugger won't force it's own handler on unhandled exception.
- SPU segfaults in recompiler can now be reported.

* Log vm memory bases.
2020-02-29 17:16:36 +03:00
Nekotekina f72971f19f Implement named_thread_group 2020-02-29 16:55:25 +03:00
Nekotekina 799c3f9708 Remove global thread counter (again)
Seems fine without it now.
2020-02-28 21:50:19 +03:00
Nekotekina 490f58ff3c Try to purge thread_state::detached
It's rarely necessary, but can cause unexpected problems.
2020-02-28 21:11:13 +03:00
Nekotekina 65eeee0f4c Remove cancerous lf_value<>
Replace thread names (generic, PPU, SPU) with new shared pointers.
Devirtualize cpu_thread::get_name (used in single case).
2020-02-28 18:54:46 +03:00
Nekotekina bf4bdf73b7 Remove unused lf_hashmap
There are better ways to implement this.
2020-02-28 18:54:46 +03:00
gamerforEA 93552a5958 Apply some Clang-Tidy fixes 2020-02-27 00:38:55 +03:00
gamerforEA 49294a3dd2 Add missing include guards 2020-02-27 00:38:55 +03:00
Nekotekina a0d2bc9769 named_thread: allow default constructor only with thread_name
In C++20, lambdas may be default-constructible allowing nasty stuff.
2020-02-26 21:23:30 +03:00
Eladash 0d4f8ca234 fs: Make fs::get_dir_size able to report an error 2020-02-26 18:17:13 +00:00
Nekotekina b083edccd3 Threads: remove some unused code (remnants from thread spawn) 2020-02-25 15:57:57 +03:00
Nekotekina b59bb16fad Threads: removed outdated on_abort detection deemed unnecessary
May cause regressions.
2020-02-25 15:48:25 +03:00
Nekotekina 3f943945a7 Threads: Remove unused on_wait() detection to simplify code 2020-02-25 15:36:08 +03:00
Nekotekina 7eebe06931 Restore thread counter (world may be not ready yet)
Remove dumb 1300ms timeout.
2020-02-25 11:51:19 +03:00
Megamouse f7666f44da Untangle GUI and input includes 2020-02-24 16:31:01 +01:00
Nekotekina e772dde3cc Add more thread information (context switch, page faults).
Only implemented on Linux, possibly works on some BSD.
2020-02-23 16:21:26 +03:00
Nekotekina 8b4b859091 Remove "thread_ctrl::spawn" 2020-02-23 15:03:38 +03:00
Nekotekina fa0bf6a92c Fix "unknown pragma" on zlib clang workarounds 2020-02-23 10:42:35 +03:00
JohnHolmesII 7eccbecb2f File.cpp: Make var ref instead of copy 2020-02-23 01:22:38 +01:00
Eladash 6bb083a77c
Add more information for segfault reports (#7538) 2020-02-22 10:58:42 +00:00
Megamouse 0dd417e5f2 Add more game window title options 2020-02-20 20:07:25 +01:00
Nekotekina 4d1f818162 umax: restore "natural" operation order 2020-02-20 17:13:41 +03:00
Nekotekina 2f255a528e Another attempt on umax 2020-02-20 15:18:31 +03:00
Nekotekina 92e3eaf3ff Fix signed-unsigned comparisons and mark warning as error (part 2). 2020-02-19 22:54:58 +03:00
Nekotekina 771eff273b First part of fixing sign-compare warning (inside be_t). 2020-02-19 22:54:58 +03:00
Nekotekina 0cf35e3b22 Implement umax global variable (max unsigned value)
Implements operators == and != comparisons.
2020-02-19 22:54:58 +03:00
Nekotekina 0ee2f761ae Fix warning in lf_fifo<>::push_begin() 2020-02-18 14:59:11 +03:00
Nekotekina f08c778d2c Use more starts_with/ends_with.
Remove ends_with global func.
2020-02-18 14:53:23 +03:00
Nekotekina 6a1a0bf48d Use std::endian for endianness test
Remove legacy IS_LE_MACHINE IS_BE_MACHINE macro.
2020-02-17 21:33:24 +03:00
Megamouse fe75311be2 move config structs to own files and clean up some headers 2020-02-17 15:08:17 +03:00
Eladash 606693a9f7 Avoid closing the emulator after access violation 2020-02-13 14:14:28 +03:00
Nekotekina e8988faed5 geometry.h: remove MSVC workaround 2020-02-12 12:50:42 +03:00
Nekotekina 7137142351 geometry.h: more cleanup
Remove wrong constructors.
2020-02-12 12:50:42 +03:00
Nekotekina bcbe324534 geometry.h: make conversion operators explicit
It requires static_cast<> to call them.
2020-02-11 13:21:45 +03:00
Eladash 639245c071 Make handle_access_violation noexcept 2020-02-10 17:27:34 +03:00
Nekotekina 034267adb2 Compilation fix 2020-02-10 16:57:56 +03:00
Nekotekina c0f80cfe7a Use attributes for LIKELY/UNLIKELY
Remove LIKELY/UNLIKELY macro.
2020-02-05 10:42:34 +03:00
Nekotekina 1a78e0e80c Make RPCS3 compile in C++2a mode 2020-02-04 23:43:55 +03:00
Nekotekina 0a2874405d logs: allow disabling RPCS3.log.gz
Disabled by creating a directory with the same name.
2020-02-02 14:32:29 +03:00
Nekotekina 87a5dd66ab Move logs::channel registration out of the constructor
Allow constinit initialization of logs::channel.
2020-02-02 14:12:54 +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 327bb2d8f0 Modernize PPU logging (ppu_log variable) 2020-02-01 11:52:24 +03:00
Nekotekina 21f7b0ff0f Remove HLE log channel 2020-02-01 11:52:24 +03:00
Nekotekina 15391f45d0 Modernize RSX logging (rsx_log variable) 2020-02-01 11:52:22 +03:00
Nekotekina 3c0bd821c8 Give log channels fancier names
Improve LOG_CHANNEL macro to accept custom name.
2020-02-01 10:43:43 +03:00
Nekotekina ec80932c21 logs: use relaxed atomics
May help with optimizations.
2020-02-01 10:30:03 +03:00
Nekotekina 3eca2d5d6c Remove legacy LOADER log channel 2020-02-01 07:49:38 +03:00
Nekotekina d9a0619ddd Remove legacy GENERAL log channel
Add some more log channels instead.
2020-02-01 07:49:38 +03:00
Nekotekina d5f019c3d3 Implement logs::silence
Disables all log channels.
Also disables unsupported "default" log level for log channels.
2020-01-31 16:44:48 +03:00
Nekotekina a867522b16 logs: implement logs::get_channels() 2020-01-31 16:44:48 +03:00
Nekotekina 26cccead6e logs: remove legacy MEMORY channel
Add channels vm_log, sig_log.
2020-01-31 16:44:48 +03:00
Nekotekina e7b24461ec Implement logs::get_level 2020-01-31 12:09:52 +03:00
Nekotekina 007a7a5859 Fixup for LOG system.
Register all channels at program initialization and allow duplicates.
2020-01-31 12:09:52 +03:00
Silent 9f678cc47a Fix code relying on initialization order
Allows Debug - LLVM to boot
2020-01-31 11:23:55 +03:00
RipleyTom 795bc5d52b Add mutex guard for s_unfire 2020-01-28 19:16:16 +03:00
Malcolm Jestadt ad8988afd3 Embedded SPU elf patching
- PS3 games include both PPU and SPU code in their PPU executables, so to make patching games that make use of the same SPU libraries easier, we add a system to find and patch them.
- Patches for this system still use SPU LS (Local Storage) addresses despite the fact that we aren't loading anything into SPU LS at this time. The patches are checked against each segment and patched in place.
2020-01-28 02:13:37 +03:00
Nekotekina 0f87c6c7c3 Make system config thread-safe (almost) 2020-01-20 21:51:28 +03:00
Nekotekina 7fcc49004d lf_fifo: fix UB and fix size()
Simplify internal counter to atomic<u64>.
Make size() return correct difference between push and pop pointers.
2020-01-17 00:24:07 +03:00
kd-11 071e73a68e geometry: Allow basic color arithmetic 2020-01-07 21:31:19 +03:00
Silent 974bce19ed Use path_append instead of operator + to concat paths
This allows to cleanly prevent double // slashes when appending paths
While this should not be a problem, Windows seems to have problems
with such paths when paths are very long - and preventing this
is trivial enough.
2019-12-31 19:24:19 +03:00
Silent 9e66f36942 Handle ERROR_FILENAME_EXCED_RANGE error on Windows 2019-12-31 19:24:19 +03:00
Megamouse ef6f565dbd silence some annoying warnings 2019-12-28 15:40:57 +01:00
Nekotekina 70e26eeb45 LLVM: compress PPU cache
Compress PPU modules to .gz (backward compatible with uncompressed cache)
2019-12-27 23:12:16 +03:00
Nekotekina baf9a20c08 Fix UB in to_u8
Possible signed shift overflow.
2019-12-23 22:56:18 +03:00
Nekotekina 068450d4fe CPUTranslator: detect FMA feature 2019-12-20 21:11:07 +03:00
Eladash db4041e079 Implement rounded_div
Round-to-nearest integral based division, optimized for unsigned integral.
Used in sceNpTrophyGetGameProgress.
Do not allow signed values for aligned_div(), align().
2019-12-20 14:47:04 +03:00
Nekotekina e3e97da7bb LLVM: remove cascadelake workaround and update LLVM fork
VPTERNLOG fix may be necessary.
2019-12-13 16:19:08 +03:00
Nekotekina dbece4d00f LLVM: add workaround for cascadelake CPU
Need to investigate it later.
2019-12-13 02:11:21 +03:00
Nekotekina 69e81da57b Fix some warnings 2019-12-13 02:08:52 +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 c3862b74b1 Compilation fix for NetBSD (#7067) 2019-12-05 11:28:00 +03:00
Nekotekina 835892aa51 C-style cast cleanup VII 2019-12-05 02:10:15 +03:00
Nekotekina bf11a28fb5 C-style cast cleanup IV 2019-12-01 22:12:33 +03:00
Nekotekina 28eacc616a C-style cast cleanup III 2019-12-01 00:32:44 +03:00
Nekotekina 5b9df53c13 C-style cast cleanup (partial)
Replace C-style casts with C++ casts.
2019-11-29 00:35:23 +03:00
Megamouse d91f8193b0 settings: enable dynamic reload of some emu values 2019-11-27 10:34:03 +01:00
Nekotekina fcc841eaa1 LLVM: Add workaround for znver2 2019-11-14 19:09:34 +03:00
msuih 1af948a7d4 Fix bitfield warning 2019-11-12 21:36:29 +03:00
Emmanuel Gil Peyrot 0ff5938b1f Utilities: Remove unused headers
AtomicPtr.h has never been used since its introduction in
da7472fe81.

Same for Interval.h, since 4fedf5749e.

event.h’s last usage got removed in
70e2873e69.
2019-11-12 19:51:57 +03:00
Emmanuel Gil Peyrot 56f82d2701 rsx: Wrap gsl::span definition into Utilities/span.h 2019-11-09 20:00:50 +01:00
Emmanuel Gil Peyrot 72cdf0b04c Replace gsl::span’s implementation with tcbrindle’s
This implementation optimises correctly on all relevant compilers,
unlike GSL’s which gave extremely slow code on any compiler other than
MSVC.

Supersedes #6948.
2019-11-09 19:30:06 +01:00
Emmanuel Gil Peyrot ef368c5171 rsx: Replace gsl::byte with C++17’s std::byte 2019-11-09 19:30:05 +01:00
Nekotekina 218758183d Avoid exceptions in cfg::try_to_int64 and cfg::try_to_enum_value
Use std::from_chars plus minimal hex prefix support.
2019-11-08 19:27:11 +03:00
Nekotekina 587ae17aa2 Simplify fmt::throw_exception
Gradual exception deprecation: disallow choosing exception type.
However, the function itself can remain here forever.
2019-11-08 19:27:11 +03:00
Nekotekina b338014639 Don't throw in operators _u16 _u32 _u64 2019-11-08 19:27:11 +03:00
Nekotekina 742bd633d8 Remove fs::file::set_delete
Since it's Windows-only functionality with limited use.
2019-11-08 19:27:11 +03:00
Eladash d2f3ada312 bf_t: Remove <limits> lib dependency 2019-11-03 14:59:47 +03:00
Rajko Stojadinovic b49b4c8096 Rewrite the way LLVM JIT does memory allocation to allow use of more than one contiguous segment (#6771) 2019-10-29 01:01:07 +03:00
Nekotekina 46d692d5a6 Fix long path support in fs::statfs on Windows 2019-10-27 19:17:27 +03:00
Nekotekina 839e088ae5 Fix long path support on Windows for UNC path
Such as network locations.
2019-10-27 18:53:40 +03:00
Nekotekina 7a32af7a57 Implement lf_bunch<>
Simple concurrent container without erase support.
2019-10-26 21:24:12 +03:00
Nekotekina 2e85b5ebaa SPU: Make JIT allocator lock-free on all platforms 2019-10-26 21:24:12 +03:00
Nekotekina 0c06456950 Simplify lf_queue<> (second attempt)
It doesn't need reinterpret_cast anymore.
2019-10-26 21:24:12 +03:00
MSuih f3ed26e9db Small warnings cleanup (#6671)
* Ignore more warnings

These are intentional

* Signed/unsigned mismatch when comparing

* Explictly cast values

* Intentionally discard a nodiscard value

* Change ppu_tid to u32

* Do not use POSIX function name on Windows

* Qt: Use horizontalAdvance instead of width

* Change progress variables to u32
2019-10-25 13:32:21 +03:00
RipleyTom a32f979814 Conserve error value when trying to open log file 2019-10-24 22:22:15 +03:00
RipleyTom c89ad38ef1 Check if we're in the process of restarting when trying to open the log 2019-10-24 18:36:28 +02:00
Nekotekina 6867fc5f06 Revert "Simplify lf_queue<>"
This reverts commit 050e5b4aec.
2019-10-23 21:55:31 +03:00
Nekotekina 050e5b4aec Simplify lf_queue<>
It doesn't need reinterpret_cast anymore.
2019-10-23 16:01:14 +03:00
Nekotekina 6e19881b82 Update LLVM (10) 2019-10-23 16:01:14 +03:00
Emmanuel Gil Peyrot 9d1b7af2eb Avoid std::move() for copy elision
This could disable zero-copy optimisations, which is the opposite of
what we want.
2019-10-22 16:11:43 +03:00
RipleyTom 9f9ac4b696 Auto-updater 2019-10-22 01:51:50 +02:00
Marin Baron 90aaaceba0 Debug build : Check ObjectFile before reading.
Check LLVM ObjectFile state before access to avoid llvm assertion failure.

Expected<T> must be checked before access or destruction.
Expected<T> value was in success state. (Note: Expected<T> values in success mode must still be checked prior to being destroyed).
2019-10-21 00:40:12 +03:00
Nekotekina 3304cfacde cond_variable: improve wait a bit
Mask signal bits
2019-10-19 14:02:13 +03:00
Nekotekina db7042b986 Restore using keyed events in waitable atomics on Windows 2019-10-18 23:08:00 +03:00
Nekotekina 7ca76ae5a8 Workaround fs::create_path for drive roots
Should fix the regression from #6763
2019-10-15 18:57:16 +03:00
Nekotekina eafbc77c0d SPU LLVM: Always use linux-gnu target triple (affects Windows)
Unify internal code generation to make better use of GHC calling convention.
Ideally, it would just work on Windows as well, but some random bug appeared.
This bug was causing freezes on SPU LLVM compilation.
This commit desperately attempts to workaround it.
2019-10-15 18:04:50 +03:00
Nekotekina 6b1df1ce31 fs: add long path support on Windows
Extend path limit with \\?\ prefix.
2019-10-14 19:42:13 +03:00
Nekotekina c4ccac9a9c [TSX] Fix XABORT handling
Break repeat loop after explicit transaction abort.
May have performance consequences.
2019-10-13 19:35:12 +03:00
Nekotekina ac712bf4e3 lf_queue: remove explicit notify(), notify in push() instead
Should be cheap enough now if there are no waiters.
2019-10-12 22:45:17 +03:00
Nekotekina 5624b001ae lf_queue: add range-for support (endless loop with waiting) 2019-10-12 22:37:52 +03:00
Nekotekina 6a443c0fbd Deprecate thread_ctrl::spawn 2019-10-12 19:14:50 +03:00
Nekotekina 8e21f4d5d4 Remove g_thread_count
Unnecessary global which is bad to reason about.
Possibly fix a but in SPRX loader.
2019-10-12 16:45:41 +03:00
plappermaul 925f2ce02f Use Linux timers for sleeps up to 1ms (#6697)
* Use Linux timers for sleeps up to 1ms (v3)
The current sleep timer implementation basically offers two variants. Either
wait the specified time exactly with a condition variable (as host) or use a
combination of it with a thread yielding busy loop afterwards (usleep timer).

While the second one is very precise it consumes CPU loops for each wait call
below 50us. Games like Bomberman Ultra spam 30us waits and the emulator hogs
low power CPUs. Switching to host mode reduces CPU consumption but gives a
~50us penalty for each wait call. Thus extending all sleeps by a factor of
more than two.

The following bugfix tries to improve the system timer for Linux by using
Linux native timers for small wait calls below 1ms. This has two effects.

- Host wait setting has much less wait overhead
- usleep wait setting produces lower CPU overhead
2019-10-09 20:03:34 +03:00
Nekotekina 8f604ddded Fix log format misuse
Harden log channel methods against non-constant string.
2019-10-09 02:14:52 +03:00
Nekotekina a29d4150df GDB Server: fix and cleanup
Move source files to Emu/GDB.cpp, GDB.h
Remove "WITH_GDB" option, enable GDB Server by default.
Change class name to gdb_thread.
Alias for external access gdb_server.
Change config option name to "GDB Server"
Bind on 127.0.0.1 by default.
2019-10-09 00:11:44 +03:00
Nekotekina aa659f3c36 Fix minor warning 2019-10-06 20:40:53 +03:00
Nekotekina cf13dee1f3 Prioritize vip_lock in shared_mutex
Should fix some deadlock issues.
2019-10-06 16:03:38 +03:00
Nekotekina 8031180373 Add dummy alert param to thread_ctrl::wait API 2019-10-06 16:03:10 +03:00
Rajko Stojadinovic 297e3c5996 Make windows_file::stat return the same mtime as fs::stat 2019-10-05 14:25:34 +03:00
kd-11 4a19a2dd24 rsx: Explicity describe transfer regions for both source and destination blocks 2019-10-04 18:10:46 +03:00
Nekotekina 21885264f7 Improve to_se conversion template
Add sizeof check instead of filtering out 1-byte types.
2019-09-28 15:39:50 +03:00
Nekotekina bd1a24b894 Tidy endianness support (se_t) implementation
Move se_t and se_storage to util/endian.hpp
Use single template instead of two specializations.
Add minor optimization for MSVC.
Remove v128 dependency.
Try to enable intrinsics for unaligned data.
Fix minor bug in u16/u32/u64 specializations.
2019-09-28 15:39:50 +03:00
kd-11 2275259bf5 rsx: Properly scale overlay passes to match drawable area 2019-09-28 13:24:14 +03:00