Commit Graph

398 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
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
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 e4a81b1d13 Move Log.h to util/logs.hpp 2020-03-07 12:29:23 +03:00
Nekotekina 7a8772dafa Replace std::string::npos with umax 2020-03-05 14:05:23 +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 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 cb252b1ce2 Partial revert of 5871c4e93f 2020-02-29 18:39:15 +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 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 7eebe06931 Restore thread counter (world may be not ready yet)
Remove dumb 1300ms timeout.
2020-02-25 11:51:19 +03: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
Eladash 6bb083a77c
Add more information for segfault reports (#7538) 2020-02-22 10:58:42 +00:00
Nekotekina 92e3eaf3ff Fix signed-unsigned comparisons and mark warning as error (part 2). 2020-02-19 22:54:58 +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
Eladash 639245c071 Make handle_access_violation noexcept 2020-02-10 17:27:34 +03:00
Nekotekina 1a78e0e80c Make RPCS3 compile in C++2a mode 2020-02-04 23:43:55 +03:00
Nekotekina 327bb2d8f0 Modernize PPU logging (ppu_log variable) 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 26cccead6e logs: remove legacy MEMORY channel
Add channels vm_log, sig_log.
2020-01-31 16:44:48 +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 5b9df53c13 C-style cast cleanup (partial)
Replace C-style casts with C++ casts.
2019-11-29 00:35:23 +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
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 8031180373 Add dummy alert param to thread_ctrl::wait API 2019-10-06 16:03:10 +03:00
Nekotekina c1b0934f72 Simplify thread_base::join()
Use waitable atomics
2019-09-10 19:25:39 +03:00
Nekotekina d13ff285d1 Rewrite `cond_variable` to use waitable atomics
Increase max_timeout and fix max_timeout usage
2019-09-10 19:25:39 +03:00
Nekotekina faba366f89 named_thread: install atomic wait callback 2019-09-10 18:48:46 +03:00
Jan Beich 53e7f6c5a5 Thread: drop is_leaf_function after 5e3bacbd9b 2019-09-10 17:41:15 +03:00
Nekotekina 2740fafa64 Use g_fxo for page_fault_notification_entries 2019-08-22 02:13:39 +03:00
Nekotekina a85a8796d3 Use g_fxo for page_fault_event_entries 2019-08-22 02:13:39 +03:00
Nekotekina f8f3067deb Always check page_allocated in vm::check_addr 2019-08-14 20:28:34 +03:00
Eladash 997e3046e3 vm/sys_overlay Improvements
- Implement sys_overlay_load_module_by_fd.
- Implement special segment allocation when ppc_seg flag is specified.
2019-07-28 14:23:58 +03:00
Zangetsu38 a98a2b79d0 thread scheduler: Add scheduler for zen2 and refactor for zen(+). 2019-07-21 23:02:11 +03:00
Nekotekina 4e4c896136 Expand thread affinity mask to u64
Also fix and note __APPLE__ path.
2019-07-20 15:58:28 +03:00
Eladash c727760537 Fix g_exec_addr addres check for access violations 2019-07-13 16:59:58 +03: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
eladash 0979207cc6 Log currently PPU HLE function executed after access violation
old functionality retrieved
2019-07-10 17:35:39 +03:00
JohnHolmesII 232a35b6fc Various small warning fixes
-Indentation warnings
-prevent shift overflow
-This was declared extern in all contexts. Remove this for initialization
-Fix main return types. OH CANADA!
-Silence extraneos 'unused expression' warning
-Force use return value (warning)
-Remove tautological compare copy-pasta (char always < 256)
2019-06-28 01:45:29 +03:00
JohnHolmesII be521ff0ab Fix warnings related to parentheses 2019-06-25 20:36:32 -07: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 a3f65084df Fix sys_process_exit2 when SPUs are at av handler 2019-03-31 14:57:21 +03:00
eladash 16f86b2458 Fix page fault area range check
Range end check was bugged (always true), also rewrite it so vm::get would be called only once
2019-03-31 14:57:21 +03:00
Jan Beich 1a13d3ae4e OpenBSD doesn't have mcontext_t
`<signal.h>` provides `typedef struct sigcontext ucontext_t`
2019-03-19 22:24:49 +03:00
eladash 4a28319edf Implement SPU page faults notifications
* Implement both RawSPU and threaded SPU page fault recovery
* Guard page_fault_notification_entries access with a mutex
* Add missing lock in sys_ppu_thread_recover_page_fault/get_page_fault_context
* Fix EINVAL check in sys_ppu_thread_recover_page_fault, previously when the event was not found begin() was erased and
CELL_OK was returned.
* Fixed page fault recovery waiting logic:
- Do not rely on a single thread_ctrl notification (unsafe)
- Avoided a race where ::awake(ppu) can be called before ::sleep(ppu) therefore nop-ing out the notification
* Avoid inconsistencies with vm flags on page fault cause detection
* Fix sys_mmapper_enable_page_fault_notification EBUSY check
from RE it's allowed to register the same queue twice (on a different area) but not to enable page fault notifications twice
2019-03-12 13:28:31 +03:00
eladash 25aa5f80a6 Fix access violations reporting on RSX
and on other threads that do not have cpu_thread handler
2019-01-30 18:44:29 +03:00
eladash b61492ca30 Dont call std::terminate() after normal access violation handling 2019-01-30 18:44:29 +03:00
JohnHolmesII be75a564ca Fix builds with musl c 2018-12-30 21:31:06 +03:00
msuih dbd4814584 Disable thread assignment for Intel 2018-12-24 19:33:08 +00:00
msuih 1dd3a4b3f0 Detect hyperthreading on Windows 2018-12-24 19:33:08 +00:00
vit9696 634a5fa31c Fix macOS compilation 2018-11-19 14:39:33 +03:00
Dennis Luxen 36d4614d12 Fix a warning that shift overflows data type width (#5116) 2018-10-23 18:49:01 +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 8ca6c9fff0 Fix thread_base::get_cycles (Linux/POSIX) 2018-10-19 22:22:35 +03:00
Nekotekina bc87c5808c Add cond_variable::wait_unlock 2018-10-02 23:26:54 +03:00
Nekotekina 3359e9a51b Minor thread fixes
Call thread result destructor
2018-10-02 02:22:26 +03:00
Nekotekina 306f95a9ae New named_thread template (preview)
Old class named_thread renamed to old_thread
It's too hard to move in a single commit
2018-09-27 14:04:16 +03:00
Rui Pinheiro 13faf4e816 Avoid silent failures in RSX violation handler 2018-09-24 15:26:40 +03:00
Nekotekina c5676e5649 Remove thread_ctrl::atexit
It was only a workaround for poor C++11 thread_local support
2018-09-15 17:09:56 +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
eladash f349695a75 Rsx: rewrite address translation 2018-08-13 16:16:34 +03:00
VelocityRa 8981227644 util/thread_ctrl: Method for measuring cycles a thread has run for
Also add a getter for the native thread handle.
2018-05-30 12:35:41 +03:00
kd-11 824340363d disable thread scheduler on intel 2018-05-29 13:54:30 +03:00
Jan Beich e487480ca9 Thread: unbreak build on BSDs after ac82ecf387
Utilities/Thread.cpp:1644:2: error: use of undeclared identifier 'pthread_setname_np'; did you mean 'pthread_set_name_np'?
        pthread_setname_np(pthread_self(), m_name.substr(0, 15).c_str());
        ^~~~~~~~~~~~~~~~~~
        pthread_set_name_np
/usr/include/pthread_np.h:58:6: note: 'pthread_set_name_np' declared here
void pthread_set_name_np(pthread_t, const char *);
     ^
2018-03-13 12:51:22 +04:00
Nekotekina ac82ecf387 Use pthread_setname_np (Linux, GDB) 2018-03-11 19:33:02 +03:00
Nekotekina 4b1c052030 Fix crash on exit after access violation 2018-03-11 19:33:02 +03:00
Nekotekina 76be7d40ac Remove PSP2 2018-02-09 15:24:46 +03:00
kd-11 ab17b49e15 scheduler stuff
- more threads for rsx
- better 1600
2018-01-22 11:43:35 +03:00
kd-11 cbc8bf01a1 cell/scheduler: Manage thread placement depending on cpu hardware 2018-01-19 12:03:57 +03:00
Zion Nimchuk b9b06143d2 Silence some warnings in some files in Utilities 2017-11-30 18:07:19 +03:00
Nekotekina 7d3a528871 Use Qt for error reports 2017-11-23 20:36:21 +03:00
Jan Beich dd5791a2cc Fixes from FreeBSD package (#3765)
* Thread: unbreak on BSDs after dbc9bdfe02

Utilities/Thread.cpp:1920:2: error: unknown type name 'cpu_set_t'; did you mean 'cpusetid_t'?
        cpu_set_t cs;
        ^~~~~~~~~
        cpusetid_t
/usr/include/sys/types.h:84:22: note: 'cpusetid_t' declared here
typedef __cpusetid_t    cpusetid_t;
                        ^
Utilities/Thread.cpp:1921:2: error: use of undeclared identifier 'CPU_ZERO'
        CPU_ZERO(&cs);
        ^
Utilities/Thread.cpp:1922:2: error: use of undeclared identifier 'CPU_SET'
        CPU_SET(core, &cs);
        ^
Utilities/Thread.cpp:1923:48: error: unknown type name 'cpu_set_t'; did you mean 'cpusetid_t'?
        pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cs);
                                                      ^~~~~~~~~
                                                      cpusetid_t

* JIT: use MAP_32BIT on Linux and FreeBSD

Unless RLIMIT_DATA is low enough FreeBSD by default reserves lower 2Gb
for brk(2) style heap, ignoring mmap(2) address hint requested by RPCS3.
Passing MAP_32BIT fixes the following crash

Assertion failed: ((Type == ELF::R_X86_64_32 && (Value <= UINT32_MAX)) || (Type == ELF::R_X86_64_32S && ((int64_t)Value <= INT32_MAX && (int64_t)Value >= INT32_MIN))), function resolveX86_64Relocation, file /usr/ports/devel/llvm40/work/llvm-4.0.1.src/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp, line 287.

* build: unbreak -DVULKAN_PREBUILT with system glslang on Unix

rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp:4:10: fatal error: '../../../../Vulkan/glslang/SPIRV/GlslangToSpv.h' file not found
 #include "../../../../Vulkan/glslang/SPIRV/GlslangToSpv.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

rpcs3/CMakeFiles/rpcs3.dir/Emu/RSX/VK/VKCommonDecompiler.cpp.o: In function `vk::compile_glsl_to_spv(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, glsl::program_domain, std::__1::vector<unsigned int, std::__1::allocator<unsigned int> >&)':
rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp:(.text+0x50e): undefined reference to `glslang::TProgram::TProgram()'
rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp:(.text+0x51d): undefined reference to `glslang::TShader::TShader(EShLanguage)'
rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp:(.text+0x542): undefined reference to `glslang::TShader::setStrings(char const* const*, int)'
rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp:(.text+0x581): undefined reference to `glslang::TShader::parse(TBuiltInResource const*, int, EProfile, bool, bool, EShMessages, glslang::TShader::Includer&)'
rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp:(.text+0x5d6): undefined reference to `glslang::TProgram::link(EShMessages)'
rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp:(.text+0x5f1): undefined reference to `glslang::GlslangToSpv(glslang::TIntermediate const&, std::__1::vector<unsigned int, std::__1::allocator<unsigned int> >&, glslang::SpvOptions*)'
rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp:(.text+0x5ff): undefined reference to `glslang::TShader::getInfoLog()'
rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp:(.text+0x61a): undefined reference to `glslang::TShader::getInfoDebugLog()'
rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp:(.text+0x630): undefined reference to `glslang::TShader::~TShader()'
rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp:(.text+0x63c): undefined reference to `glslang::TProgram::~TProgram()'
rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp:(.text+0x6d2): undefined reference to `glslang::TShader::~TShader()'
rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp:(.text+0x6de): undefined reference to `glslang::TProgram::~TProgram()'
rpcs3/CMakeFiles/rpcs3.dir/Emu/RSX/VK/VKCommonDecompiler.cpp.o: In function `vk::initialize_compiler_context()':
rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp:(.text+0x6f5): undefined reference to `glslang::InitializeProcess()'
rpcs3/CMakeFiles/rpcs3.dir/Emu/RSX/VK/VKCommonDecompiler.cpp.o: In function `vk::finalize_compiler_context()':
rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp:(.text+0x856): undefined reference to `glslang::FinalizeProcess()'

* build/msvc: add missing glslang include directory after 6bb3f1b4d7

"c:\projects\rpcs3\rpcs3\VKGSRender.vcxproj" (default target) (15) ->
(ClCompile target) ->
  Emu\RSX\VK\VKCommonDecompiler.cpp(4): fatal error C1083: Cannot open include file: 'SPIRV/GlslangToSpv.h': No such file or directory [c:\projects\rpcs3\rpcs3\VKGSRender.vcxproj]
2017-11-21 01:56:25 +04:00
scribam 222c0e0fc5 Fix set thread affinity on OS X (#3757) 2017-11-20 02:02:35 +04:00
Nekotekina c58738807e Fix cond_variable timeout
Thanks @Farseer2 for debugging
2017-11-18 10:24:17 +03:00
Nekotekina dbc9bdfe02 Implement set_ideal_processor_core (linux) 2017-11-15 21:00:02 +03:00
Nekotekina 59cd0a9c7f Implement set_native_priority (posix) 2017-11-01 05:07:12 +03:00
Robbie 47b121a700 PPU Page Faults (#3309)
I guess I'll merge it and fix some issues later myself.
2017-10-08 23:37:54 +03:00
Nekotekina 837c5dddee Add <typeinfo> 2017-09-19 15:07:07 +03:00
Nekotekina 174f11bdbd Fix access violation handler 2017-09-01 01:22:48 +03:00
Nekotekina 14a6269243 Fix fatal error dialog 2017-08-31 05:21:26 +03:00
Nekotekina 9dc9378bcc Fix illegal instruction message 2017-07-23 11:03:38 +03:00
Nekotekina 6561ddae41 PPU LLVM: multithread compilation 2017-06-24 19:12:19 +03:00
Jan Beich 392d91b604 Improve portability for BSDs (#2813)
* sys_net: don't use fds_bits from a system header on FreeBSD

rpcs3/Emu/Cell/Modules/sys_net.cpp:137:14: error: no member named '__fds_bits' in
      'sys_net::fd_set'; did you mean 'fds_bits'?
                                if (src->fds_bits[i] & (1 << bit))
                                         ^~~~~~~~
                                         fds_bits
/usr/include/sys/select.h:75:18: note: expanded from macro 'fds_bits'
#define fds_bits        __fds_bits
                        ^
rpcs3/Emu/Cell/Modules/sys_net.h:114:13: note: 'fds_bits' declared here
                be_t<u32> fds_bits[32];
                          ^

* GUI: fallback to xdg-open on other Unices

rpcs3/Gui/GameViewer.cpp:289:26: error: use of undeclared identifier 'command'
        wxExecute(fmt::FromUTF8(command));
                                ^

* File: FreeBSD never supported copyfile(3) but sendfile(2) works fine

Utilities/File.cpp:114:10: fatal error: 'copyfile.h' file not found
#include <copyfile.h>
         ^~~~~~~~~~~~

* Thread: add signal handling for BSDs

Utilities/Thread.cpp:761:23: error: use of undeclared identifier 'REG_RAX'
static const decltype(REG_RAX) reg_table[] =
                      ^
Utilities/Thread.cpp:763:2: error: use of undeclared identifier 'REG_RAX'
        REG_RAX, REG_RCX, REG_RDX, REG_RBX, REG_RSP, REG_RBP, REG_RSI, REG_RDI,
        ^
Utilities/Thread.cpp:763:11: error: use of undeclared identifier 'REG_RCX'
        REG_RAX, REG_RCX, REG_RDX, REG_RBX, REG_RSP, REG_RBP, REG_RSI, REG_RDI,
                 ^
Utilities/Thread.cpp:763:20: error: use of undeclared identifier 'REG_RDX'
        REG_RAX, REG_RCX, REG_RDX, REG_RBX, REG_RSP, REG_RBP, REG_RSI, REG_RDI,
                          ^
Utilities/Thread.cpp:763:29: error: use of undeclared identifier 'REG_RBX'
        REG_RAX, REG_RCX, REG_RDX, REG_RBX, REG_RSP, REG_RBP, REG_RSI, REG_RDI,
                                   ^
Utilities/Thread.cpp:763:38: error: use of undeclared identifier 'REG_RSP'
        REG_RAX, REG_RCX, REG_RDX, REG_RBX, REG_RSP, REG_RBP, REG_RSI, REG_RDI,
                                            ^
Utilities/Thread.cpp:763:47: error: use of undeclared identifier 'REG_RBP'
        REG_RAX, REG_RCX, REG_RDX, REG_RBX, REG_RSP, REG_RBP, REG_RSI, REG_RDI,
                                                     ^
Utilities/Thread.cpp:763:56: error: use of undeclared identifier 'REG_RSI'
        REG_RAX, REG_RCX, REG_RDX, REG_RBX, REG_RSP, REG_RBP, REG_RSI, REG_RDI,
                                                              ^
Utilities/Thread.cpp:763:65: error: use of undeclared identifier 'REG_RDI'
        REG_RAX, REG_RCX, REG_RDX, REG_RBX, REG_RSP, REG_RBP, REG_RSI, REG_RDI,
                                                                       ^
Utilities/Thread.cpp:764:2: error: use of undeclared identifier 'REG_R8'
        REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RIP
        ^
Utilities/Thread.cpp:764:10: error: use of undeclared identifier 'REG_R9'
        REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RIP
                ^
Utilities/Thread.cpp:764:18: error: use of undeclared identifier 'REG_R10'
        REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RIP
                        ^
Utilities/Thread.cpp:764:27: error: use of undeclared identifier 'REG_R11'
        REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RIP
                                 ^
Utilities/Thread.cpp:764:36: error: use of undeclared identifier 'REG_R12'
        REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RIP
                                          ^
Utilities/Thread.cpp:764:45: error: use of undeclared identifier 'REG_R13'
        REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RIP
                                                   ^
Utilities/Thread.cpp:764:54: error: use of undeclared identifier 'REG_R14'
        REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RIP
                                                            ^
Utilities/Thread.cpp:764:63: error: use of undeclared identifier 'REG_R15'
        REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RIP
                                                                     ^
Utilities/Thread.cpp:764:72: error: use of undeclared identifier 'REG_RIP'
        REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RIP
                                                                              ^
Utilities/Thread.cpp:792:26: error: no member named 'gregs' in '__mcontext'
                const u64 reg_value = *X64REG(context, reg - X64R_RAX);
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG'
#define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]])
                               ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:804:21: error: no member named 'gregs' in '__mcontext'
                out_value = (u8)(*X64REG(context, reg - X64R_AL));
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG'
#define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]])
                               ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:809:21: error: no member named 'gregs' in '__mcontext'
                out_value = (u8)(*X64REG(context, reg - X64R_AH) >> 8);
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG'
#define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]])
                               ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:815:31: error: no member named 'gregs' in '__mcontext'
                const s8 imm_value = *(s8*)(RIP(context) + i_size - 1);
                                            ^~~~~~~~~~~~
Utilities/Thread.cpp:784:18: note: expanded from macro 'RIP'
#define RIP(c) (*X64REG((c), 16))
                 ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG'
#define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]])
                               ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:827:33: error: no member named 'gregs' in '__mcontext'
                const s16 imm_value = *(s16*)(RIP(context) + i_size - 2);
                                              ^~~~~~~~~~~~
Utilities/Thread.cpp:784:18: note: expanded from macro 'RIP'
#define RIP(c) (*X64REG((c), 16))
                 ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG'
#define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]])
                               ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:836:33: error: no member named 'gregs' in '__mcontext'
                const s32 imm_value = *(s32*)(RIP(context) + i_size - 4);
                                              ^~~~~~~~~~~~
Utilities/Thread.cpp:784:18: note: expanded from macro 'RIP'
#define RIP(c) (*X64REG((c), 16))
                 ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG'
#define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]])
                               ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:846:20: error: no member named 'gregs' in '__mcontext'
                out_value = (u32)RCX(context);
                                 ^~~~~~~~~~~~
Utilities/Thread.cpp:779:18: note: expanded from macro 'RCX'
#define RCX(c) (*X64REG((c), 1))
                 ^~~~~~~~~~~~~~
Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG'
#define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]])
                               ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:851:19: error: no member named 'gregs' in '__mcontext'
                const u32 _cf = EFLAGS(context) & 0x1;
                                ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                         ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:851:19: error: use of undeclared identifier 'REG_EFL'
Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                                                      ^
Utilities/Thread.cpp:852:19: error: no member named 'gregs' in '__mcontext'
                const u32 _zf = EFLAGS(context) & 0x40;
                                ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                         ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:852:19: error: use of undeclared identifier 'REG_EFL'
Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                                                      ^
Utilities/Thread.cpp:853:19: error: no member named 'gregs' in '__mcontext'
                const u32 _sf = EFLAGS(context) & 0x80;
                                ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                         ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:853:19: error: use of undeclared identifier 'REG_EFL'
Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                                                      ^
Utilities/Thread.cpp:854:19: error: no member named 'gregs' in '__mcontext'
                const u32 _of = EFLAGS(context) & 0x800;
                                ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                         ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:854:19: error: use of undeclared identifier 'REG_EFL'
Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                                                      ^
Utilities/Thread.cpp:855:19: error: no member named 'gregs' in '__mcontext'
                const u32 _pf = EFLAGS(context) & 0x4;
                                ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                         ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:855:19: error: use of undeclared identifier 'REG_EFL'
Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                                                      ^
Utilities/Thread.cpp:885:12: error: no member named 'gregs' in '__mcontext'
                case 1: *X64REG(context, reg - X64R_RAX) = value & 0xff | *X64REG(context, re...
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG'
#define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]])
                               ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:885:62: error: no member named 'gregs' in '__mcontext'
  ...*X64REG(context, reg - X64R_RAX) = value & 0xff | *X64REG(context, reg - X64R_RAX) & 0xffffff...
                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG'
#define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]])
                               ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:886:12: error: no member named 'gregs' in '__mcontext'
                case 2: *X64REG(context, reg - X64R_RAX) = value & 0xffff | *X64REG(context, ...
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG'
#define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]])
                               ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:886:64: error: no member named 'gregs' in '__mcontext'
  ...reg - X64R_RAX) = value & 0xffff | *X64REG(context, reg - X64R_RAX) & 0xffff0000; return true;
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG'
#define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]])
                               ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:887:12: error: no member named 'gregs' in '__mcontext'
                case 4: *X64REG(context, reg - X64R_RAX) = value & 0xffffffff; return true;
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG'
#define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]])
                               ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:888:12: error: no member named 'gregs' in '__mcontext'
                case 8: *X64REG(context, reg - X64R_RAX) = value; return true;
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG'
#define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]])
                               ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:913:3: error: no member named 'gregs' in '__mcontext'
                EFLAGS(context) |= 0x1; // set CF
                ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                         ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:913:3: error: use of undeclared identifier 'REG_EFL'
Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                                                      ^
Utilities/Thread.cpp:917:3: error: no member named 'gregs' in '__mcontext'
                EFLAGS(context) &= ~0x1; // clear CF
                ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                         ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:917:3: error: use of undeclared identifier 'REG_EFL'
Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                                                      ^
Utilities/Thread.cpp:922:3: error: no member named 'gregs' in '__mcontext'
                EFLAGS(context) |= 0x40; // set ZF
                ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                         ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:922:3: error: use of undeclared identifier 'REG_EFL'
Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                                                      ^
Utilities/Thread.cpp:926:3: error: no member named 'gregs' in '__mcontext'
                EFLAGS(context) &= ~0x40; // clear ZF
                ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                         ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:926:3: error: use of undeclared identifier 'REG_EFL'
Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                                                      ^
Utilities/Thread.cpp:931:3: error: no member named 'gregs' in '__mcontext'
                EFLAGS(context) |= 0x80; // set SF
                ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                         ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:931:3: error: use of undeclared identifier 'REG_EFL'
Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                                                      ^
Utilities/Thread.cpp:935:3: error: no member named 'gregs' in '__mcontext'
                EFLAGS(context) &= ~0x80; // clear SF
                ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                         ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:935:3: error: use of undeclared identifier 'REG_EFL'
Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                                                      ^
Utilities/Thread.cpp:940:3: error: no member named 'gregs' in '__mcontext'
                EFLAGS(context) |= 0x800; // set OF
                ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                         ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:940:3: error: use of undeclared identifier 'REG_EFL'
Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                                                      ^
Utilities/Thread.cpp:944:3: error: no member named 'gregs' in '__mcontext'
                EFLAGS(context) &= ~0x800; // clear OF
                ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                         ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:944:3: error: use of undeclared identifier 'REG_EFL'
Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                                                      ^
Utilities/Thread.cpp:953:3: error: no member named 'gregs' in '__mcontext'
                EFLAGS(context) |= 0x4; // set PF
                ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                         ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:953:3: error: use of undeclared identifier 'REG_EFL'
Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                                                      ^
Utilities/Thread.cpp:957:3: error: no member named 'gregs' in '__mcontext'
                EFLAGS(context) &= ~0x4; // clear PF
                ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                         ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:957:3: error: use of undeclared identifier 'REG_EFL'
Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                                                      ^
Utilities/Thread.cpp:962:3: error: no member named 'gregs' in '__mcontext'
                EFLAGS(context) |= 0x10; // set AF
                ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                         ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:962:3: error: use of undeclared identifier 'REG_EFL'
Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                                                      ^
Utilities/Thread.cpp:966:3: error: no member named 'gregs' in '__mcontext'
                EFLAGS(context) &= ~0x10; // clear AF
                ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                         ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:966:3: error: use of undeclared identifier 'REG_EFL'
Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                                                      ^
Utilities/Thread.cpp:976:7: error: no member named 'gregs' in '__mcontext'
                if (EFLAGS(context) & 0x400 /* direction flag */)
                    ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                         ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:976:7: error: use of undeclared identifier 'REG_EFL'
Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS'
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
                                                      ^
Utilities/Thread.cpp:1020:25: error: no member named 'gregs' in '__mcontext'
        auto code = (const u8*)RIP(context);
                               ^~~~~~~~~~~~
Utilities/Thread.cpp:784:18: note: expanded from macro 'RIP'
#define RIP(c) (*X64REG((c), 16))
                 ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG'
#define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]])
                               ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:1146:3: error: no member named 'gregs' in '__mcontext'
                RIP(context) += i_size;
                ^~~~~~~~~~~~
Utilities/Thread.cpp:784:18: note: expanded from macro 'RIP'
#define RIP(c) (*X64REG((c), 16))
                 ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG'
#define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]])
                               ~~~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:1368:47: error: no member named 'gregs' in '__mcontext'
        const bool is_writing = context->uc_mcontext.gregs[REG_ERR] & 0x2;
                                ~~~~~~~~~~~~~~~~~~~~ ^
Utilities/Thread.cpp:1368:53: error: use of undeclared identifier 'REG_ERR'
        const bool is_writing = context->uc_mcontext.gregs[REG_ERR] & 0x2;
                                                           ^
Utilities/Thread.cpp:1393:89: error: no member named 'gregs' in '__mcontext'
  ...%s location %p at %p.", cause, info->si_addr, RIP(context)));
                                                   ^~~~~~~~~~~~
Utilities/Thread.cpp:784:18: note: expanded from macro 'RIP'
#define RIP(c) (*X64REG((c), 16))
                 ^~~~~~~~~~~~~~~
Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG'
#define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]])
                               ~~~~~~~~~~~~~~~~~~~~~~ ^

* Thread: add explict casts for incomplete pthread_t on some platforms

Utilities/Thread.cpp:1467:17: error: no viable overloaded '='
        ctrl->m_thread = thread;
        ~~~~~~~~~~~~~~ ^ ~~~~~~
Utilities/Atomic.h:776:12: note: candidate function not viable: cannot convert argument of
      incomplete type 'pthread_t' (aka 'pthread *') to 'const atomic_t<unsigned long>' for 1st
      argument
        atomic_t& operator =(const atomic_t&) = delete;
                  ^
Utilities/Atomic.h:902:7: note: candidate function not viable: cannot convert argument of
      incomplete type 'pthread_t' (aka 'pthread *') to 'const type' (aka 'const unsigned long') for
      1st argument
        type operator =(const type& rhs)
             ^
Utilities/Thread.cpp:1656:3: error: no matching function for call to 'pthread_detach'
                pthread_detach(m_thread.raw());
                ^~~~~~~~~~~~~~
/usr/include/pthread.h:218:6: note: candidate function not viable: no known conversion from 'type'
      (aka 'unsigned long') to 'pthread_t' (aka 'pthread *') for 1st argument
int             pthread_detach(pthread_t);
                ^

* build: dlopen() maybe in libc

/usr/bin/ld: cannot find -ldl
c++: error: linker command failed with exit code 1 (use -v to see invocation)

* build: iconv() maybe available on some BSDs in libc

/usr/bin/ld: cannot find -liconv
c++: error: linker command failed with exit code 1 (use -v to see invocation)

* build: hidapi-hidraw is only built on Linux

/usr/bin/ld: cannot find -lhidapi-hidraw
c++: error: linker command failed with exit code 1 (use -v to see invocation)

* Thread: use getrusage() on more POSIX-like systems

* Qt: don't return NULL handle on other platforms

rpcs3/rpcs3qt/gs_frame.cpp:120:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^

* build: properly disable Vulkan on other platforms

In file included from rpcs3/rpcs3_app.cpp:40:
In file included from rpcs3/Emu/RSX/VK/VKGSRender.h:3:
rpcs3/Emu/RSX/VK/VKHelpers.h:1209:42: error: unknown type name 'device_queues'
                        std::vector<VkBool32> supportsPresent(device_queues);
                                                              ^
rpcs3/Emu/RSX/VK/VKHelpers.h:1211:4: error: expected member name or ';' after declaration specifiers
                        for (u32 index = 0; index < device_queues; index++)
                        ^
rpcs3/Emu/RSX/VK/VKHelpers.h:1221:4: error: expected member name or ';' after declaration specifiers
                        for (u32 i = 0; i < device_queues; i++)
                        ^
rpcs3/Emu/RSX/VK/VKHelpers.h:1256:4: error: expected member name or ';' after declaration specifiers
                        if (graphicsQueueNodeIndex != presentQueueNodeIndex)
                        ^
rpcs3/Emu/RSX/VK/VKHelpers.h:1261:4: error: expected member name or ';' after declaration specifiers
                        CHECK_RESULT(vkGetPhysicalDeviceSurfaceFormatsKHR(dev, surface, &formatCount, nullptr));
                        ^
[...]
/usr/bin/ld: cannot find -lvulkan
c++: error: linker command failed with exit code 1 (use -v to see invocation)

* build: make install/strip work by moving commands

* Qt: create surface for GL context if it wasn't ready

  #0  strlen (str=0x0) at /usr/src/lib/libc/string/strlen.c:100
  #1  0x000000000090f02e in std::__1::char_traits<char>::length (__s=0x0)
      at /usr/include/c++/v1/__string:215
  #2  std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string (__s=0x0, this=<optimized out>) at /usr/include/c++/v1/string:1547
  #3  gl::capabilities::initialize (this=0x2ba32a0 <gl::g_driver_caps>)
      at rpcs3/Emu/RSX/GL/GLHelpers.h:133
  #4  0x000000000090d3dd in gl::get_driver_caps () at rpcs3/Emu/RSX/GL/GLHelpers.cpp:56
  #5  0x00000000008fa511 in GLGSRender::on_init_thread (this=0x838d30018)
      at rpcs3/Emu/RSX/GL/GLGSRender.cpp:484
  #6  0x0000000000938f9e in rsx:🧵:on_task (this=0x838d30018)
      at rpcs3/Emu/RSX/RSXThread.cpp:334
  #7  0x0000000000abc329 in task_stack::task_type<named_thread::start_thread(std::__1::shared_ptr<void> const&)::$_10>::invoke() ()
  #8  0x0000000000abc114 in thread_ctrl::start(std::__1::shared_ptr<thread_ctrl> const&, task_stack)::$_7::__invoke(void*) ()
  #9  0x0000000801e60c35 in thread_start (curthread=0x843650a00)
      at /usr/src/lib/libthr/thread/thr_create.c:289
  #10 0x0000000000000000 in ?? ()

* build: don't abort without git metadata

-- Found Git: /usr/local/bin/git (found version "2.13.1")
fatal: Not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
CMake Warning at git-version.cmake:12 (message):
  git rev-list failed, unable to include version.

* build: non-parallel needs git-version.h earlier

rpcs3/rpcs3_version.cpp:3:10: fatal error: 'git-version.h' file not found
 #include "git-version.h"
          ^~~~~~~~~~~~~~~
1 error generated.
2017-06-22 21:03:41 +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 37a97a71e3 vm::g_exec_addr added
s_ppu_compiled renamed
Exception handling enabled
2017-03-27 01:15:41 +03:00
Nekotekina e4d1bdef07 Fix check_addr arg 2017-03-27 01:15:41 +03:00
Nekotekina 1ede0f4706 Minor optimization 2017-03-13 15:02:18 +03:00
Nekotekina c72a5a5775 thread_ctrl::finalize crash fix 2017-03-13 13:16:22 +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 436c245d13 Remove unused code 2017-02-13 18:33:31 +03:00
Nekotekina 257b9a2015 Debugger fix
Crash fixes
GUI fixes
Debug enhancements
2017-02-10 16:33:22 +03:00
Nekotekina b7a7a5c582 #2314 fix 2017-01-31 20:37:02 +03:00
Nekotekina aef5113d49 Fix #2300 2017-01-29 22:52:07 +03:00
Nekotekina a5a2d43d7c Thread.cpp refinement
Hide thread mutex
Safe notify() method
Other refactoring
2017-01-29 19:52:19 +03:00
Nekotekina 1c14d872a8 New shared_mutex
Experimental sync utils
New semaphore<>
New cond_variable
New owned_mutex
2017-01-25 00:38:07 +03:00
Nekotekina 7a356d3294 is_leaf_function fix (Linux) 2017-01-22 18:50:55 +03:00
Nekotekina dbcb5df172 WRAP_EXPR macro removed 2016-08-15 17:11:45 +03:00
Nekotekina dafb6b5c92 %p fmt fix 2016-08-15 16:57:51 +03:00
Nekotekina 05fb57baff VERIFY macro removed 2016-08-15 03:13:31 +03:00
Nekotekina 1f3433464c ENSURES usage removed 2016-08-14 22:41:01 +03:00
Nekotekina 130f7905ba Error report fix 2016-08-10 14:17:07 +03:00
Nekotekina 1a7ea2d235 fmt_unveil<> fix 2016-08-07 17:05:35 +03:00
Nekotekina 9245308ff2 Improve fatal error report 2016-08-06 15:09:44 +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 7ccdea7822 Removed std::enable_shared_from_this
Minor ID manager refactoring
2016-07-24 21:06:05 +03:00
Nekotekina a186af32ec Fixed thread interrupt and accvio 2016-07-18 17:54:31 +03:00
Nekotekina 59433bfcd5 Implemented thread_ctrl::interrupt 2016-07-17 02:23:45 +03:00
Nekotekina 96728a83f6 Partial commit: sys_memory, sys_mmapper 2016-07-16 14:46:01 +03:00
Ivan 77594dc66c PPU LLVM: New analyser (#1858)
Minor fixes
VEX prefix support
2016-07-07 21:42:39 +03:00
Nekotekina 9db7de29fb Syscall analysis implemented 2016-06-27 16:43:56 +03:00
Nekotekina 63e690ca11 CMP, TEST instruction support 2016-06-27 16:43:54 +03:00
Nekotekina a8bebcba55 LLVM AOT 2016-06-19 21:29:48 +03:00
Nekotekina 266db1336d The rest 2016-05-23 16:22:25 +03:00
Ivan aafcf44581 Header optimizations (#1684)
Shouldn't break anything. I hope.
2016-04-27 01:27:24 +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
Nekotekina 250ce63527 Partial commit: Utilities 2016-04-15 19:22:20 +03:00
Raul Tambre 5cbcd07ff1 Improve generalized exception messages
Added some basic information along with certain exceptions. This should
prevent some types of useless reports and assist users in determining
certain issues with their setup.
2016-02-25 07:58:22 +02:00
DHrpcs3 685d5d3ea3 Access violation handled by rsx::thread
gfxHandler -> rsx::g_access_violation_handler
2016-01-20 15:46:58 +03:00
Nekotekina 38531459df Logging system rewritten
GUI doesn't freeze anymore
Some things simplified
2016-01-13 18:54:57 +03:00
Nekotekina b3e3c68f15 File utility improved
+ minor fixes
2016-01-13 14:12:04 +03:00
Nekotekina a666318b95 Error messages improved 2015-12-20 15:41:09 +03:00
Nekotekina 56ba5a765b Exception handling fix 2015-12-20 15:41:05 +03:00
Nekotekina 8e4ad3dfcb Property sheets, configuration simplified
MemLeak build fixed
2015-12-08 20:02:30 +03:00
Nekotekina 8a1ce6ba64 MINGW64 fix 2015-12-04 23:37:35 +03:00
Nekotekina ca6783ba9a Threads improved, ID manager improved 2015-12-04 23:37:34 +03:00
O1L c0255208cc Old ini-manager only partially used in VFS. Global configuration used as defualt. 2015-10-27 01:09:31 +04: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 e551e2bc5d Bugfix 2015-08-24 21:22:49 +03:00
Nekotekina 5e14310071 noexcept usage fixed
thread_t renamed to named_thread_t
2015-08-24 21:22:48 +03:00
Nekotekina d9403c2ed2 thread_t cleanup 2015-08-24 21:22:37 +03:00
Nekotekina 6f3c50eba2 u128 renamed to v128
Since it's vector union type
2015-08-24 21:22:23 +03:00
Danila Malyutin 009370f73c Fix some compiling problems on OSX
and enable osx builds on travis
2015-08-24 00:20:01 +03:00
Nekotekina badeb29901 Minor fixes 2015-08-01 14:39:10 +03:00
Nekotekina 16b7d204d2 decode_x64_reg_op: MOVUPS support 2015-08-01 14:38:59 +03:00
Nekotekina 2f7fe35f5c Minor style change 2015-07-21 23:14:31 +03:00
Nekotekina 1e021cdbba waiter_map reintroduced, combined with vm 2015-07-21 23:14:20 +03:00
Nekotekina 4bacfcf847 sys_lv2dbg added, bugfix 2015-07-10 04:31:41 +03:00
Nekotekina 82781e620a Small fixes 2015-07-10 04:31:36 +03:00
Nekotekina c0f13f7084 sleep_queue_t rewritten, used in sys_cond/sys_mutex
Some synchronization fixes
2015-07-10 04:31:34 +03:00
Nekotekina eafddd9e33 CPUThread fixes, thread_t cleanup 2015-07-10 04:31:32 +03:00
Nekotekina 22e1da5e76 Minor cleanup 2015-07-10 04:31:29 +03:00
Nekotekina 3064cf8101 CHECK_EMU_STATUS, autojoin_thread_t 2015-07-10 04:31:27 +03:00
Nekotekina 8f9e1100c8 SPU fixes, various fixes 2015-07-10 04:31:25 +03:00
Nekotekina 8c00dcd02d Bugfix 2015-07-10 04:31:21 +03:00
Nekotekina 32d3d1fbe5 EXCEPTION() macro usage, sceNpTrophy improved 2015-07-10 04:31:20 +03:00
Nekotekina 6f1e76198a Some fixes 2015-07-10 04:31:18 +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 39f836b495 re32/se32/... macro eliminated, some fixes 2015-07-10 04:31:09 +03:00
Nekotekina ef6f9f6ded be_t constructor implemented, make() eliminated
be_t enums are forbidden, le_t improved, some operators cleaned.
2015-07-10 04:31:07 +03:00
Nekotekina 6c4148a949 Bugfix 2015-07-10 04:30:47 +03:00
Nekotekina bc9481db1b PSV modules refactoring 2015-07-10 04:30:45 +03:00
Nekotekina edb9595721 Using vm::ps3 namespace moved in proper places
Various fixes
2015-07-10 04:30:41 +03:00
vlj 4a7f6af8d9 Memory: Add a callback allowing customisation of handle_access_violation. 2015-07-02 19:05:27 +02:00
Nekotekina 22b78fec71 IdManager improved, atomic_t improved
Various changes
2015-05-27 06:11:59 +03:00
Nekotekina 4a6ef91eb3 More cleanup 2015-03-07 19:03:42 +03:00
Nekotekina ef65299dff Lv2 Cond/Mutex rewritten, bugfixes 2015-03-07 01:10:04 +03:00
Nekotekina 9e49a33b3c SPU syscall improvements 2015-03-05 00:51:14 +03:00
Nekotekina 8587ae5883 Compilation fix 2015-03-03 02:34:49 +03:00
Nekotekina 619b8e473f Possibly fix for OSX 2015-02-28 22:37:31 +03:00
Nekotekina 942d984dc5 sys_process_get_paramsfo implemented 2015-02-28 17:41:15 +03:00
Nekotekina 655acc746d HLE function binding for PPU/ARMv7 simplified 2015-02-20 16:58:40 +03:00
Nekotekina 7ab1e64aab Merge branch 'master' of https://github.com/DHrpcs3/rpcs3 2015-02-20 14:38:57 +03:00
Nekotekina f9eb3f8476 get_x64_reg_value fix 2015-02-19 23:38:25 +03:00
S Gopal Rajagopal 1356a17e84 Merge upstream 2015-02-20 01:57:46 +05:30
S Gopal Rajagopal 68978a0109 SPURS: More fixes 2015-02-20 01:53:05 +05:30
Nekotekina 2d1d996c50 Small fix 2015-02-19 14:18:28 +03:00
Nekotekina af986d8f4c Loader improved, ModuleManager refactored 2015-02-18 19:22:06 +03:00
Nekotekina 1f2eafc4f2 Loader fixed 2015-02-17 18:27:15 +03:00
Nekotekina 3f3873ceb5 STOS support (for memset) 2015-02-17 05:01:47 +03:00
Nekotekina bddad4d766 Compilation fix 2015-02-17 03:40:10 +03:00
Nekotekina 20dce26b1d Reservations improved 2015-02-17 03:08:23 +03:00
Nekotekina e6c628caba Memory (unfinished) 2015-02-16 04:53:53 +03:00
Nekotekina 1189503b4d Some cleanup 2015-02-15 20:13:06 +03:00
Nekotekina 6909a15400 decode_x64_reg_op improved 2015-02-15 15:31:42 +03:00
Nekotekina f01059283a Some cleanup 2015-02-14 00:45:36 +03:00
Nekotekina 0d489518ab Compilation fix 2015-02-13 23:24:18 +03:00
Robert Xu 00e637645c Fix building on OS X 10.10 2015-02-10 23:17:39 -05:00
Nekotekina 31bbf56ff1 Reservations improved 2015-02-08 18:25:50 +03:00
Nekotekina 19acaf3f86 Bugfix, ECIWX/ECOWX disabled 2015-02-08 16:38:08 +03:00
Nekotekina 1af4848324 New reservations (not finished) 2015-02-07 02:39:51 +03:00
Nekotekina 0d28f378a7 fmt::format() optimization (fmt::unveil template) 2015-01-19 01:54:56 +03:00