2012-11-15 00:39:56 +01:00
|
|
|
#include "stdafx.h"
|
2016-02-01 22:55:43 +01:00
|
|
|
#include "Emu/Memory/Memory.h"
|
2015-01-04 22:46:31 +01:00
|
|
|
#include "Emu/System.h"
|
2016-02-01 22:55:43 +01:00
|
|
|
#include "Emu/IdManager.h"
|
2015-03-04 22:51:14 +01:00
|
|
|
#include "Emu/Cell/RawSPUThread.h"
|
2017-10-08 22:37:54 +02:00
|
|
|
#include "Emu/Cell/lv2/sys_mmapper.h"
|
|
|
|
#include "Emu/Cell/lv2/sys_event.h"
|
2012-11-15 00:39:56 +01:00
|
|
|
#include "Thread.h"
|
2017-10-21 13:21:37 +02:00
|
|
|
#include "sysinfo.h"
|
2017-09-16 19:36:53 +02:00
|
|
|
#include <typeinfo>
|
2017-10-21 13:21:37 +02:00
|
|
|
#include <thread>
|
2012-11-15 00:39:56 +01:00
|
|
|
|
2014-12-05 17:12:15 +01:00
|
|
|
#ifdef _WIN32
|
2016-08-06 14:09:44 +02:00
|
|
|
#include <Windows.h>
|
|
|
|
#include <Psapi.h>
|
2016-09-07 00:38:52 +02:00
|
|
|
#include <process.h>
|
2015-01-04 22:46:31 +01:00
|
|
|
#else
|
2015-02-13 22:45:36 +01:00
|
|
|
#ifdef __APPLE__
|
2015-02-11 05:17:39 +01:00
|
|
|
#define _XOPEN_SOURCE
|
|
|
|
#define __USE_GNU
|
2017-11-19 23:02:35 +01:00
|
|
|
#include <mach/thread_act.h>
|
|
|
|
#include <mach/thread_policy.h>
|
2015-02-13 22:45:36 +01:00
|
|
|
#endif
|
2018-03-12 21:13:49 +01:00
|
|
|
#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
Fixes from FreeBSD package (#3765)
* Thread: unbreak on BSDs after dbc9bdfe02ae
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 6bb3f1b4d75c
"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-20 22:56:25 +01:00
|
|
|
#include <pthread_np.h>
|
|
|
|
#define cpu_set_t cpuset_t
|
|
|
|
#endif
|
2016-05-25 20:04:08 +02:00
|
|
|
#include <errno.h>
|
2015-01-04 22:46:31 +01:00
|
|
|
#include <signal.h>
|
|
|
|
#include <ucontext.h>
|
2016-09-07 00:38:52 +02:00
|
|
|
#include <pthread.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/resource.h>
|
2014-12-05 17:12:15 +01:00
|
|
|
#endif
|
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
#include "sync.h"
|
|
|
|
|
2017-02-17 20:35:57 +01:00
|
|
|
thread_local u64 g_tls_fault_all = 0;
|
2016-09-07 00:38:52 +02:00
|
|
|
thread_local u64 g_tls_fault_rsx = 0;
|
|
|
|
thread_local u64 g_tls_fault_spu = 0;
|
|
|
|
|
2015-12-18 12:11:18 +01:00
|
|
|
[[noreturn]] void catch_all_exceptions()
|
|
|
|
{
|
|
|
|
try
|
2015-11-26 09:06:29 +01:00
|
|
|
{
|
2015-12-18 12:11:18 +01:00
|
|
|
throw;
|
|
|
|
}
|
2016-02-01 22:55:43 +01:00
|
|
|
catch (const std::exception& e)
|
2015-12-18 12:11:18 +01:00
|
|
|
{
|
2016-02-01 22:55:43 +01:00
|
|
|
report_fatal_error("Unhandled exception of type '"s + typeid(e).name() + "': "s + e.what());
|
2015-12-18 12:11:18 +01:00
|
|
|
}
|
|
|
|
catch (...)
|
|
|
|
{
|
|
|
|
report_fatal_error("Unhandled exception (unknown)");
|
2015-11-26 09:06:29 +01:00
|
|
|
}
|
2015-12-18 12:11:18 +01:00
|
|
|
}
|
2015-11-26 09:06:29 +01:00
|
|
|
|
2015-01-04 22:46:31 +01:00
|
|
|
enum x64_reg_t : u32
|
|
|
|
{
|
2015-02-17 01:08:23 +01:00
|
|
|
X64R_RAX = 0,
|
2015-02-15 13:31:42 +01:00
|
|
|
X64R_RCX,
|
|
|
|
X64R_RDX,
|
|
|
|
X64R_RBX,
|
|
|
|
X64R_RSP,
|
|
|
|
X64R_RBP,
|
|
|
|
X64R_RSI,
|
|
|
|
X64R_RDI,
|
|
|
|
X64R_R8,
|
|
|
|
X64R_R9,
|
|
|
|
X64R_R10,
|
|
|
|
X64R_R11,
|
|
|
|
X64R_R12,
|
|
|
|
X64R_R13,
|
|
|
|
X64R_R14,
|
|
|
|
X64R_R15,
|
|
|
|
|
2015-02-17 01:08:23 +01:00
|
|
|
X64R_XMM0 = 0,
|
2015-02-15 13:31:42 +01:00
|
|
|
X64R_XMM1,
|
|
|
|
X64R_XMM2,
|
|
|
|
X64R_XMM3,
|
|
|
|
X64R_XMM4,
|
|
|
|
X64R_XMM5,
|
|
|
|
X64R_XMM6,
|
|
|
|
X64R_XMM7,
|
|
|
|
X64R_XMM8,
|
|
|
|
X64R_XMM9,
|
|
|
|
X64R_XMM10,
|
|
|
|
X64R_XMM11,
|
|
|
|
X64R_XMM12,
|
|
|
|
X64R_XMM13,
|
|
|
|
X64R_XMM14,
|
|
|
|
X64R_XMM15,
|
2018-02-09 13:24:46 +01:00
|
|
|
|
2015-02-15 13:31:42 +01:00
|
|
|
X64R_AL,
|
|
|
|
X64R_CL,
|
|
|
|
X64R_DL,
|
|
|
|
X64R_BL,
|
|
|
|
X64R_AH,
|
|
|
|
X64R_CH,
|
|
|
|
X64R_DH,
|
|
|
|
X64R_BH,
|
2018-02-09 13:24:46 +01:00
|
|
|
|
2015-02-15 13:31:42 +01:00
|
|
|
X64_NOT_SET,
|
|
|
|
X64_IMM8,
|
|
|
|
X64_IMM16,
|
2015-01-04 22:46:31 +01:00
|
|
|
X64_IMM32,
|
2015-02-15 13:31:42 +01:00
|
|
|
|
2016-06-07 22:24:20 +02:00
|
|
|
X64_BIT_O = 0x90,
|
|
|
|
X64_BIT_NO,
|
|
|
|
X64_BIT_C,
|
|
|
|
X64_BIT_NC,
|
|
|
|
X64_BIT_Z,
|
|
|
|
X64_BIT_NZ,
|
|
|
|
X64_BIT_BE,
|
|
|
|
X64_BIT_NBE,
|
|
|
|
X64_BIT_S,
|
|
|
|
X64_BIT_NS,
|
|
|
|
X64_BIT_P,
|
|
|
|
X64_BIT_NP,
|
|
|
|
X64_BIT_L,
|
|
|
|
X64_BIT_NL,
|
|
|
|
X64_BIT_LE,
|
|
|
|
X64_BIT_NLE,
|
|
|
|
|
2015-02-15 13:31:42 +01:00
|
|
|
X64R_ECX = X64R_CL,
|
2015-01-04 22:46:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
enum x64_op_t : u32
|
|
|
|
{
|
2015-02-15 18:13:06 +01:00
|
|
|
X64OP_NONE,
|
2015-03-04 22:51:14 +01:00
|
|
|
X64OP_LOAD, // obtain and put the value into x64 register
|
2016-06-07 22:24:20 +02:00
|
|
|
X64OP_LOAD_BE,
|
2016-06-22 23:39:39 +02:00
|
|
|
X64OP_LOAD_CMP,
|
|
|
|
X64OP_LOAD_TEST,
|
2015-03-04 22:51:14 +01:00
|
|
|
X64OP_STORE, // take the value from x64 register or an immediate and use it
|
2016-06-07 22:24:20 +02:00
|
|
|
X64OP_STORE_BE,
|
2015-02-15 13:31:42 +01:00
|
|
|
X64OP_MOVS,
|
2015-02-17 03:01:47 +01:00
|
|
|
X64OP_STOS,
|
2015-02-15 13:31:42 +01:00
|
|
|
X64OP_XCHG,
|
|
|
|
X64OP_CMPXCHG,
|
2016-06-07 22:24:20 +02:00
|
|
|
X64OP_AND, // lock and [mem], ...
|
|
|
|
X64OP_OR, // lock or [mem], ...
|
|
|
|
X64OP_XOR, // lock xor [mem], ...
|
|
|
|
X64OP_INC, // lock inc [mem]
|
|
|
|
X64OP_DEC, // lock dec [mem]
|
|
|
|
X64OP_ADD, // lock add [mem], ...
|
|
|
|
X64OP_ADC, // lock adc [mem], ...
|
|
|
|
X64OP_SUB, // lock sub [mem], ...
|
|
|
|
X64OP_SBB, // lock sbb [mem], ...
|
2015-01-04 22:46:31 +01:00
|
|
|
};
|
|
|
|
|
2015-02-15 18:13:06 +01:00
|
|
|
void decode_x64_reg_op(const u8* code, x64_op_t& out_op, x64_reg_t& out_reg, size_t& out_size, size_t& out_length)
|
2015-01-04 22:46:31 +01:00
|
|
|
{
|
|
|
|
// simple analysis of x64 code allows to reinterpret MOV or other instructions in any desired way
|
2015-02-15 13:31:42 +01:00
|
|
|
out_length = 0;
|
|
|
|
|
|
|
|
u8 rex = 0, pg2 = 0;
|
2015-01-04 22:46:31 +01:00
|
|
|
|
2015-02-15 13:31:42 +01:00
|
|
|
bool oso = false, lock = false, repne = false, repe = false;
|
|
|
|
|
|
|
|
enum : u8
|
|
|
|
{
|
|
|
|
LOCK = 0xf0,
|
|
|
|
REPNE = 0xf2,
|
|
|
|
REPE = 0xf3,
|
|
|
|
};
|
2015-01-04 22:46:31 +01:00
|
|
|
|
|
|
|
// check prefixes:
|
2015-02-15 13:31:42 +01:00
|
|
|
for (;; code++, out_length++)
|
2015-01-04 22:46:31 +01:00
|
|
|
{
|
|
|
|
switch (const u8 prefix = *code)
|
|
|
|
{
|
2015-02-15 13:31:42 +01:00
|
|
|
case LOCK: // group 1
|
|
|
|
{
|
|
|
|
if (lock)
|
|
|
|
{
|
2015-02-17 01:08:23 +01:00
|
|
|
LOG_ERROR(MEMORY, "decode_x64_reg_op(%016llxh): LOCK prefix found twice", (size_t)code - out_length);
|
2015-02-15 13:31:42 +01:00
|
|
|
}
|
2018-02-09 13:24:46 +01:00
|
|
|
|
2015-02-15 13:31:42 +01:00
|
|
|
lock = true;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
case REPNE: // group 1
|
|
|
|
{
|
|
|
|
if (repne)
|
|
|
|
{
|
2015-02-17 01:08:23 +01:00
|
|
|
LOG_ERROR(MEMORY, "decode_x64_reg_op(%016llxh): REPNE/REPNZ prefix found twice", (size_t)code - out_length);
|
2015-02-15 13:31:42 +01:00
|
|
|
}
|
2018-02-09 13:24:46 +01:00
|
|
|
|
2015-02-15 13:31:42 +01:00
|
|
|
repne = true;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
case REPE: // group 1
|
|
|
|
{
|
|
|
|
if (repe)
|
|
|
|
{
|
2015-02-17 01:08:23 +01:00
|
|
|
LOG_ERROR(MEMORY, "decode_x64_reg_op(%016llxh): REP/REPE/REPZ prefix found twice", (size_t)code - out_length);
|
2015-02-15 13:31:42 +01:00
|
|
|
}
|
2018-02-09 13:24:46 +01:00
|
|
|
|
2015-02-15 13:31:42 +01:00
|
|
|
repe = true;
|
|
|
|
continue;
|
|
|
|
}
|
2015-01-04 22:46:31 +01:00
|
|
|
|
|
|
|
case 0x2e: // group 2
|
|
|
|
case 0x36:
|
|
|
|
case 0x3e:
|
|
|
|
case 0x26:
|
|
|
|
case 0x64:
|
|
|
|
case 0x65:
|
|
|
|
{
|
2015-02-15 13:31:42 +01:00
|
|
|
if (pg2)
|
2015-01-04 22:46:31 +01:00
|
|
|
{
|
2015-02-17 01:08:23 +01:00
|
|
|
LOG_ERROR(MEMORY, "decode_x64_reg_op(%016llxh): 0x%02x (group 2 prefix) found after 0x%02x", (size_t)code - out_length, prefix, pg2);
|
2015-01-04 22:46:31 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-02-15 13:31:42 +01:00
|
|
|
pg2 = prefix; // probably, segment register
|
2015-01-04 22:46:31 +01:00
|
|
|
}
|
2015-02-15 13:31:42 +01:00
|
|
|
continue;
|
2015-01-04 22:46:31 +01:00
|
|
|
}
|
|
|
|
|
2015-02-15 13:31:42 +01:00
|
|
|
case 0x66: // group 3
|
|
|
|
{
|
|
|
|
if (oso)
|
|
|
|
{
|
2015-02-17 01:08:23 +01:00
|
|
|
LOG_ERROR(MEMORY, "decode_x64_reg_op(%016llxh): operand-size override prefix found twice", (size_t)code - out_length);
|
2015-02-15 13:31:42 +01:00
|
|
|
}
|
2018-02-09 13:24:46 +01:00
|
|
|
|
2015-02-15 13:31:42 +01:00
|
|
|
oso = true;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 0x67: // group 4
|
|
|
|
{
|
2015-02-17 01:08:23 +01:00
|
|
|
LOG_ERROR(MEMORY, "decode_x64_reg_op(%016llxh): address-size override prefix found", (size_t)code - out_length, prefix);
|
2015-02-15 18:13:06 +01:00
|
|
|
out_op = X64OP_NONE;
|
2015-02-15 13:31:42 +01:00
|
|
|
out_reg = X64_NOT_SET;
|
|
|
|
out_size = 0;
|
|
|
|
out_length = 0;
|
|
|
|
return;
|
|
|
|
}
|
2015-01-04 22:46:31 +01:00
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
if ((prefix & 0xf0) == 0x40) // check REX prefix
|
|
|
|
{
|
|
|
|
if (rex)
|
|
|
|
{
|
2015-02-17 01:08:23 +01:00
|
|
|
LOG_ERROR(MEMORY, "decode_x64_reg_op(%016llxh): 0x%02x (REX prefix) found after 0x%02x", (size_t)code - out_length, prefix, rex);
|
2015-01-04 22:46:31 +01:00
|
|
|
}
|
2015-02-15 13:31:42 +01:00
|
|
|
else
|
2015-01-04 22:46:31 +01:00
|
|
|
{
|
2015-02-15 13:31:42 +01:00
|
|
|
rex = prefix;
|
2015-01-04 22:46:31 +01:00
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-02-15 13:31:42 +01:00
|
|
|
auto get_modRM_reg = [](const u8* code, const u8 rex) -> x64_reg_t
|
|
|
|
{
|
2015-02-15 18:13:06 +01:00
|
|
|
return (x64_reg_t)(((*code & 0x38) >> 3 | (/* check REX.R bit */ rex & 4 ? 8 : 0)) + X64R_RAX);
|
2015-02-15 13:31:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
auto get_modRM_reg_xmm = [](const u8* code, const u8 rex) -> x64_reg_t
|
|
|
|
{
|
2015-02-15 18:13:06 +01:00
|
|
|
return (x64_reg_t)(((*code & 0x38) >> 3 | (/* check REX.R bit */ rex & 4 ? 8 : 0)) + X64R_XMM0);
|
2015-02-15 13:31:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
auto get_modRM_reg_lh = [](const u8* code) -> x64_reg_t
|
2015-01-04 22:46:31 +01:00
|
|
|
{
|
2015-02-15 18:13:06 +01:00
|
|
|
return (x64_reg_t)(((*code & 0x38) >> 3) + X64R_AL);
|
2015-01-04 22:46:31 +01:00
|
|
|
};
|
|
|
|
|
2015-02-15 18:13:06 +01:00
|
|
|
auto get_op_size = [](const u8 rex, const bool oso) -> size_t
|
2015-02-15 13:31:42 +01:00
|
|
|
{
|
|
|
|
return rex & 8 ? 8 : (oso ? 2 : 4);
|
|
|
|
};
|
|
|
|
|
2015-02-15 18:13:06 +01:00
|
|
|
auto get_modRM_size = [](const u8* code) -> size_t
|
2015-01-04 22:46:31 +01:00
|
|
|
{
|
|
|
|
switch (*code >> 6) // check Mod
|
|
|
|
{
|
|
|
|
case 0: return (*code & 0x07) == 4 ? 2 : 1; // check SIB
|
|
|
|
case 1: return (*code & 0x07) == 4 ? 3 : 2; // check SIB (disp8)
|
|
|
|
case 2: return (*code & 0x07) == 4 ? 6 : 5; // check SIB (disp32)
|
|
|
|
default: return 1;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-02-15 13:31:42 +01:00
|
|
|
const u8 op1 = (out_length++, *code++), op2 = code[0], op3 = code[1];
|
|
|
|
|
|
|
|
switch (op1)
|
|
|
|
{
|
|
|
|
case 0x0f:
|
|
|
|
{
|
|
|
|
out_length++, code++;
|
|
|
|
|
|
|
|
switch (op2)
|
|
|
|
{
|
2015-07-27 13:40:22 +02:00
|
|
|
case 0x11:
|
2016-06-25 07:16:15 +02:00
|
|
|
case 0x29:
|
2015-07-27 13:40:22 +02:00
|
|
|
{
|
2016-06-25 07:16:15 +02:00
|
|
|
if (!repe && !repne) // MOVUPS/MOVAPS/MOVUPD/MOVAPD xmm/m, xmm
|
2015-07-27 13:40:22 +02:00
|
|
|
{
|
|
|
|
out_op = X64OP_STORE;
|
|
|
|
out_reg = get_modRM_reg_xmm(code, rex);
|
|
|
|
out_size = 16;
|
|
|
|
out_length += get_modRM_size(code);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2015-02-15 13:31:42 +01:00
|
|
|
case 0x7f:
|
|
|
|
{
|
2015-02-19 12:18:28 +01:00
|
|
|
if ((repe && !oso) || (!repe && oso)) // MOVDQU/MOVDQA xmm/m, xmm
|
2015-02-15 13:31:42 +01:00
|
|
|
{
|
|
|
|
out_op = X64OP_STORE;
|
|
|
|
out_reg = get_modRM_reg_xmm(code, rex);
|
|
|
|
out_size = 16;
|
|
|
|
out_length += get_modRM_size(code);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xb0:
|
|
|
|
{
|
|
|
|
if (!oso) // CMPXCHG r8/m8, r8
|
|
|
|
{
|
|
|
|
out_op = X64OP_CMPXCHG;
|
|
|
|
out_reg = rex & 8 ? get_modRM_reg(code, rex) : get_modRM_reg_lh(code);
|
|
|
|
out_size = 1;
|
|
|
|
out_length += get_modRM_size(code);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xb1:
|
|
|
|
{
|
|
|
|
if (true) // CMPXCHG r/m, r (16, 32, 64)
|
|
|
|
{
|
|
|
|
out_op = X64OP_CMPXCHG;
|
|
|
|
out_reg = get_modRM_reg(code, rex);
|
|
|
|
out_size = get_op_size(rex, oso);
|
|
|
|
out_length += get_modRM_size(code);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2016-06-07 22:24:20 +02:00
|
|
|
case 0x90:
|
|
|
|
case 0x91:
|
|
|
|
case 0x92:
|
|
|
|
case 0x93:
|
|
|
|
case 0x94:
|
|
|
|
case 0x95:
|
|
|
|
case 0x96:
|
|
|
|
case 0x97:
|
|
|
|
case 0x98:
|
|
|
|
case 0x9a:
|
|
|
|
case 0x9b:
|
|
|
|
case 0x9c:
|
|
|
|
case 0x9d:
|
|
|
|
case 0x9e:
|
|
|
|
case 0x9f:
|
|
|
|
{
|
|
|
|
if (!lock) // SETcc
|
|
|
|
{
|
|
|
|
out_op = X64OP_STORE;
|
|
|
|
out_reg = x64_reg_t(X64_BIT_O + op2 - 0x90); // 0x90 .. 0x9f
|
|
|
|
out_size = 1;
|
|
|
|
out_length += get_modRM_size(code);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x38:
|
|
|
|
{
|
|
|
|
out_length++, code++;
|
|
|
|
|
|
|
|
switch (op3)
|
|
|
|
{
|
|
|
|
case 0xf0:
|
|
|
|
case 0xf1:
|
|
|
|
{
|
|
|
|
if (!repne) // MOVBE
|
|
|
|
{
|
|
|
|
out_op = op3 == 0xf0 ? X64OP_LOAD_BE : X64OP_STORE_BE;
|
|
|
|
out_reg = get_modRM_reg(code, rex);
|
|
|
|
out_size = get_op_size(rex, oso);
|
|
|
|
out_length += get_modRM_size(code);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2015-02-15 13:31:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2015-03-06 23:10:04 +01:00
|
|
|
case 0x20:
|
|
|
|
{
|
|
|
|
if (!oso)
|
|
|
|
{
|
2016-06-07 22:24:20 +02:00
|
|
|
out_op = X64OP_AND;
|
2015-03-06 23:10:04 +01:00
|
|
|
out_reg = rex & 8 ? get_modRM_reg(code, rex) : get_modRM_reg_lh(code);
|
|
|
|
out_size = 1;
|
|
|
|
out_length += get_modRM_size(code);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x21:
|
|
|
|
{
|
|
|
|
if (true)
|
|
|
|
{
|
2016-06-07 22:24:20 +02:00
|
|
|
out_op = X64OP_AND;
|
2015-03-06 23:10:04 +01:00
|
|
|
out_reg = get_modRM_reg(code, rex);
|
|
|
|
out_size = get_op_size(rex, oso);
|
|
|
|
out_length += get_modRM_size(code);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2016-06-07 22:24:20 +02:00
|
|
|
case 0x80:
|
|
|
|
{
|
|
|
|
switch (auto mod_code = get_modRM_reg(code, 0))
|
|
|
|
{
|
|
|
|
//case 0: out_op = X64OP_ADD; break; // TODO: strange info in instruction manual
|
|
|
|
case 1: out_op = X64OP_OR; break;
|
|
|
|
case 2: out_op = X64OP_ADC; break;
|
|
|
|
case 3: out_op = X64OP_SBB; break;
|
|
|
|
case 4: out_op = X64OP_AND; break;
|
|
|
|
case 5: out_op = X64OP_SUB; break;
|
|
|
|
case 6: out_op = X64OP_XOR; break;
|
2016-06-22 23:39:39 +02:00
|
|
|
default: out_op = X64OP_LOAD_CMP; break;
|
2016-06-07 22:24:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
out_reg = X64_IMM8;
|
|
|
|
out_size = 1;
|
|
|
|
out_length += get_modRM_size(code) + 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
case 0x81:
|
|
|
|
{
|
|
|
|
switch (auto mod_code = get_modRM_reg(code, 0))
|
|
|
|
{
|
|
|
|
case 0: out_op = X64OP_ADD; break;
|
|
|
|
case 1: out_op = X64OP_OR; break;
|
|
|
|
case 2: out_op = X64OP_ADC; break;
|
|
|
|
case 3: out_op = X64OP_SBB; break;
|
|
|
|
case 4: out_op = X64OP_AND; break;
|
|
|
|
case 5: out_op = X64OP_SUB; break;
|
|
|
|
case 6: out_op = X64OP_XOR; break;
|
2016-06-22 23:39:39 +02:00
|
|
|
default: out_op = X64OP_LOAD_CMP; break;
|
2016-06-07 22:24:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
out_reg = oso ? X64_IMM16 : X64_IMM32;
|
|
|
|
out_size = get_op_size(rex, oso);
|
|
|
|
out_length += get_modRM_size(code) + (oso ? 2 : 4);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
case 0x83:
|
|
|
|
{
|
|
|
|
switch (auto mod_code = get_modRM_reg(code, 0))
|
|
|
|
{
|
|
|
|
case 0: out_op = X64OP_ADD; break;
|
|
|
|
case 1: out_op = X64OP_OR; break;
|
|
|
|
case 2: out_op = X64OP_ADC; break;
|
|
|
|
case 3: out_op = X64OP_SBB; break;
|
|
|
|
case 4: out_op = X64OP_AND; break;
|
|
|
|
case 5: out_op = X64OP_SUB; break;
|
|
|
|
case 6: out_op = X64OP_XOR; break;
|
2016-06-22 23:39:39 +02:00
|
|
|
default: out_op = X64OP_LOAD_CMP; break;
|
2016-06-07 22:24:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
out_reg = X64_IMM8;
|
|
|
|
out_size = get_op_size(rex, oso);
|
|
|
|
out_length += get_modRM_size(code) + 1;
|
|
|
|
return;
|
|
|
|
}
|
2015-02-15 13:31:42 +01:00
|
|
|
case 0x86:
|
2015-01-04 22:46:31 +01:00
|
|
|
{
|
2015-02-15 13:31:42 +01:00
|
|
|
if (!oso) // XCHG r8/m8, r8
|
|
|
|
{
|
|
|
|
out_op = X64OP_XCHG;
|
|
|
|
out_reg = rex & 8 ? get_modRM_reg(code, rex) : get_modRM_reg_lh(code);
|
|
|
|
out_size = 1;
|
|
|
|
out_length += get_modRM_size(code);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x87:
|
|
|
|
{
|
|
|
|
if (true) // XCHG r/m, r (16, 32, 64)
|
|
|
|
{
|
|
|
|
out_op = X64OP_XCHG;
|
|
|
|
out_reg = get_modRM_reg(code, rex);
|
|
|
|
out_size = get_op_size(rex, oso);
|
|
|
|
out_length += get_modRM_size(code);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x88:
|
2015-01-04 22:46:31 +01:00
|
|
|
{
|
2015-02-15 13:31:42 +01:00
|
|
|
if (!lock && !oso) // MOV r8/m8, r8
|
|
|
|
{
|
|
|
|
out_op = X64OP_STORE;
|
|
|
|
out_reg = rex & 8 ? get_modRM_reg(code, rex) : get_modRM_reg_lh(code);
|
|
|
|
out_size = 1;
|
|
|
|
out_length += get_modRM_size(code);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
2015-01-04 22:46:31 +01:00
|
|
|
}
|
2015-02-15 13:31:42 +01:00
|
|
|
case 0x89:
|
2015-01-04 22:46:31 +01:00
|
|
|
{
|
2015-02-15 13:31:42 +01:00
|
|
|
if (!lock) // MOV r/m, r (16, 32, 64)
|
|
|
|
{
|
|
|
|
out_op = X64OP_STORE;
|
|
|
|
out_reg = get_modRM_reg(code, rex);
|
|
|
|
out_size = get_op_size(rex, oso);
|
|
|
|
out_length += get_modRM_size(code);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
2015-01-04 22:46:31 +01:00
|
|
|
}
|
2015-02-15 13:31:42 +01:00
|
|
|
case 0x8a:
|
|
|
|
{
|
|
|
|
if (!lock && !oso) // MOV r8, r8/m8
|
|
|
|
{
|
|
|
|
out_op = X64OP_LOAD;
|
|
|
|
out_reg = rex & 8 ? get_modRM_reg(code, rex) : get_modRM_reg_lh(code);
|
|
|
|
out_size = 1;
|
|
|
|
out_length += get_modRM_size(code);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x8b:
|
|
|
|
{
|
|
|
|
if (!lock) // MOV r, r/m (16, 32, 64)
|
|
|
|
{
|
|
|
|
out_op = X64OP_LOAD;
|
|
|
|
out_reg = get_modRM_reg(code, rex);
|
|
|
|
out_size = get_op_size(rex, oso);
|
|
|
|
out_length += get_modRM_size(code);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0xa4:
|
|
|
|
{
|
|
|
|
if (!oso && !lock && !repe && !rex) // MOVS
|
|
|
|
{
|
|
|
|
out_op = X64OP_MOVS;
|
|
|
|
out_reg = X64_NOT_SET;
|
|
|
|
out_size = 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!oso && !lock && repe) // REP MOVS
|
|
|
|
{
|
|
|
|
out_op = X64OP_MOVS;
|
|
|
|
out_reg = rex & 8 ? X64R_RCX : X64R_ECX;
|
|
|
|
out_size = 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2015-02-17 03:01:47 +01:00
|
|
|
case 0xaa:
|
|
|
|
{
|
|
|
|
if (!oso && !lock && !repe && !rex) // STOS
|
|
|
|
{
|
|
|
|
out_op = X64OP_STOS;
|
|
|
|
out_reg = X64_NOT_SET;
|
|
|
|
out_size = 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!oso && !lock && repe) // REP STOS
|
|
|
|
{
|
|
|
|
out_op = X64OP_STOS;
|
|
|
|
out_reg = rex & 8 ? X64R_RCX : X64R_ECX;
|
|
|
|
out_size = 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2016-07-07 20:42:39 +02:00
|
|
|
case 0xc4: // 3-byte VEX prefix
|
|
|
|
case 0xc5: // 2-byte VEX prefix
|
|
|
|
{
|
|
|
|
// Last prefix byte: op2 or op3
|
|
|
|
const u8 opx = op1 == 0xc5 ? op2 : op3;
|
|
|
|
|
|
|
|
// Implied prefixes
|
|
|
|
rex |= op2 & 0x80 ? 0 : 0x4; // REX.R
|
|
|
|
rex |= op1 == 0xc4 && op3 & 0x80 ? 0x8 : 0; // REX.W ???
|
|
|
|
oso = (opx & 0x3) == 0x1;
|
|
|
|
repe = (opx & 0x3) == 0x2;
|
|
|
|
repne = (opx & 0x3) == 0x3;
|
|
|
|
|
|
|
|
const u8 vopm = op1 == 0xc5 ? 1 : op2 & 0x1f;
|
|
|
|
const u8 vop1 = op1 == 0xc5 ? op3 : code[2];
|
|
|
|
const u8 vlen = (opx & 0x4) ? 32 : 16;
|
|
|
|
const u8 vreg = (~opx >> 3) & 0xf;
|
|
|
|
out_length += op1 == 0xc5 ? 2 : 3;
|
|
|
|
code += op1 == 0xc5 ? 2 : 3;
|
|
|
|
|
|
|
|
if (vopm == 0x1) switch (vop1) // Implied leading byte 0x0F
|
|
|
|
{
|
|
|
|
case 0x11:
|
|
|
|
case 0x29:
|
|
|
|
{
|
|
|
|
if (!repe && !repne) // VMOVAPS/VMOVAPD/VMOVUPS/VMOVUPD mem,reg
|
|
|
|
{
|
|
|
|
out_op = X64OP_STORE;
|
|
|
|
out_reg = get_modRM_reg_xmm(code, rex);
|
|
|
|
out_size = vlen;
|
|
|
|
out_length += get_modRM_size(code);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 0x7f:
|
|
|
|
{
|
|
|
|
if (repe || oso) // VMOVDQU/VMOVDQA mem,reg
|
|
|
|
{
|
|
|
|
out_op = X64OP_STORE;
|
|
|
|
out_reg = get_modRM_reg_xmm(code, rex);
|
|
|
|
out_size = vlen;
|
|
|
|
out_length += get_modRM_size(code);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2015-02-15 13:31:42 +01:00
|
|
|
case 0xc6:
|
2015-01-04 22:46:31 +01:00
|
|
|
{
|
2016-06-07 22:24:20 +02:00
|
|
|
if (!lock && !oso && get_modRM_reg(code, 0) == 0) // MOV r8/m8, imm8
|
2015-01-04 22:46:31 +01:00
|
|
|
{
|
2015-02-15 13:31:42 +01:00
|
|
|
out_op = X64OP_STORE;
|
|
|
|
out_reg = X64_IMM8;
|
|
|
|
out_size = 1;
|
|
|
|
out_length += get_modRM_size(code) + 1;
|
2015-01-04 22:46:31 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-02-15 13:31:42 +01:00
|
|
|
break;
|
2015-01-04 22:46:31 +01:00
|
|
|
}
|
2015-02-15 13:31:42 +01:00
|
|
|
case 0xc7:
|
2015-01-04 22:46:31 +01:00
|
|
|
{
|
2016-06-07 22:24:20 +02:00
|
|
|
if (!lock && get_modRM_reg(code, 0) == 0) // MOV r/m, imm16/imm32 (16, 32, 64)
|
2015-02-15 13:31:42 +01:00
|
|
|
{
|
|
|
|
out_op = X64OP_STORE;
|
|
|
|
out_reg = oso ? X64_IMM16 : X64_IMM32;
|
|
|
|
out_size = get_op_size(rex, oso);
|
|
|
|
out_length += get_modRM_size(code) + (oso ? 2 : 4);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
2015-01-04 22:46:31 +01:00
|
|
|
}
|
2016-06-22 23:39:39 +02:00
|
|
|
case 0xf6:
|
|
|
|
{
|
|
|
|
switch (auto mod_code = get_modRM_reg(code, 0))
|
|
|
|
{
|
|
|
|
case 0: out_op = X64OP_LOAD_TEST; break;
|
|
|
|
default: out_op = X64OP_NONE; break; // TODO...
|
|
|
|
}
|
|
|
|
|
|
|
|
out_reg = X64_IMM8;
|
|
|
|
out_size = 1;
|
|
|
|
out_length += get_modRM_size(code) + 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
case 0xf7:
|
|
|
|
{
|
|
|
|
switch (auto mod_code = get_modRM_reg(code, 0))
|
|
|
|
{
|
|
|
|
case 0: out_op = X64OP_LOAD_TEST; break;
|
|
|
|
default: out_op = X64OP_NONE; break; // TODO...
|
|
|
|
}
|
|
|
|
|
|
|
|
out_reg = oso ? X64_IMM16 : X64_IMM32;
|
|
|
|
out_size = get_op_size(rex, oso);
|
|
|
|
out_length += get_modRM_size(code) + (oso ? 2 : 4);
|
|
|
|
return;
|
|
|
|
}
|
2015-01-04 22:46:31 +01:00
|
|
|
}
|
2015-02-15 13:31:42 +01:00
|
|
|
|
2015-02-15 18:13:06 +01:00
|
|
|
out_op = X64OP_NONE;
|
2015-02-15 13:31:42 +01:00
|
|
|
out_reg = X64_NOT_SET;
|
|
|
|
out_size = 0;
|
|
|
|
out_length = 0;
|
2015-01-04 22:46:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
2015-01-18 14:57:39 +01:00
|
|
|
typedef CONTEXT x64_context;
|
|
|
|
|
2015-02-17 01:08:23 +01:00
|
|
|
#define X64REG(context, reg) (&(&(context)->Rax)[reg])
|
2015-08-06 15:31:13 +02:00
|
|
|
#define XMMREG(context, reg) (reinterpret_cast<v128*>(&(&(context)->Xmm0)[reg]))
|
2015-02-17 01:08:23 +01:00
|
|
|
#define EFLAGS(context) ((context)->EFlags)
|
2015-01-18 14:57:39 +01:00
|
|
|
|
2015-12-16 15:20:46 +01:00
|
|
|
#define ARG1(context) RCX(context)
|
|
|
|
#define ARG2(context) RDX(context)
|
|
|
|
|
2015-01-18 14:57:39 +01:00
|
|
|
#else
|
|
|
|
|
|
|
|
typedef ucontext_t x64_context;
|
|
|
|
|
2015-02-11 05:17:39 +01:00
|
|
|
#ifdef __APPLE__
|
|
|
|
|
|
|
|
#define X64REG(context, reg) (darwin_x64reg(context, reg))
|
2015-08-06 15:31:13 +02:00
|
|
|
#define XMMREG(context, reg) (reinterpret_cast<v128*>(&(context)->uc_mcontext->__fs.__fpu_xmm0.__xmm_reg[reg]))
|
2015-02-28 20:37:31 +01:00
|
|
|
#define EFLAGS(context) ((context)->uc_mcontext->__ss.__rflags)
|
2015-02-11 05:17:39 +01:00
|
|
|
|
|
|
|
uint64_t* darwin_x64reg(x64_context *context, int reg)
|
|
|
|
{
|
2015-02-13 21:24:18 +01:00
|
|
|
auto *state = &context->uc_mcontext->__ss;
|
|
|
|
switch(reg)
|
|
|
|
{
|
2015-12-06 16:45:34 +01:00
|
|
|
case 0: return &state->__rax;
|
|
|
|
case 1: return &state->__rcx;
|
|
|
|
case 2: return &state->__rdx;
|
|
|
|
case 3: return &state->__rbx;
|
|
|
|
case 4: return &state->__rsp;
|
|
|
|
case 5: return &state->__rbp;
|
|
|
|
case 6: return &state->__rsi;
|
|
|
|
case 7: return &state->__rdi;
|
|
|
|
case 8: return &state->__r8;
|
|
|
|
case 9: return &state->__r9;
|
|
|
|
case 10: return &state->__r10;
|
|
|
|
case 11: return &state->__r11;
|
|
|
|
case 12: return &state->__r12;
|
|
|
|
case 13: return &state->__r13;
|
|
|
|
case 14: return &state->__r14;
|
|
|
|
case 15: return &state->__r15;
|
|
|
|
case 16: return &state->__rip;
|
|
|
|
default:
|
|
|
|
LOG_ERROR(GENERAL, "Invalid register index: %d", reg);
|
|
|
|
return nullptr;
|
2015-02-13 21:24:18 +01:00
|
|
|
}
|
2015-02-11 05:17:39 +01:00
|
|
|
}
|
|
|
|
|
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::thread::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 20:03:41 +02:00
|
|
|
#elif defined(__DragonFly__) || defined(__FreeBSD__)
|
|
|
|
|
|
|
|
#define X64REG(context, reg) (freebsd_x64reg(context, reg))
|
|
|
|
#ifdef __DragonFly__
|
|
|
|
# define XMMREG(context, reg) (reinterpret_cast<v128*>(((union savefpu*)(context)->uc_mcontext.mc_fpregs)->sv_xmm.sv_xmm[reg]))
|
|
|
|
#else
|
|
|
|
# define XMMREG(context, reg) (reinterpret_cast<v128*>(((struct savefpu*)(context)->uc_mcontext.mc_fpstate)->sv_xmm[reg]))
|
|
|
|
#endif
|
|
|
|
#define EFLAGS(context) ((context)->uc_mcontext.mc_rflags)
|
|
|
|
|
|
|
|
register_t* freebsd_x64reg(x64_context *context, int reg)
|
|
|
|
{
|
|
|
|
auto *state = &context->uc_mcontext;
|
|
|
|
switch(reg)
|
|
|
|
{
|
|
|
|
case 0: return &state->mc_rax;
|
|
|
|
case 1: return &state->mc_rcx;
|
|
|
|
case 2: return &state->mc_rdx;
|
|
|
|
case 3: return &state->mc_rbx;
|
|
|
|
case 4: return &state->mc_rsp;
|
|
|
|
case 5: return &state->mc_rbp;
|
|
|
|
case 6: return &state->mc_rsi;
|
|
|
|
case 7: return &state->mc_rdi;
|
|
|
|
case 8: return &state->mc_r8;
|
|
|
|
case 9: return &state->mc_r9;
|
|
|
|
case 10: return &state->mc_r10;
|
|
|
|
case 11: return &state->mc_r11;
|
|
|
|
case 12: return &state->mc_r12;
|
|
|
|
case 13: return &state->mc_r13;
|
|
|
|
case 14: return &state->mc_r14;
|
|
|
|
case 15: return &state->mc_r15;
|
|
|
|
case 16: return &state->mc_rip;
|
|
|
|
default:
|
|
|
|
LOG_ERROR(GENERAL, "Invalid register index: %d", reg);
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#elif defined(__OpenBSD__)
|
|
|
|
|
|
|
|
#define X64REG(context, reg) (openbsd_x64reg(context, reg))
|
|
|
|
#define XMMREG(context, reg) (reinterpret_cast<v128*>((context)->sc_fpstate->fx_xmm[reg]))
|
|
|
|
#define EFLAGS(context) ((context)->sc_rflags)
|
|
|
|
|
|
|
|
long* openbsd_x64reg(x64_context *context, int reg)
|
|
|
|
{
|
|
|
|
auto *state = &context->uc_mcontext;
|
|
|
|
switch(reg)
|
|
|
|
{
|
|
|
|
case 0: return &state->sc_rax;
|
|
|
|
case 1: return &state->sc_rcx;
|
|
|
|
case 2: return &state->sc_rdx;
|
|
|
|
case 3: return &state->sc_rbx;
|
|
|
|
case 4: return &state->sc_rsp;
|
|
|
|
case 5: return &state->sc_rbp;
|
|
|
|
case 6: return &state->sc_rsi;
|
|
|
|
case 7: return &state->sc_rdi;
|
|
|
|
case 8: return &state->sc_r8;
|
|
|
|
case 9: return &state->sc_r9;
|
|
|
|
case 10: return &state->sc_r10;
|
|
|
|
case 11: return &state->sc_r11;
|
|
|
|
case 12: return &state->sc_r12;
|
|
|
|
case 13: return &state->sc_r13;
|
|
|
|
case 14: return &state->sc_r14;
|
|
|
|
case 15: return &state->sc_r15;
|
|
|
|
case 16: return &state->sc_rip;
|
|
|
|
default:
|
|
|
|
LOG_ERROR(GENERAL, "Invalid register index: %d", reg);
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#elif defined(__NetBSD__)
|
|
|
|
|
|
|
|
static const decltype(_REG_RAX) reg_table[] =
|
|
|
|
{
|
|
|
|
_REG_RAX, _REG_RCX, _REG_RDX, _REG_RBX, _REG_RSP, _REG_RBP, _REG_RSI, _REG_RDI,
|
|
|
|
_REG_R8, _REG_R9, _REG_R10, _REG_R11, _REG_R12, _REG_R13, _REG_R14, _REG_R15, _REG_RIP
|
|
|
|
};
|
|
|
|
|
|
|
|
#define X64REG(context, reg) (&(context)->uc_mcontext.__gregs[reg_table[reg]])
|
|
|
|
#define XMM_sig(context, reg) (reinterpret_cast<v128*>(((struct fxsave64*)(context)->uc_mcontext.__fpregs)->fx_xmm[reg]))
|
|
|
|
#define EFLAGS(context) ((context)->uc_mcontext.__gregs[_REG_RFL])
|
|
|
|
|
2015-02-11 05:17:39 +01:00
|
|
|
#else
|
2015-02-13 21:24:18 +01:00
|
|
|
|
2015-12-06 16:45:34 +01:00
|
|
|
static const decltype(REG_RAX) reg_table[] =
|
2015-01-04 22:46:31 +01:00
|
|
|
{
|
2015-01-18 14:57:39 +01:00
|
|
|
REG_RAX, REG_RCX, REG_RDX, REG_RBX, REG_RSP, REG_RBP, REG_RSI, REG_RDI,
|
|
|
|
REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RIP
|
|
|
|
};
|
|
|
|
|
2015-02-17 01:08:23 +01:00
|
|
|
#define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]])
|
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::thread::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 20:03:41 +02:00
|
|
|
#ifdef __sun
|
|
|
|
#define XMMREG(context, reg) (reinterpret_cast<v128*>(&(context)->uc_mcontext.fpregs.fp_reg_set.fpchip_state.xmm[reg_table[reg]]))
|
|
|
|
#else
|
2015-08-06 15:31:13 +02:00
|
|
|
#define XMMREG(context, reg) (reinterpret_cast<v128*>(&(context)->uc_mcontext.fpregs->_xmm[reg]))
|
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::thread::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 20:03:41 +02:00
|
|
|
#endif // __sun
|
2015-02-17 01:40:10 +01:00
|
|
|
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
|
2015-02-13 21:24:18 +01:00
|
|
|
|
2015-02-11 05:17:39 +01:00
|
|
|
#endif // __APPLE__
|
2015-01-18 14:57:39 +01:00
|
|
|
|
2015-12-16 15:20:46 +01:00
|
|
|
#define ARG1(context) RDI(context)
|
|
|
|
#define ARG2(context) RSI(context)
|
|
|
|
|
2015-01-18 14:57:39 +01:00
|
|
|
#endif
|
|
|
|
|
2015-02-15 18:13:06 +01:00
|
|
|
#define RAX(c) (*X64REG((c), 0))
|
|
|
|
#define RCX(c) (*X64REG((c), 1))
|
|
|
|
#define RDX(c) (*X64REG((c), 2))
|
2015-12-16 15:20:46 +01:00
|
|
|
#define RSP(c) (*X64REG((c), 4))
|
2015-02-15 18:13:06 +01:00
|
|
|
#define RSI(c) (*X64REG((c), 6))
|
|
|
|
#define RDI(c) (*X64REG((c), 7))
|
|
|
|
#define RIP(c) (*X64REG((c), 16))
|
|
|
|
|
|
|
|
bool get_x64_reg_value(x64_context* context, x64_reg_t reg, size_t d_size, size_t i_size, u64& out_value)
|
|
|
|
{
|
|
|
|
// get x64 reg value (for store operations)
|
|
|
|
if (reg - X64R_RAX < 16)
|
|
|
|
{
|
|
|
|
// load the value from x64 register
|
|
|
|
const u64 reg_value = *X64REG(context, reg - X64R_RAX);
|
|
|
|
|
|
|
|
switch (d_size)
|
|
|
|
{
|
|
|
|
case 1: out_value = (u8)reg_value; return true;
|
|
|
|
case 2: out_value = (u16)reg_value; return true;
|
|
|
|
case 4: out_value = (u32)reg_value; return true;
|
|
|
|
case 8: out_value = reg_value; return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (reg - X64R_AL < 4 && d_size == 1)
|
|
|
|
{
|
|
|
|
out_value = (u8)(*X64REG(context, reg - X64R_AL));
|
2015-02-16 02:53:53 +01:00
|
|
|
return true;
|
2015-02-15 18:13:06 +01:00
|
|
|
}
|
|
|
|
else if (reg - X64R_AH < 4 && d_size == 1)
|
|
|
|
{
|
|
|
|
out_value = (u8)(*X64REG(context, reg - X64R_AH) >> 8);
|
2015-02-16 02:53:53 +01:00
|
|
|
return true;
|
2015-02-15 18:13:06 +01:00
|
|
|
}
|
2015-02-19 21:38:25 +01:00
|
|
|
else if (reg == X64_IMM8)
|
|
|
|
{
|
2015-02-20 14:58:40 +01:00
|
|
|
// load the immediate value (assuming it's at the end of the instruction)
|
2015-02-19 21:38:25 +01:00
|
|
|
const s8 imm_value = *(s8*)(RIP(context) + i_size - 1);
|
|
|
|
|
|
|
|
switch (d_size)
|
|
|
|
{
|
|
|
|
case 1: out_value = (u8)imm_value; return true;
|
2016-06-07 22:24:20 +02:00
|
|
|
case 2: out_value = (u16)imm_value; return true; // sign-extended
|
|
|
|
case 4: out_value = (u32)imm_value; return true; // sign-extended
|
|
|
|
case 8: out_value = (u64)imm_value; return true; // sign-extended
|
2015-02-19 21:38:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (reg == X64_IMM16)
|
|
|
|
{
|
|
|
|
const s16 imm_value = *(s16*)(RIP(context) + i_size - 2);
|
|
|
|
|
|
|
|
switch (d_size)
|
|
|
|
{
|
|
|
|
case 2: out_value = (u16)imm_value; return true;
|
|
|
|
}
|
|
|
|
}
|
2015-02-15 18:13:06 +01:00
|
|
|
else if (reg == X64_IMM32)
|
|
|
|
{
|
|
|
|
const s32 imm_value = *(s32*)(RIP(context) + i_size - 4);
|
2018-02-09 13:24:46 +01:00
|
|
|
|
2015-02-15 18:13:06 +01:00
|
|
|
switch (d_size)
|
|
|
|
{
|
|
|
|
case 4: out_value = (u32)imm_value; return true;
|
|
|
|
case 8: out_value = (u64)imm_value; return true; // sign-extended
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (reg == X64R_ECX)
|
|
|
|
{
|
|
|
|
out_value = (u32)RCX(context);
|
2015-02-16 02:53:53 +01:00
|
|
|
return true;
|
2015-02-15 18:13:06 +01:00
|
|
|
}
|
2016-06-07 22:24:20 +02:00
|
|
|
else if (reg >= X64_BIT_O && reg <= X64_BIT_NLE)
|
|
|
|
{
|
|
|
|
const u32 _cf = EFLAGS(context) & 0x1;
|
|
|
|
const u32 _zf = EFLAGS(context) & 0x40;
|
|
|
|
const u32 _sf = EFLAGS(context) & 0x80;
|
|
|
|
const u32 _of = EFLAGS(context) & 0x800;
|
|
|
|
const u32 _pf = EFLAGS(context) & 0x4;
|
|
|
|
const u32 _l = (_sf << 4) ^ _of; // SF != OF
|
|
|
|
|
|
|
|
switch (reg & ~1)
|
|
|
|
{
|
|
|
|
case X64_BIT_O: out_value = !!_of ^ (reg & 1); break;
|
|
|
|
case X64_BIT_C: out_value = !!_cf ^ (reg & 1); break;
|
|
|
|
case X64_BIT_Z: out_value = !!_zf ^ (reg & 1); break;
|
|
|
|
case X64_BIT_BE: out_value = !!(_cf | _zf) ^ (reg & 1); break;
|
|
|
|
case X64_BIT_S: out_value = !!_sf ^ (reg & 1); break;
|
|
|
|
case X64_BIT_P: out_value = !!_pf ^ (reg & 1); break;
|
|
|
|
case X64_BIT_L: out_value = !!_l ^ (reg & 1); break;
|
|
|
|
case X64_BIT_LE: out_value = !!(_l | _zf) ^ (reg & 1); break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-02-15 18:13:06 +01:00
|
|
|
|
2016-08-03 22:51:05 +02:00
|
|
|
LOG_ERROR(MEMORY, "get_x64_reg_value(): invalid arguments (reg=%d, d_size=%lld, i_size=%lld)", (u32)reg, d_size, i_size);
|
2015-02-15 18:13:06 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool put_x64_reg_value(x64_context* context, x64_reg_t reg, size_t d_size, u64 value)
|
|
|
|
{
|
|
|
|
// save x64 reg value (for load operations)
|
|
|
|
if (reg - X64R_RAX < 16)
|
|
|
|
{
|
2015-02-17 01:08:23 +01:00
|
|
|
// save the value into x64 register
|
|
|
|
switch (d_size)
|
|
|
|
{
|
2017-11-02 07:27:57 +01:00
|
|
|
case 1: *X64REG(context, reg - X64R_RAX) = (value & 0xff) | (*X64REG(context, reg - X64R_RAX) & 0xffffff00); return true;
|
|
|
|
case 2: *X64REG(context, reg - X64R_RAX) = (value & 0xffff) | (*X64REG(context, reg - X64R_RAX) & 0xffff0000); return true;
|
2015-02-17 01:08:23 +01:00
|
|
|
case 4: *X64REG(context, reg - X64R_RAX) = value & 0xffffffff; return true;
|
|
|
|
case 8: *X64REG(context, reg - X64R_RAX) = value; return true;
|
|
|
|
}
|
2015-02-15 18:13:06 +01:00
|
|
|
}
|
|
|
|
|
2016-08-03 22:51:05 +02:00
|
|
|
LOG_ERROR(MEMORY, "put_x64_reg_value(): invalid destination (reg=%d, d_size=%lld, value=0x%llx)", (u32)reg, d_size, value);
|
2015-02-15 18:13:06 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-06-07 22:24:20 +02:00
|
|
|
bool set_x64_cmp_flags(x64_context* context, size_t d_size, u64 x, u64 y, bool carry = true)
|
2015-02-17 01:08:23 +01:00
|
|
|
{
|
|
|
|
switch (d_size)
|
|
|
|
{
|
|
|
|
case 1: break;
|
|
|
|
case 2: break;
|
|
|
|
case 4: break;
|
|
|
|
case 8: break;
|
|
|
|
default: LOG_ERROR(MEMORY, "set_x64_cmp_flags(): invalid d_size (%lld)", d_size); return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const u64 sign = 1ull << (d_size * 8 - 1); // sign mask
|
|
|
|
const u64 diff = x - y;
|
|
|
|
const u64 summ = x + y;
|
|
|
|
|
2016-06-07 22:24:20 +02:00
|
|
|
if (carry && ((x & y) | ((x ^ y) & ~summ)) & sign)
|
2015-02-17 01:08:23 +01:00
|
|
|
{
|
|
|
|
EFLAGS(context) |= 0x1; // set CF
|
|
|
|
}
|
2016-06-07 22:24:20 +02:00
|
|
|
else if (carry)
|
2015-02-17 01:08:23 +01:00
|
|
|
{
|
|
|
|
EFLAGS(context) &= ~0x1; // clear CF
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x == y)
|
|
|
|
{
|
|
|
|
EFLAGS(context) |= 0x40; // set ZF
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EFLAGS(context) &= ~0x40; // clear ZF
|
|
|
|
}
|
|
|
|
|
|
|
|
if (diff & sign)
|
|
|
|
{
|
|
|
|
EFLAGS(context) |= 0x80; // set SF
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EFLAGS(context) &= ~0x80; // clear SF
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((x ^ summ) & (y ^ summ) & sign)
|
|
|
|
{
|
|
|
|
EFLAGS(context) |= 0x800; // set OF
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EFLAGS(context) &= ~0x800; // clear OF
|
|
|
|
}
|
|
|
|
|
|
|
|
const u8 p1 = (u8)diff ^ ((u8)diff >> 4);
|
|
|
|
const u8 p2 = p1 ^ (p1 >> 2);
|
|
|
|
const u8 p3 = p2 ^ (p2 >> 1);
|
|
|
|
|
|
|
|
if ((p3 & 1) == 0)
|
|
|
|
{
|
|
|
|
EFLAGS(context) |= 0x4; // set PF
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EFLAGS(context) &= ~0x4; // clear PF
|
|
|
|
}
|
|
|
|
|
|
|
|
if (((x & y) | ((x ^ y) & ~summ)) & 0x8)
|
|
|
|
{
|
|
|
|
EFLAGS(context) |= 0x10; // set AF
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EFLAGS(context) &= ~0x10; // clear AF
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t get_x64_access_size(x64_context* context, x64_op_t op, x64_reg_t reg, size_t d_size, size_t i_size)
|
2015-02-15 18:13:06 +01:00
|
|
|
{
|
2015-02-17 16:27:15 +01:00
|
|
|
if (op == X64OP_MOVS || op == X64OP_STOS)
|
2015-02-15 18:13:06 +01:00
|
|
|
{
|
2015-02-17 16:27:15 +01:00
|
|
|
if (EFLAGS(context) & 0x400 /* direction flag */)
|
2015-02-15 18:13:06 +01:00
|
|
|
{
|
2017-02-17 20:35:57 +01:00
|
|
|
// TODO
|
2015-02-17 16:27:15 +01:00
|
|
|
return 0;
|
2015-02-15 18:13:06 +01:00
|
|
|
}
|
|
|
|
|
2015-02-17 16:27:15 +01:00
|
|
|
if (reg != X64_NOT_SET) // get "full" access size from RCX register
|
|
|
|
{
|
|
|
|
u64 counter;
|
|
|
|
if (!get_x64_reg_value(context, reg, 8, i_size, counter))
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return d_size * counter;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-17 01:08:23 +01:00
|
|
|
return d_size;
|
2015-02-15 18:13:06 +01:00
|
|
|
}
|
|
|
|
|
2016-01-20 13:46:58 +01:00
|
|
|
namespace rsx
|
|
|
|
{
|
|
|
|
extern std::function<bool(u32 addr, bool is_writing)> g_access_violation_handler;
|
|
|
|
}
|
2015-07-02 19:05:27 +02:00
|
|
|
|
2015-02-17 01:08:23 +01:00
|
|
|
bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
|
2015-01-18 14:57:39 +01:00
|
|
|
{
|
2017-02-17 20:35:57 +01:00
|
|
|
g_tls_fault_all++;
|
|
|
|
|
2017-03-13 11:35:20 +01:00
|
|
|
const auto cpu = get_current_cpu_thread();
|
|
|
|
|
2016-01-20 13:46:58 +01:00
|
|
|
if (rsx::g_access_violation_handler && rsx::g_access_violation_handler(addr, is_writing))
|
|
|
|
{
|
2016-09-07 00:38:52 +02:00
|
|
|
g_tls_fault_rsx++;
|
2017-03-13 11:35:20 +01:00
|
|
|
|
|
|
|
if (cpu)
|
|
|
|
{
|
|
|
|
cpu->test_state();
|
|
|
|
}
|
|
|
|
|
2016-01-20 13:46:58 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-02-15 18:13:06 +01:00
|
|
|
auto code = (const u8*)RIP(context);
|
|
|
|
|
2015-02-15 13:31:42 +01:00
|
|
|
x64_op_t op;
|
|
|
|
x64_reg_t reg;
|
2015-02-15 18:13:06 +01:00
|
|
|
size_t d_size;
|
|
|
|
size_t i_size;
|
2015-02-15 13:31:42 +01:00
|
|
|
|
|
|
|
// decode single x64 instruction that causes memory access
|
2015-02-15 18:13:06 +01:00
|
|
|
decode_x64_reg_op(code, op, reg, d_size, i_size);
|
2015-02-15 13:31:42 +01:00
|
|
|
|
2015-07-28 18:01:07 +02:00
|
|
|
auto report_opcode = [=]()
|
|
|
|
{
|
|
|
|
if (op == X64OP_NONE)
|
|
|
|
{
|
2016-08-15 15:57:51 +02:00
|
|
|
LOG_ERROR(MEMORY, "decode_x64_reg_op(%p): unsupported opcode: %s", code, *(be_t<v128, 1>*)code);
|
2015-07-28 18:01:07 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-02-17 01:08:23 +01:00
|
|
|
if ((d_size | d_size + addr) >= 0x100000000ull)
|
2015-02-16 02:53:53 +01:00
|
|
|
{
|
2015-02-17 01:08:23 +01:00
|
|
|
LOG_ERROR(MEMORY, "Invalid d_size (0x%llx)", d_size);
|
2015-07-28 18:01:07 +02:00
|
|
|
report_opcode();
|
2015-02-16 02:53:53 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-02-17 01:08:23 +01:00
|
|
|
// get length of data being accessed
|
|
|
|
size_t a_size = get_x64_access_size(context, op, reg, d_size, i_size);
|
2015-02-16 02:53:53 +01:00
|
|
|
|
2015-02-17 01:08:23 +01:00
|
|
|
if ((a_size | a_size + addr) >= 0x100000000ull)
|
|
|
|
{
|
|
|
|
LOG_ERROR(MEMORY, "Invalid a_size (0x%llx)", a_size);
|
2015-07-28 18:01:07 +02:00
|
|
|
report_opcode();
|
2015-02-17 01:08:23 +01:00
|
|
|
return false;
|
2015-02-16 02:53:53 +01:00
|
|
|
}
|
|
|
|
|
2015-02-07 00:39:51 +01:00
|
|
|
// check if address is RawSPU MMIO register
|
|
|
|
if (addr - RAW_SPU_BASE_ADDR < (6 * RAW_SPU_OFFSET) && (addr % RAW_SPU_OFFSET) >= RAW_SPU_PROB_OFFSET)
|
2015-01-04 22:46:31 +01:00
|
|
|
{
|
2016-02-01 22:55:43 +01:00
|
|
|
auto thread = idm::get<RawSPUThread>((addr - RAW_SPU_BASE_ADDR) / RAW_SPU_OFFSET);
|
2015-03-04 22:51:14 +01:00
|
|
|
|
2015-07-03 18:07:36 +02:00
|
|
|
if (!thread)
|
2015-03-04 22:51:14 +01:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-02-17 01:08:23 +01:00
|
|
|
if (a_size != 4 || !d_size || !i_size)
|
2015-02-15 13:31:42 +01:00
|
|
|
{
|
2016-08-03 22:51:05 +02:00
|
|
|
LOG_ERROR(MEMORY, "Invalid or unsupported instruction (op=%d, reg=%d, d_size=%lld, a_size=0x%llx, i_size=%lld)", (u32)op, (u32)reg, d_size, a_size, i_size);
|
2015-07-28 18:01:07 +02:00
|
|
|
report_opcode();
|
2015-02-15 13:31:42 +01:00
|
|
|
return false;
|
2015-01-18 14:57:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (op)
|
|
|
|
{
|
|
|
|
case X64OP_LOAD:
|
2016-06-07 22:24:20 +02:00
|
|
|
case X64OP_LOAD_BE:
|
2016-06-22 23:39:39 +02:00
|
|
|
case X64OP_LOAD_CMP:
|
|
|
|
case X64OP_LOAD_TEST:
|
2015-01-18 14:57:39 +01:00
|
|
|
{
|
2015-02-15 18:13:06 +01:00
|
|
|
u32 value;
|
2016-06-22 23:39:39 +02:00
|
|
|
if (is_writing || !thread->read_reg(addr, value))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (op != X64OP_LOAD_BE)
|
|
|
|
{
|
|
|
|
value = se_storage<u32>::swap(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (op == X64OP_LOAD_CMP)
|
|
|
|
{
|
|
|
|
u64 rvalue;
|
|
|
|
if (!get_x64_reg_value(context, reg, d_size, i_size, rvalue) || !set_x64_cmp_flags(context, d_size, value, rvalue))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (op == X64OP_LOAD_TEST)
|
|
|
|
{
|
|
|
|
u64 rvalue;
|
|
|
|
if (!get_x64_reg_value(context, reg, d_size, i_size, rvalue) || !set_x64_cmp_flags(context, d_size, value & rvalue, 0))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!put_x64_reg_value(context, reg, d_size, value))
|
2015-02-15 18:13:06 +01:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-01-18 14:57:39 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case X64OP_STORE:
|
2016-06-07 22:24:20 +02:00
|
|
|
case X64OP_STORE_BE:
|
2015-01-18 14:57:39 +01:00
|
|
|
{
|
2015-02-15 18:13:06 +01:00
|
|
|
u64 reg_value;
|
2016-06-22 23:39:39 +02:00
|
|
|
if (!is_writing || !get_x64_reg_value(context, reg, d_size, i_size, reg_value))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!thread->write_reg(addr, op == X64OP_STORE ? se_storage<u32>::swap((u32)reg_value) : (u32)reg_value))
|
2015-02-15 18:13:06 +01:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-01-18 14:57:39 +01:00
|
|
|
break;
|
|
|
|
}
|
2015-02-17 03:01:47 +01:00
|
|
|
case X64OP_MOVS: // possibly, TODO
|
|
|
|
case X64OP_STOS:
|
2015-02-15 13:31:42 +01:00
|
|
|
default:
|
|
|
|
{
|
2016-08-03 22:51:05 +02:00
|
|
|
LOG_ERROR(MEMORY, "Invalid or unsupported operation (op=%d, reg=%d, d_size=%lld, i_size=%lld)", (u32)op, (u32)reg, d_size, i_size);
|
2015-07-28 18:01:07 +02:00
|
|
|
report_opcode();
|
2015-02-15 13:31:42 +01:00
|
|
|
return false;
|
|
|
|
}
|
2015-01-18 14:57:39 +01:00
|
|
|
}
|
|
|
|
|
2015-02-17 01:08:23 +01:00
|
|
|
// skip processed instruction
|
|
|
|
RIP(context) += i_size;
|
2017-02-17 20:35:57 +01:00
|
|
|
g_tls_fault_spu++;
|
2015-02-17 01:08:23 +01:00
|
|
|
return true;
|
2017-02-17 20:35:57 +01:00
|
|
|
}
|
2015-02-17 01:08:23 +01:00
|
|
|
|
2017-09-01 00:22:48 +02:00
|
|
|
if (vm::check_addr(addr, std::max<std::size_t>(1, d_size), vm::page_allocated | (is_writing ? vm::page_writable : vm::page_readable)))
|
2017-03-11 00:14:48 +01:00
|
|
|
{
|
2017-03-13 11:35:20 +01:00
|
|
|
if (cpu)
|
|
|
|
{
|
|
|
|
cpu->test_state();
|
|
|
|
}
|
|
|
|
|
2017-03-11 00:14:48 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-03-13 11:35:20 +01:00
|
|
|
if (cpu)
|
2017-02-17 20:35:57 +01:00
|
|
|
{
|
2017-10-08 22:37:54 +02:00
|
|
|
if (fxm::check<page_fault_notification_entries>())
|
|
|
|
{
|
|
|
|
for (const auto& entry : fxm::get<page_fault_notification_entries>()->entries)
|
|
|
|
{
|
|
|
|
auto mem = vm::get(vm::any, entry.start_addr);
|
|
|
|
if (!mem)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (entry.start_addr <= addr && addr <= addr + mem->size - 1)
|
|
|
|
{
|
2018-02-09 13:24:46 +01:00
|
|
|
// Place the page fault event onto table so that other functions [sys_mmapper_free_address and ppu pagefault funcs]
|
2017-10-08 22:37:54 +02:00
|
|
|
// know that this thread is page faulted and where.
|
|
|
|
|
|
|
|
auto pf_entries = fxm::get_always<page_fault_event_entries>();
|
|
|
|
{
|
|
|
|
semaphore_lock pf_lock(pf_entries->pf_mutex);
|
|
|
|
page_fault_event pf_event{ cpu->id, addr };
|
|
|
|
pf_entries->events.emplace_back(pf_event);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Now, we notify the game that a page fault occurred so it can rectify it.
|
|
|
|
// Note, for data3, were the memory readable AND we got a page fault, it must be due to a write violation since reads are allowed.
|
|
|
|
be_t<u64> data1 = addr;
|
|
|
|
be_t<u64> data2 = (SYS_MEMORY_PAGE_FAULT_TYPE_PPU_THREAD << 32) + cpu->id; // TODO: fix hack for now that assumes PPU thread always.
|
|
|
|
be_t<u64> data3 = vm::check_addr(addr, a_size, vm::page_readable) ? SYS_MEMORY_PAGE_FAULT_CAUSE_READ_ONLY : SYS_MEMORY_PAGE_FAULT_CAUSE_NON_MAPPED;
|
|
|
|
|
|
|
|
LOG_ERROR(MEMORY, "Page_fault %s location 0x%x because of %s memory", is_writing ? "writing" : "reading",
|
|
|
|
addr, data3 == SYS_MEMORY_PAGE_FAULT_CAUSE_READ_ONLY ? "writing read-only" : "using unmapped");
|
|
|
|
|
|
|
|
error_code sending_error = sys_event_port_send(entry.port_id, data1, data2, data3);
|
2018-02-09 13:24:46 +01:00
|
|
|
|
2017-10-08 22:37:54 +02:00
|
|
|
// If we fail due to being busy, wait a bit and try again.
|
|
|
|
while (sending_error == CELL_EBUSY)
|
|
|
|
{
|
|
|
|
lv2_obj::sleep(*cpu, 1000);
|
|
|
|
thread_ctrl::wait_for(1000);
|
|
|
|
sending_error = sys_event_port_send(entry.port_id, data1, data2, data3);
|
|
|
|
}
|
2018-02-09 13:24:46 +01:00
|
|
|
|
2017-10-08 22:37:54 +02:00
|
|
|
if (sending_error)
|
|
|
|
{
|
|
|
|
fmt::throw_exception("Unknown error %x while trying to pass page fault.", sending_error.value);
|
|
|
|
}
|
|
|
|
|
|
|
|
lv2_obj::sleep(*cpu);
|
|
|
|
thread_ctrl::wait();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-11 17:29:34 +01:00
|
|
|
vm::temporary_unlock(*cpu);
|
2017-02-17 20:35:57 +01:00
|
|
|
LOG_FATAL(MEMORY, "Access violation %s location 0x%x", is_writing ? "writing" : "reading", addr);
|
|
|
|
cpu->state += cpu_flag::dbg_pause;
|
2017-03-11 00:14:48 +01:00
|
|
|
cpu->check_state();
|
2017-02-17 20:35:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2015-01-18 14:57:39 +01:00
|
|
|
}
|
2015-01-04 22:46:31 +01:00
|
|
|
|
2017-01-22 11:46:05 +01:00
|
|
|
#ifdef __linux__
|
|
|
|
extern "C" struct dwarf_eh_bases
|
|
|
|
{
|
|
|
|
void* tbase;
|
|
|
|
void* dbase;
|
|
|
|
void* func;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern "C" struct fde* _Unwind_Find_FDE(void* pc, struct dwarf_eh_bases* bases);
|
|
|
|
#endif
|
|
|
|
|
2016-07-18 12:38:51 +02:00
|
|
|
// Detect leaf function
|
|
|
|
static bool is_leaf_function(u64 rip)
|
|
|
|
{
|
|
|
|
#ifdef _WIN32
|
|
|
|
DWORD64 base = 0;
|
|
|
|
if (const auto rtf = RtlLookupFunctionEntry(rip, &base, nullptr))
|
|
|
|
{
|
|
|
|
// Access UNWIND_INFO structure
|
|
|
|
const auto uw = (u8*)(base + rtf->UnwindData);
|
|
|
|
|
|
|
|
// Leaf function has zero epilog size and no unwind codes
|
|
|
|
return uw[0] == 1 && uw[1] == 0 && uw[2] == 0 && uw[3] == 0;
|
|
|
|
}
|
|
|
|
|
2017-01-22 11:46:05 +01:00
|
|
|
// No unwind info implies leaf function
|
|
|
|
return true;
|
|
|
|
#elif __linux__
|
|
|
|
struct dwarf_eh_bases bases;
|
|
|
|
|
|
|
|
if (struct fde* f = _Unwind_Find_FDE(reinterpret_cast<void*>(rip), &bases))
|
|
|
|
{
|
|
|
|
const auto words = (const u32*)f;
|
|
|
|
|
|
|
|
if (words[0] < 0x14)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (words[0] == 0x14 && !words[3] && !words[4])
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-07-18 12:38:51 +02:00
|
|
|
// No unwind info implies leaf function
|
|
|
|
return true;
|
|
|
|
#else
|
2017-01-22 11:46:05 +01:00
|
|
|
// Unsupported
|
2016-07-18 12:38:51 +02:00
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2015-12-16 15:20:46 +01:00
|
|
|
#ifdef _WIN32
|
|
|
|
|
2016-01-06 00:52:48 +01:00
|
|
|
static LONG exception_handler(PEXCEPTION_POINTERS pExp)
|
2015-02-07 00:39:51 +01:00
|
|
|
{
|
2017-03-25 16:53:45 +01:00
|
|
|
const u64 addr64 = pExp->ExceptionRecord->ExceptionInformation[1] - (u64)vm::g_base_addr;
|
|
|
|
const u64 exec64 = pExp->ExceptionRecord->ExceptionInformation[1] - (u64)vm::g_exec_addr;
|
2015-02-08 16:25:50 +01:00
|
|
|
const bool is_writing = pExp->ExceptionRecord->ExceptionInformation[0] != 0;
|
2015-02-07 00:39:51 +01:00
|
|
|
|
2016-02-01 22:55:43 +01:00
|
|
|
if (pExp->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && addr64 < 0x100000000ull)
|
2015-02-07 00:39:51 +01:00
|
|
|
{
|
2016-02-01 22:55:43 +01:00
|
|
|
if (thread_ctrl::get_current() && handle_access_violation((u32)addr64, is_writing, pExp->ContextRecord))
|
|
|
|
{
|
|
|
|
return EXCEPTION_CONTINUE_EXECUTION;
|
|
|
|
}
|
2015-02-07 00:39:51 +01:00
|
|
|
}
|
2016-02-01 22:55:43 +01:00
|
|
|
|
2017-03-25 16:53:45 +01:00
|
|
|
if (pExp->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && exec64 < 0x100000000ull)
|
|
|
|
{
|
|
|
|
if (thread_ctrl::get_current() && handle_access_violation((u32)exec64, is_writing, pExp->ContextRecord))
|
|
|
|
{
|
|
|
|
return EXCEPTION_CONTINUE_EXECUTION;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-01 22:55:43 +01:00
|
|
|
return EXCEPTION_CONTINUE_SEARCH;
|
2016-01-06 00:52:48 +01:00
|
|
|
}
|
2015-02-07 00:39:51 +01:00
|
|
|
|
2016-01-06 00:52:48 +01:00
|
|
|
static LONG exception_filter(PEXCEPTION_POINTERS pExp)
|
2015-07-01 00:25:52 +02:00
|
|
|
{
|
2015-12-18 12:11:18 +01:00
|
|
|
std::string msg = fmt::format("Unhandled Win32 exception 0x%08X.\n", pExp->ExceptionRecord->ExceptionCode);
|
2015-12-16 15:20:46 +01:00
|
|
|
|
|
|
|
if (pExp->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION)
|
|
|
|
{
|
|
|
|
const auto cause = pExp->ExceptionRecord->ExceptionInformation[0] != 0 ? "writing" : "reading";
|
2015-07-01 00:25:52 +02:00
|
|
|
|
2016-08-06 14:09:44 +02:00
|
|
|
msg += fmt::format("Segfault %s location %p at %p.\n", cause, pExp->ExceptionRecord->ExceptionInformation[1], pExp->ExceptionRecord->ExceptionAddress);
|
2015-12-16 15:20:46 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
msg += fmt::format("Exception address: %p.\n", pExp->ExceptionRecord->ExceptionAddress);
|
|
|
|
|
|
|
|
for (DWORD i = 0; i < pExp->ExceptionRecord->NumberParameters; i++)
|
|
|
|
{
|
|
|
|
msg += fmt::format("ExceptionInformation[0x%x]: %p.\n", i, pExp->ExceptionRecord->ExceptionInformation[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-06 14:09:44 +02:00
|
|
|
std::vector<HMODULE> modules;
|
2016-08-10 13:17:07 +02:00
|
|
|
for (DWORD size = 256; modules.size() != size; size /= sizeof(HMODULE))
|
2016-08-06 14:09:44 +02:00
|
|
|
{
|
|
|
|
modules.resize(size);
|
|
|
|
if (!EnumProcessModules(GetCurrentProcess(), modules.data(), size * sizeof(HMODULE), &size))
|
|
|
|
{
|
|
|
|
modules.clear();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-06 00:52:48 +01:00
|
|
|
msg += fmt::format("Instruction address: %p.\n", pExp->ContextRecord->Rip);
|
2016-08-06 14:09:44 +02:00
|
|
|
|
|
|
|
DWORD64 unwind_base;
|
|
|
|
if (const auto rtf = RtlLookupFunctionEntry(pExp->ContextRecord->Rip, &unwind_base, nullptr))
|
|
|
|
{
|
|
|
|
// Get function address
|
|
|
|
const DWORD64 func_addr = rtf->BeginAddress + unwind_base;
|
|
|
|
msg += fmt::format("Function address: %p (base+0x%x).\n", func_addr, rtf->BeginAddress);
|
|
|
|
|
|
|
|
// Access UNWIND_INFO structure
|
|
|
|
//const auto uw = (u8*)(unwind_base + rtf->UnwindData);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (HMODULE module : modules)
|
|
|
|
{
|
|
|
|
MODULEINFO info;
|
|
|
|
if (GetModuleInformation(GetCurrentProcess(), module, &info, sizeof(info)))
|
|
|
|
{
|
|
|
|
const DWORD64 base = (DWORD64)info.lpBaseOfDll;
|
|
|
|
|
|
|
|
if (pExp->ContextRecord->Rip >= base && pExp->ContextRecord->Rip < base + info.SizeOfImage)
|
|
|
|
{
|
|
|
|
std::string module_name;
|
2016-08-10 13:17:07 +02:00
|
|
|
for (DWORD size = 15; module_name.size() != size;)
|
2016-08-06 14:09:44 +02:00
|
|
|
{
|
|
|
|
module_name.resize(size);
|
2016-08-10 13:17:07 +02:00
|
|
|
size = GetModuleBaseNameA(GetCurrentProcess(), module, &module_name.front(), size + 1);
|
2016-08-06 14:09:44 +02:00
|
|
|
if (!size)
|
|
|
|
{
|
2016-08-10 13:17:07 +02:00
|
|
|
module_name.clear();
|
2016-08-06 14:09:44 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
msg += fmt::format("Module name: '%s'.\n", module_name);
|
|
|
|
msg += fmt::format("Module base: %p.\n", info.lpBaseOfDll);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
msg += fmt::format("RPCS3 image base: %p.\n", GetModuleHandle(NULL));
|
2016-01-06 00:52:48 +01:00
|
|
|
|
2016-02-01 22:55:43 +01:00
|
|
|
// TODO: print registers and the callstack
|
|
|
|
|
2015-12-16 15:20:46 +01:00
|
|
|
// Report fatal error
|
2015-12-18 12:11:18 +01:00
|
|
|
report_fatal_error(msg);
|
2015-07-01 00:25:52 +02:00
|
|
|
return EXCEPTION_CONTINUE_SEARCH;
|
2016-01-06 00:52:48 +01:00
|
|
|
}
|
|
|
|
|
2016-02-01 22:55:43 +01:00
|
|
|
const bool s_exception_handler_set = []() -> bool
|
2016-01-06 00:52:48 +01:00
|
|
|
{
|
|
|
|
if (!AddVectoredExceptionHandler(1, (PVECTORED_EXCEPTION_HANDLER)exception_handler))
|
|
|
|
{
|
|
|
|
report_fatal_error("AddVectoredExceptionHandler() failed.");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)exception_filter))
|
|
|
|
{
|
|
|
|
report_fatal_error("SetUnhandledExceptionFilter() failed.");
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}();
|
2015-07-01 00:25:52 +02:00
|
|
|
|
2015-01-04 22:46:31 +01:00
|
|
|
#else
|
|
|
|
|
2016-01-06 00:52:48 +01:00
|
|
|
static void signal_handler(int sig, siginfo_t* info, void* uct)
|
2015-01-04 22:46:31 +01:00
|
|
|
{
|
2015-12-16 15:20:46 +01:00
|
|
|
x64_context* context = (ucontext_t*)uct;
|
2015-02-11 05:17:39 +01:00
|
|
|
|
|
|
|
#ifdef __APPLE__
|
2015-12-16 15:20:46 +01:00
|
|
|
const bool is_writing = context->uc_mcontext->__es.__err & 0x2;
|
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::thread::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 20:03:41 +02:00
|
|
|
#elif defined(__DragonFly__) || defined(__FreeBSD__)
|
|
|
|
const bool is_writing = context->uc_mcontext.mc_err & 0x2;
|
|
|
|
#elif defined(__OpenBSD__)
|
|
|
|
const bool is_writing = context->sc_err & 0x2;
|
|
|
|
#elif defined(__NetBSD__)
|
|
|
|
const bool is_writing = context->uc_mcontext.__gregs[_REG_ERR] & 0x2;
|
2015-02-11 05:17:39 +01:00
|
|
|
#else
|
2015-12-16 15:20:46 +01:00
|
|
|
const bool is_writing = context->uc_mcontext.gregs[REG_ERR] & 0x2;
|
2015-02-11 05:17:39 +01:00
|
|
|
#endif
|
2015-02-08 14:38:08 +01:00
|
|
|
|
2017-03-25 16:53:45 +01:00
|
|
|
const u64 addr64 = (u64)info->si_addr - (u64)vm::g_base_addr;
|
|
|
|
const u64 exec64 = (u64)info->si_addr - (u64)vm::g_exec_addr;
|
2015-12-16 15:20:46 +01:00
|
|
|
const auto cause = is_writing ? "writing" : "reading";
|
|
|
|
|
2016-02-01 22:55:43 +01:00
|
|
|
if (addr64 < 0x100000000ull)
|
2015-01-04 22:46:31 +01:00
|
|
|
{
|
2015-12-16 15:20:46 +01:00
|
|
|
// Try to process access violation
|
2017-02-17 20:35:57 +01:00
|
|
|
if (thread_ctrl::get_current() && handle_access_violation((u32)addr64, is_writing, context))
|
2017-03-25 16:53:45 +01:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (exec64 < 0x100000000ull)
|
|
|
|
{
|
|
|
|
if (thread_ctrl::get_current() && handle_access_violation((u32)exec64, is_writing, context))
|
2015-01-04 22:46:31 +01:00
|
|
|
{
|
2017-02-17 20:35:57 +01:00
|
|
|
return;
|
2015-01-04 22:46:31 +01:00
|
|
|
}
|
|
|
|
}
|
2017-02-17 20:35:57 +01:00
|
|
|
|
|
|
|
// TODO (debugger interaction)
|
|
|
|
report_fatal_error(fmt::format("Segfault %s location %p at %p.", cause, info->si_addr, RIP(context)));
|
2015-01-04 22:46:31 +01:00
|
|
|
}
|
|
|
|
|
2016-02-01 22:55:43 +01:00
|
|
|
const bool s_exception_handler_set = []() -> bool
|
2015-01-04 22:46:31 +01:00
|
|
|
{
|
2016-01-06 00:52:48 +01:00
|
|
|
struct ::sigaction sa;
|
2015-01-04 22:46:31 +01:00
|
|
|
sa.sa_flags = SA_SIGINFO;
|
|
|
|
sigemptyset(&sa.sa_mask);
|
|
|
|
sa.sa_sigaction = signal_handler;
|
2015-12-16 15:20:46 +01:00
|
|
|
|
2016-01-06 00:52:48 +01:00
|
|
|
if (::sigaction(SIGSEGV, &sa, NULL) == -1)
|
|
|
|
{
|
2016-07-16 19:58:42 +02:00
|
|
|
std::printf("sigaction(SIGSEGV) failed (0x%x).", errno);
|
|
|
|
std::abort();
|
|
|
|
}
|
|
|
|
|
2016-01-06 00:52:48 +01:00
|
|
|
return true;
|
|
|
|
}();
|
2015-01-04 22:46:31 +01:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2015-11-26 09:06:29 +01:00
|
|
|
// TODO
|
2016-04-25 12:49:12 +02:00
|
|
|
extern atomic_t<u32> g_thread_count(0);
|
2013-06-30 10:46:29 +02:00
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
thread_local DECLARE(thread_ctrl::g_tls_this_thread) = nullptr;
|
|
|
|
|
2016-04-27 00:27:24 +02:00
|
|
|
extern thread_local std::string(*g_tls_log_prefix)();
|
|
|
|
|
2017-10-21 13:21:37 +02:00
|
|
|
DECLARE(thread_ctrl::g_native_core_layout) { native_core_arrangement::undefined };
|
|
|
|
|
2016-05-13 16:01:48 +02:00
|
|
|
void thread_ctrl::start(const std::shared_ptr<thread_ctrl>& ctrl, task_stack task)
|
|
|
|
{
|
2016-09-07 00:38:52 +02:00
|
|
|
#ifdef _WIN32
|
|
|
|
using thread_result = uint;
|
|
|
|
using thread_type = thread_result(__stdcall*)(void* arg);
|
|
|
|
#else
|
|
|
|
using thread_result = void*;
|
|
|
|
using thread_type = thread_result(*)(void* arg);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Thread entry point
|
|
|
|
const thread_type entry = [](void* arg) -> thread_result
|
2016-05-13 16:01:48 +02:00
|
|
|
{
|
2016-09-07 00:38:52 +02:00
|
|
|
// Recover shared_ptr from short-circuited thread_ctrl object pointer
|
|
|
|
const std::shared_ptr<thread_ctrl> ctrl = static_cast<thread_ctrl*>(arg)->m_self;
|
|
|
|
|
2016-05-13 16:01:48 +02:00
|
|
|
try
|
|
|
|
{
|
|
|
|
ctrl->initialize();
|
2016-09-07 00:38:52 +02:00
|
|
|
task_stack{std::move(ctrl->m_task)}.invoke();
|
2016-05-13 16:01:48 +02:00
|
|
|
}
|
|
|
|
catch (...)
|
|
|
|
{
|
2016-09-07 00:38:52 +02:00
|
|
|
// Capture exception
|
|
|
|
ctrl->finalize(std::current_exception());
|
|
|
|
return 0;
|
2016-05-13 16:01:48 +02:00
|
|
|
}
|
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
ctrl->finalize(nullptr);
|
|
|
|
return 0;
|
|
|
|
};
|
2016-05-13 16:01:48 +02:00
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
ctrl->m_self = ctrl;
|
|
|
|
ctrl->m_task = std::move(task);
|
2016-05-13 16:01:48 +02:00
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
// TODO: implement simple thread pool
|
|
|
|
#ifdef _WIN32
|
|
|
|
std::uintptr_t thread = _beginthreadex(nullptr, 0, entry, ctrl.get(), 0, nullptr);
|
|
|
|
verify("thread_ctrl::start" HERE), thread != 0;
|
|
|
|
#else
|
|
|
|
pthread_t thread;
|
2017-01-31 18:37:02 +01:00
|
|
|
verify("thread_ctrl::start" HERE), pthread_create(&thread, nullptr, entry, ctrl.get()) == 0;
|
2016-09-07 00:38:52 +02:00
|
|
|
#endif
|
2016-05-13 16:01:48 +02:00
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
// TODO: this is unsafe and must be duplicated in thread_ctrl::initialize
|
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::thread::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 20:03:41 +02:00
|
|
|
ctrl->m_thread = (uintptr_t)thread;
|
2016-05-13 16:01:48 +02:00
|
|
|
}
|
|
|
|
|
2015-11-26 09:06:29 +01:00
|
|
|
void thread_ctrl::initialize()
|
2015-07-01 00:25:52 +02:00
|
|
|
{
|
2016-04-25 12:49:12 +02:00
|
|
|
// Initialize TLS variable
|
|
|
|
g_tls_this_thread = this;
|
|
|
|
|
2016-04-27 00:27:24 +02:00
|
|
|
g_tls_log_prefix = []
|
|
|
|
{
|
|
|
|
return g_tls_this_thread->m_name;
|
|
|
|
};
|
|
|
|
|
|
|
|
++g_thread_count;
|
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
#ifdef _MSC_VER
|
2016-04-25 12:49:12 +02:00
|
|
|
struct THREADNAME_INFO
|
|
|
|
{
|
|
|
|
DWORD dwType;
|
|
|
|
LPCSTR szName;
|
|
|
|
DWORD dwThreadID;
|
|
|
|
DWORD dwFlags;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Set thread name for VS debugger
|
|
|
|
if (IsDebuggerPresent())
|
|
|
|
{
|
|
|
|
THREADNAME_INFO info;
|
|
|
|
info.dwType = 0x1000;
|
|
|
|
info.szName = m_name.c_str();
|
|
|
|
info.dwThreadID = -1;
|
|
|
|
info.dwFlags = 0;
|
|
|
|
|
|
|
|
__try
|
|
|
|
{
|
|
|
|
RaiseException(0x406D1388, 0, sizeof(info) / sizeof(ULONG_PTR), (ULONG_PTR*)&info);
|
|
|
|
}
|
|
|
|
__except (EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2018-03-11 17:30:44 +01:00
|
|
|
|
2018-03-12 21:13:49 +01:00
|
|
|
#if defined(__APPLE__)
|
|
|
|
pthread_setname_np(m_name.substr(0, 15).c_str());
|
|
|
|
#elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
|
|
|
pthread_set_name_np(pthread_self(), m_name.c_str());
|
|
|
|
#elif defined(__NetBSD__)
|
|
|
|
pthread_setname_np(pthread_self(), "%s", (void*)m_name.c_str());
|
|
|
|
#elif !defined(_WIN32)
|
2018-03-11 17:30:44 +01:00
|
|
|
pthread_setname_np(pthread_self(), m_name.substr(0, 15).c_str());
|
|
|
|
#endif
|
2013-06-30 10:46:29 +02:00
|
|
|
}
|
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
void thread_ctrl::finalize(std::exception_ptr eptr) noexcept
|
2012-11-15 00:39:56 +01:00
|
|
|
{
|
2016-09-07 00:38:52 +02:00
|
|
|
// Run atexit functions
|
|
|
|
m_task.invoke();
|
|
|
|
m_task.reset();
|
2015-11-26 09:06:29 +01:00
|
|
|
|
2016-05-13 16:01:48 +02:00
|
|
|
#ifdef _WIN32
|
2016-09-07 00:38:52 +02:00
|
|
|
ULONG64 cycles{};
|
|
|
|
QueryThreadCycleTime(GetCurrentThread(), &cycles);
|
|
|
|
FILETIME ctime, etime, ktime, utime;
|
|
|
|
GetThreadTimes(GetCurrentThread(), &ctime, &etime, &ktime, &utime);
|
|
|
|
const u64 time = ((ktime.dwLowDateTime | (u64)ktime.dwHighDateTime << 32) + (utime.dwLowDateTime | (u64)utime.dwHighDateTime << 32)) * 100ull;
|
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::thread::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 20:03:41 +02:00
|
|
|
#elif defined(RUSAGE_THREAD)
|
2016-09-07 00:38:52 +02:00
|
|
|
const u64 cycles = 0; // Not supported
|
|
|
|
struct ::rusage stats{};
|
|
|
|
::getrusage(RUSAGE_THREAD, &stats);
|
|
|
|
const u64 time = (stats.ru_utime.tv_sec + stats.ru_stime.tv_sec) * 1000000000ull + (stats.ru_utime.tv_usec + stats.ru_stime.tv_usec) * 1000ull;
|
|
|
|
#else
|
|
|
|
const u64 cycles = 0;
|
|
|
|
const u64 time = 0;
|
2016-04-25 12:49:12 +02:00
|
|
|
#endif
|
2016-09-07 00:38:52 +02:00
|
|
|
|
2017-03-13 11:14:34 +01:00
|
|
|
g_tls_log_prefix = []
|
|
|
|
{
|
|
|
|
return g_tls_this_thread->m_name;
|
|
|
|
};
|
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
LOG_NOTICE(GENERAL, "Thread time: %fs (%fGc); Faults: %u [rsx:%u, spu:%u];",
|
|
|
|
time / 1000000000.,
|
|
|
|
cycles / 1000000000.,
|
2017-02-17 20:35:57 +01:00
|
|
|
g_tls_fault_all,
|
2016-09-07 00:38:52 +02:00
|
|
|
g_tls_fault_rsx,
|
|
|
|
g_tls_fault_spu);
|
|
|
|
|
|
|
|
--g_thread_count;
|
|
|
|
|
|
|
|
// Untangle circular reference, set exception
|
|
|
|
semaphore_lock{m_mutex}, m_self.reset(), m_exception = eptr;
|
|
|
|
|
|
|
|
// Signal joining waiters
|
|
|
|
m_jcv.notify_all();
|
2016-04-25 12:49:12 +02:00
|
|
|
}
|
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
void thread_ctrl::_push(task_stack task)
|
2016-04-25 12:49:12 +02:00
|
|
|
{
|
2016-09-07 00:38:52 +02:00
|
|
|
g_tls_this_thread->m_task.push(std::move(task));
|
2016-05-13 16:01:48 +02:00
|
|
|
}
|
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
bool thread_ctrl::_wait_for(u64 usec)
|
2016-05-13 16:01:48 +02:00
|
|
|
{
|
2016-09-07 00:38:52 +02:00
|
|
|
auto _this = g_tls_this_thread;
|
2016-05-13 16:01:48 +02:00
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
struct half_lock
|
|
|
|
{
|
|
|
|
semaphore<>& ref;
|
2016-07-16 19:58:42 +02:00
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
void lock()
|
|
|
|
{
|
|
|
|
// Used to avoid additional lock + unlock
|
|
|
|
}
|
2016-04-25 12:49:12 +02:00
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
void unlock()
|
|
|
|
{
|
|
|
|
ref.post();
|
|
|
|
}
|
2016-04-25 12:49:12 +02:00
|
|
|
}
|
2016-09-07 00:38:52 +02:00
|
|
|
_lock{_this->m_mutex};
|
2018-02-09 13:24:46 +01:00
|
|
|
|
2017-01-29 20:52:07 +01:00
|
|
|
do
|
2016-04-25 12:49:12 +02:00
|
|
|
{
|
2017-01-29 20:52:07 +01:00
|
|
|
// Mutex is unlocked at the start and after the waiting
|
2016-09-07 00:38:52 +02:00
|
|
|
if (u32 sig = _this->m_signal.load())
|
|
|
|
{
|
|
|
|
thread_ctrl::test();
|
2016-04-25 12:49:12 +02:00
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
if (sig & 1)
|
|
|
|
{
|
|
|
|
_this->m_signal &= ~1;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-29 20:52:07 +01:00
|
|
|
if (usec == 0)
|
2016-04-25 12:49:12 +02:00
|
|
|
{
|
2017-01-29 20:52:07 +01:00
|
|
|
// No timeout: return immediately
|
2016-09-07 00:38:52 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-01-29 20:52:07 +01:00
|
|
|
// Lock (semaphore)
|
2016-09-07 00:38:52 +02:00
|
|
|
_this->m_mutex.wait();
|
|
|
|
|
2017-01-29 20:52:07 +01:00
|
|
|
// Double-check the value
|
2016-09-07 00:38:52 +02:00
|
|
|
if (u32 sig = _this->m_signal.load())
|
|
|
|
{
|
|
|
|
if (sig & 2 && _this->m_exception)
|
|
|
|
{
|
|
|
|
_this->_throw();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sig & 1)
|
|
|
|
{
|
|
|
|
_this->m_signal &= ~1;
|
|
|
|
_this->m_mutex.post();
|
|
|
|
return true;
|
|
|
|
}
|
2016-04-25 12:49:12 +02:00
|
|
|
}
|
|
|
|
}
|
2017-11-17 20:20:46 +01:00
|
|
|
while (_this->m_cond.wait(_lock, std::exchange(usec, usec > cond_variable::max_timeout ? -1 : 0)));
|
2016-09-07 00:38:52 +02:00
|
|
|
|
|
|
|
// Timeout
|
|
|
|
return false;
|
2016-04-25 12:49:12 +02:00
|
|
|
}
|
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
[[noreturn]] void thread_ctrl::_throw()
|
2016-04-25 12:49:12 +02:00
|
|
|
{
|
2016-09-07 00:38:52 +02:00
|
|
|
std::exception_ptr ex = std::exchange(m_exception, std::exception_ptr{});
|
|
|
|
m_signal &= ~3;
|
|
|
|
m_mutex.post();
|
|
|
|
std::rethrow_exception(std::move(ex));
|
|
|
|
}
|
2016-05-13 16:01:48 +02:00
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
void thread_ctrl::_notify(cond_variable thread_ctrl::* ptr)
|
|
|
|
{
|
|
|
|
// Optimized lock + unlock
|
|
|
|
if (!m_mutex.get())
|
2016-05-13 16:01:48 +02:00
|
|
|
{
|
2016-09-07 00:38:52 +02:00
|
|
|
m_mutex.wait();
|
|
|
|
m_mutex.post();
|
2016-05-13 16:01:48 +02:00
|
|
|
}
|
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
(this->*ptr).notify_one();
|
|
|
|
}
|
2016-04-25 12:49:12 +02:00
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
thread_ctrl::thread_ctrl(std::string&& name)
|
|
|
|
: m_name(std::move(name))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
thread_ctrl::~thread_ctrl()
|
|
|
|
{
|
|
|
|
if (m_thread)
|
2016-04-25 12:49:12 +02:00
|
|
|
{
|
2016-09-07 00:38:52 +02:00
|
|
|
#ifdef _WIN32
|
|
|
|
CloseHandle((HANDLE)m_thread.raw());
|
|
|
|
#else
|
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::thread::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 20:03:41 +02:00
|
|
|
pthread_detach((pthread_t)m_thread.raw());
|
2016-09-07 00:38:52 +02:00
|
|
|
#endif
|
2016-04-25 12:49:12 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
std::exception_ptr thread_ctrl::get_exception() const
|
2016-05-13 16:01:48 +02:00
|
|
|
{
|
2016-09-07 00:38:52 +02:00
|
|
|
semaphore_lock lock(m_mutex);
|
|
|
|
return m_exception;
|
2016-05-13 16:01:48 +02:00
|
|
|
}
|
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
void thread_ctrl::set_exception(std::exception_ptr ptr)
|
2016-05-13 16:01:48 +02:00
|
|
|
{
|
2016-09-07 00:38:52 +02:00
|
|
|
semaphore_lock lock(m_mutex);
|
|
|
|
m_exception = ptr;
|
|
|
|
|
|
|
|
if (m_exception)
|
|
|
|
{
|
|
|
|
m_signal |= 2;
|
|
|
|
m_cond.notify_one();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_signal &= ~2;
|
|
|
|
}
|
2016-05-13 16:01:48 +02:00
|
|
|
}
|
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
void thread_ctrl::join()
|
2016-04-25 12:49:12 +02:00
|
|
|
{
|
2016-09-07 00:38:52 +02:00
|
|
|
#ifdef _WIN32
|
|
|
|
//verify("thread_ctrl::join" HERE), WaitForSingleObjectEx((HANDLE)m_thread.load(), -1, false) == WAIT_OBJECT_0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
semaphore_lock lock(m_mutex);
|
|
|
|
|
|
|
|
while (m_self)
|
2016-04-25 12:49:12 +02:00
|
|
|
{
|
2016-09-07 00:38:52 +02:00
|
|
|
m_jcv.wait(lock);
|
2016-04-25 12:49:12 +02:00
|
|
|
}
|
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
if (UNLIKELY(m_exception && !std::uncaught_exception()))
|
|
|
|
{
|
|
|
|
std::rethrow_exception(m_exception);
|
|
|
|
}
|
2016-04-25 12:49:12 +02:00
|
|
|
}
|
|
|
|
|
2016-05-13 16:01:48 +02:00
|
|
|
void thread_ctrl::notify()
|
2016-04-25 12:49:12 +02:00
|
|
|
{
|
2016-09-07 00:38:52 +02:00
|
|
|
if (!(m_signal & 1))
|
|
|
|
{
|
|
|
|
m_signal |= 1;
|
|
|
|
_notify(&thread_ctrl::m_cond);
|
|
|
|
}
|
2016-04-25 12:49:12 +02:00
|
|
|
}
|
|
|
|
|
2016-09-07 00:38:52 +02:00
|
|
|
void thread_ctrl::test()
|
2016-05-13 16:01:48 +02:00
|
|
|
{
|
2016-09-07 00:38:52 +02:00
|
|
|
const auto _this = g_tls_this_thread;
|
|
|
|
|
|
|
|
if (_this->m_signal & 2)
|
|
|
|
{
|
|
|
|
_this->m_mutex.wait();
|
|
|
|
|
|
|
|
if (_this->m_exception)
|
|
|
|
{
|
|
|
|
_this->_throw();
|
|
|
|
}
|
|
|
|
|
|
|
|
_this->m_mutex.post();
|
|
|
|
}
|
2016-04-25 12:49:12 +02:00
|
|
|
}
|
|
|
|
|
2017-10-21 13:21:37 +02:00
|
|
|
void thread_ctrl::detect_cpu_layout()
|
|
|
|
{
|
|
|
|
if (!g_native_core_layout.compare_and_swap_test(native_core_arrangement::undefined, native_core_arrangement::generic))
|
|
|
|
return;
|
|
|
|
|
|
|
|
const auto system_id = utils::get_system_info();
|
|
|
|
if (system_id.find("Ryzen") != std::string::npos)
|
|
|
|
{
|
|
|
|
g_native_core_layout.store(native_core_arrangement::amd_ccx);
|
|
|
|
}
|
|
|
|
else if (system_id.find("i3") != std::string::npos || system_id.find("i7") != std::string::npos)
|
|
|
|
{
|
|
|
|
g_native_core_layout.store(native_core_arrangement::intel_ht);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
u16 thread_ctrl::get_affinity_mask(thread_class group)
|
|
|
|
{
|
|
|
|
detect_cpu_layout();
|
|
|
|
|
|
|
|
if (const auto thread_count = std::thread::hardware_concurrency())
|
|
|
|
{
|
|
|
|
const u16 all_cores_mask = thread_count < 16 ? (u16)(~(UINT16_MAX << thread_count)): UINT16_MAX;
|
|
|
|
|
|
|
|
switch (g_native_core_layout)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case native_core_arrangement::generic:
|
|
|
|
{
|
|
|
|
return all_cores_mask;
|
|
|
|
}
|
|
|
|
case native_core_arrangement::amd_ccx:
|
|
|
|
{
|
2018-01-19 12:32:15 +01:00
|
|
|
u16 spu_mask, ppu_mask, rsx_mask;
|
2017-10-21 13:21:37 +02:00
|
|
|
if (thread_count >= 16)
|
|
|
|
{
|
|
|
|
// Threadripper, R7
|
|
|
|
// Assign threads 8-16
|
|
|
|
// It appears some windows code is bound to lower core addresses, binding 8-16 is alot faster than 0-7
|
2018-01-19 12:32:15 +01:00
|
|
|
ppu_mask = spu_mask = 0b1111111100000000;
|
|
|
|
rsx_mask = all_cores_mask;
|
|
|
|
}
|
|
|
|
else if (thread_count == 12)
|
|
|
|
{
|
|
|
|
// 1600/2600 (x)
|
|
|
|
ppu_mask = spu_mask = 0b111111000000;
|
|
|
|
rsx_mask = all_cores_mask;
|
2017-10-21 13:21:37 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-01-19 12:32:15 +01:00
|
|
|
// R5 & R3 don't seem to improve performance no matter how these are shuffled
|
|
|
|
ppu_mask = spu_mask = rsx_mask = 0b11111111 & all_cores_mask;
|
2017-10-21 13:21:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (group)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case thread_class::general:
|
|
|
|
return all_cores_mask;
|
|
|
|
case thread_class::rsx:
|
2018-01-19 12:32:15 +01:00
|
|
|
return rsx_mask;
|
2017-10-21 13:21:37 +02:00
|
|
|
case thread_class::ppu:
|
2018-01-19 12:32:15 +01:00
|
|
|
return ppu_mask;
|
2017-10-21 13:21:37 +02:00
|
|
|
case thread_class::spu:
|
2018-01-19 12:32:15 +01:00
|
|
|
return spu_mask;
|
2017-10-21 13:21:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
case native_core_arrangement::intel_ht:
|
|
|
|
{
|
|
|
|
if (thread_count <= 4)
|
|
|
|
{
|
|
|
|
//i3 or worse
|
|
|
|
switch (group)
|
|
|
|
{
|
|
|
|
case thread_class::rsx:
|
|
|
|
case thread_class::ppu:
|
|
|
|
return (0b0101 & all_cores_mask);
|
|
|
|
case thread_class::spu:
|
|
|
|
return (0b1010 & all_cores_mask);
|
|
|
|
case thread_class::general:
|
|
|
|
return all_cores_mask;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return all_cores_mask;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return UINT16_MAX;
|
|
|
|
}
|
|
|
|
|
2017-06-24 17:36:49 +02:00
|
|
|
void thread_ctrl::set_native_priority(int priority)
|
|
|
|
{
|
|
|
|
#ifdef _WIN32
|
|
|
|
HANDLE _this_thread = GetCurrentThread();
|
|
|
|
INT native_priority = THREAD_PRIORITY_NORMAL;
|
|
|
|
|
2017-10-31 23:49:54 +01:00
|
|
|
if (priority > 0)
|
2017-06-24 17:36:49 +02:00
|
|
|
native_priority = THREAD_PRIORITY_ABOVE_NORMAL;
|
2017-10-31 23:49:54 +01:00
|
|
|
if (priority < 0)
|
2017-06-24 17:36:49 +02:00
|
|
|
native_priority = THREAD_PRIORITY_BELOW_NORMAL;
|
2017-10-31 23:49:54 +01:00
|
|
|
|
|
|
|
if (!SetThreadPriority(_this_thread, native_priority))
|
|
|
|
{
|
|
|
|
LOG_ERROR(GENERAL, "SetThreadPriority() failed: 0x%x", GetLastError());
|
2017-06-24 17:36:49 +02:00
|
|
|
}
|
2017-10-31 23:49:54 +01:00
|
|
|
#else
|
|
|
|
int policy;
|
|
|
|
struct sched_param param;
|
|
|
|
|
|
|
|
pthread_getschedparam(pthread_self(), &policy, ¶m);
|
2017-06-24 17:36:49 +02:00
|
|
|
|
2017-10-31 23:49:54 +01:00
|
|
|
if (priority > 0)
|
|
|
|
param.sched_priority = sched_get_priority_max(policy);
|
|
|
|
if (priority < 0)
|
|
|
|
param.sched_priority = sched_get_priority_min(policy);
|
|
|
|
|
|
|
|
if (int err = pthread_setschedparam(pthread_self(), policy, ¶m))
|
|
|
|
{
|
|
|
|
LOG_ERROR(GENERAL, "pthraed_setschedparam() failed: %d", err);
|
|
|
|
}
|
2017-06-24 17:36:49 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2017-10-21 13:21:37 +02:00
|
|
|
void thread_ctrl::set_thread_affinity_mask(u16 mask)
|
2017-06-24 17:36:49 +02:00
|
|
|
{
|
|
|
|
#ifdef _WIN32
|
|
|
|
HANDLE _this_thread = GetCurrentThread();
|
2017-10-21 13:21:37 +02:00
|
|
|
SetThreadAffinityMask(_this_thread, (DWORD_PTR)mask);
|
2017-11-19 23:02:35 +01:00
|
|
|
#elif __APPLE__
|
2017-10-21 13:21:37 +02:00
|
|
|
thread_affinity_policy_data_t policy = { static_cast<integer_t>(mask) };
|
2017-11-19 23:02:35 +01:00
|
|
|
thread_port_t mach_thread = pthread_mach_thread_np(pthread_self());
|
|
|
|
thread_policy_set(mach_thread, THREAD_AFFINITY_POLICY, (thread_policy_t)&policy, 1);
|
Fixes from FreeBSD package (#3765)
* Thread: unbreak on BSDs after dbc9bdfe02ae
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 6bb3f1b4d75c
"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-20 22:56:25 +01:00
|
|
|
#elif defined(__linux__) || defined(__DragonFly__) || defined(__FreeBSD__)
|
2017-11-07 13:30:13 +01:00
|
|
|
cpu_set_t cs;
|
|
|
|
CPU_ZERO(&cs);
|
2017-10-21 13:21:37 +02:00
|
|
|
|
|
|
|
for (u32 core = 0; core < 16u; ++core)
|
|
|
|
{
|
|
|
|
if ((u32)mask & (1u << core))
|
|
|
|
{
|
|
|
|
CPU_SET(core, &cs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-07 13:30:13 +01:00
|
|
|
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cs);
|
2017-06-24 17:36:49 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2016-04-25 12:49:12 +02:00
|
|
|
named_thread::named_thread()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
named_thread::~named_thread()
|
|
|
|
{
|
2015-11-26 09:06:29 +01:00
|
|
|
}
|
2015-01-17 17:14:58 +01:00
|
|
|
|
2016-02-01 22:55:43 +01:00
|
|
|
std::string named_thread::get_name() const
|
2015-11-26 09:06:29 +01:00
|
|
|
{
|
|
|
|
return fmt::format("('%s') Unnamed Thread", typeid(*this).name());
|
|
|
|
}
|
2013-06-30 10:46:29 +02:00
|
|
|
|
2016-07-24 01:56:03 +02:00
|
|
|
void named_thread::start_thread(const std::shared_ptr<void>& _this)
|
2015-11-26 09:06:29 +01:00
|
|
|
{
|
2016-07-24 01:56:03 +02:00
|
|
|
// Ensure it's not called from the constructor and the correct object is passed
|
2016-08-14 21:41:01 +02:00
|
|
|
verify("named_thread::start_thread" HERE), _this.get() == this;
|
2015-01-04 22:46:31 +01:00
|
|
|
|
2015-11-26 09:06:29 +01:00
|
|
|
// Run thread
|
2016-07-27 23:43:22 +02:00
|
|
|
thread_ctrl::spawn(m_thread, get_name(), [this, _this]()
|
2015-11-26 09:06:29 +01:00
|
|
|
{
|
2014-09-11 21:18:19 +02:00
|
|
|
try
|
|
|
|
{
|
2016-01-12 22:57:16 +01:00
|
|
|
LOG_TRACE(GENERAL, "Thread started");
|
2017-04-23 22:09:27 +02:00
|
|
|
on_spawn();
|
2016-07-24 01:56:03 +02:00
|
|
|
on_task();
|
2016-01-12 22:57:16 +01:00
|
|
|
LOG_TRACE(GENERAL, "Thread ended");
|
2014-09-11 21:18:19 +02:00
|
|
|
}
|
2015-08-11 15:26:08 +02:00
|
|
|
catch (const std::exception& e)
|
2015-07-01 00:25:52 +02:00
|
|
|
{
|
2016-02-01 22:55:43 +01:00
|
|
|
LOG_FATAL(GENERAL, "%s thrown: %s", typeid(e).name(), e.what());
|
2015-08-11 15:26:08 +02:00
|
|
|
Emu.Pause();
|
2014-09-11 21:18:19 +02:00
|
|
|
}
|
2015-01-16 15:36:53 +01:00
|
|
|
|
2016-07-24 01:56:03 +02:00
|
|
|
on_exit();
|
2015-11-26 09:06:29 +01:00
|
|
|
});
|
2014-01-31 19:40:18 +01:00
|
|
|
}
|
2016-09-07 00:38:52 +02:00
|
|
|
|
|
|
|
task_stack::task_base::~task_base()
|
|
|
|
{
|
|
|
|
}
|