1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-21 18:22:33 +01:00
rpcs3/Utilities/Thread.cpp

3280 lines
76 KiB
C++
Raw Normal View History

#include "stdafx.h"
2020-10-30 21:26:22 +01:00
#include "Emu/System.h"
#include "Emu/Cell/SPUThread.h"
#include "Emu/Cell/PPUThread.h"
#include "Emu/Cell/lv2/sys_mmapper.h"
#include "Emu/Cell/lv2/sys_event.h"
#include "Emu/Cell/lv2/sys_process.h"
#include "Emu/RSX/RSXThread.h"
#include "Thread.h"
#include "Utilities/JIT.h"
#include <thread>
2021-03-29 22:05:24 +02:00
#include <cfenv>
2024-08-21 03:58:03 +02:00
#ifdef ARCH_ARM64
#include "Emu/CPU/Backends/AArch64/AArch64Signal.h"
#endif
#ifdef _WIN32
2016-08-06 14:09:44 +02:00
#include <Windows.h>
#include <Psapi.h>
#include <process.h>
2018-12-23 19:01:09 +01:00
#include <sysinfoapi.h>
#include "util/dyn_lib.hpp"
DYNAMIC_IMPORT_RENAME("Kernel32.dll", SetThreadDescriptionImport, "SetThreadDescription", HRESULT(HANDLE hThread, PCWSTR lpThreadDescription));
#else
2022-09-13 15:08:55 +02:00
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
2022-09-13 15:08:55 +02:00
#endif
2015-02-13 22:45:36 +01:00
#ifdef __APPLE__
2015-02-11 05:17:39 +01:00
#define _XOPEN_SOURCE
#define __USE_GNU
#include <mach/thread_act.h>
#include <mach/thread_policy.h>
2015-02-13 22:45:36 +01:00
#endif
#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
#include <errno.h>
#include <signal.h>
#ifndef __OpenBSD__
#include <ucontext.h>
#endif
#include <pthread.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <time.h>
#endif
#ifdef __linux__
#include <sys/syscall.h>
#include <sys/timerfd.h>
#include <unistd.h>
#endif
#if defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
# include <sys/sysctl.h>
# include <unistd.h>
# if defined(__DragonFly__) || defined(__FreeBSD__)
# include <sys/user.h>
# endif
# if defined(__OpenBSD__)
# include <sys/param.h>
# include <sys/proc.h>
# endif
# if defined(__NetBSD__)
# undef KERN_PROC
# define KERN_PROC KERN_PROC2
# define kinfo_proc kinfo_proc2
# endif
# if defined(__APPLE__)
# define KP_FLAGS kp_proc.p_flag
# elif defined(__DragonFly__)
# define KP_FLAGS kp_flags
# elif defined(__FreeBSD__)
# define KP_FLAGS ki_flag
# elif defined(__NetBSD__)
# define KP_FLAGS p_flag
# elif defined(__OpenBSD__)
# define KP_FLAGS p_psflags
# define P_TRACED PS_TRACED
# endif
#endif
#include "util/vm.hpp"
2020-03-07 10:29:23 +01:00
#include "util/logs.hpp"
#include "util/asm.hpp"
#include "util/v128.hpp"
#include "util/simd.hpp"
#include "util/sysinfo.hpp"
#include "Emu/Memory/vm_locking.h"
2020-03-28 15:25:39 +01:00
LOG_CHANNEL(sig_log, "SIG");
LOG_CHANNEL(sys_log, "SYS");
LOG_CHANNEL(vm_log, "VM");
thread_local u64 g_tls_fault_all = 0;
thread_local u64 g_tls_fault_rsx = 0;
thread_local u64 g_tls_fault_spu = 0;
thread_local u64 g_tls_wait_time = 0;
thread_local u64 g_tls_wait_fail = 0;
thread_local bool g_tls_access_violation_recovered = false;
extern thread_local std::string(*g_tls_log_prefix)();
// Report error and call std::abort(), defined in main.cpp
[[noreturn]] void report_fatal_error(std::string_view text, bool is_html = false, bool include_help_text = true);
std::string dump_useful_thread_info()
{
std::string result;
if (auto cpu = get_current_cpu_thread())
{
2023-07-09 07:45:15 +02:00
cpu->dump_all(result);
}
return result;
}
#ifndef _WIN32
bool IsDebuggerPresent()
{
#if defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
int mib[] = {
CTL_KERN,
KERN_PROC,
KERN_PROC_PID,
getpid(),
# if defined(__NetBSD__) || defined(__OpenBSD__)
sizeof(struct kinfo_proc),
1,
# endif
};
u_int miblen = std::size(mib);
struct kinfo_proc info;
2020-12-18 08:39:54 +01:00
usz size = sizeof(info);
if (sysctl(mib, miblen, &info, &size, NULL, 0))
{
return false;
}
return info.KP_FLAGS & P_TRACED;
#else
char buf[4096];
fs::file status_fd("/proc/self/status");
if (!status_fd)
{
std::fprintf(stderr, "Failed to open /proc/self/status\n");
return false;
}
const auto num_read = status_fd.read(buf, sizeof(buf) - 1);
if (num_read == 0 || num_read == umax)
{
std::fprintf(stderr, "Failed to read /proc/self/status (%d)\n", errno);
return false;
}
buf[num_read] = '\0';
std::string_view status = buf;
const auto found = status.find("TracerPid:");
if (found == umax)
{
std::fprintf(stderr, "Failed to find 'TracerPid:' in /proc/self/status\n");
return false;
}
for (const char* cp = status.data() + found + 10; cp <= status.data() + num_read; ++cp)
{
if (!std::isspace(*cp))
{
return std::isdigit(*cp) != 0 && *cp != '0';
}
}
return false;
#endif
}
#endif
bool is_debugger_present()
{
if (g_cfg.core.external_debugger)
return true;
return IsDebuggerPresent();
}
#if defined(ARCH_X64)
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,
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,
};
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], ...
X64OP_BEXTR,
};
static thread_local x64_reg_t s_tls_reg3{};
2020-12-18 08:39:54 +01:00
void decode_x64_reg_op(const u8* code, x64_op_t& out_op, x64_reg_t& out_reg, usz& out_size, usz& out_length)
{
// 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-02-15 13:31:42 +01:00
bool oso = false, lock = false, repne = false, repe = false;
enum : u8
{
LOCK = 0xf0,
REPNE = 0xf2,
REPE = 0xf3,
};
// check prefixes:
2015-02-15 13:31:42 +01:00
for (;; code++, out_length++)
{
switch (const u8 prefix = *code)
{
2015-02-15 13:31:42 +01:00
case LOCK: // group 1
{
if (lock)
{
sig_log.error("decode_x64_reg_op(%016llxh): LOCK prefix found twice", 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)
{
sig_log.error("decode_x64_reg_op(%016llxh): REPNE/REPNZ prefix found twice", 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)
{
sig_log.error("decode_x64_reg_op(%016llxh): REP/REPE/REPZ prefix found twice", 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;
}
case 0x2e: // group 2
case 0x36:
case 0x3e:
case 0x26:
case 0x64:
case 0x65:
{
2015-02-15 13:31:42 +01:00
if (pg2)
{
sig_log.error("decode_x64_reg_op(%016llxh): 0x%02x (group 2 prefix) found after 0x%02x", code - out_length, prefix, pg2);
}
else
{
2015-02-15 13:31:42 +01:00
pg2 = prefix; // probably, segment register
}
2015-02-15 13:31:42 +01:00
continue;
}
2015-02-15 13:31:42 +01:00
case 0x66: // group 3
{
if (oso)
{
sig_log.error("decode_x64_reg_op(%016llxh): operand-size override prefix found twice", 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
{
sig_log.error("decode_x64_reg_op(%016llxh): address-size override prefix found", 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;
}
default:
{
if ((prefix & 0xf0) == 0x40) // check REX prefix
{
if (rex)
{
sig_log.error("decode_x64_reg_op(%016llxh): 0x%02x (REX prefix) found after 0x%02x", code - out_length, prefix, rex);
}
2015-02-15 13:31:42 +01:00
else
{
2015-02-15 13:31:42 +01:00
rex = prefix;
}
continue;
}
}
}
break;
}
2015-02-15 13:31:42 +01:00
auto get_modRM_reg = [](const u8* code, const u8 rex) -> x64_reg_t
{
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
{
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
{
return x64_reg_t{((*code & 0x38) >> 3) + X64R_AL};
};
2020-12-18 08:39:54 +01:00
auto get_op_size = [](const u8 rex, const bool oso) -> usz
2015-02-15 13:31:42 +01:00
{
return rex & 8 ? 8 : (oso ? 2 : 4);
};
2020-12-18 08:39:54 +01:00
auto get_modRM_size = [](const u8* code) -> usz
{
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:
{
2021-04-14 21:44:37 +02:00
if (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:
{
2021-01-12 11:01:06 +01:00
switch (get_modRM_reg(code, 0))
2016-06-07 22:24:20 +02:00
{
//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:
{
2021-01-12 11:01:06 +01:00
switch (get_modRM_reg(code, 0))
2016-06-07 22:24:20 +02:00
{
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:
{
2021-01-12 11:01:06 +01:00
switch (get_modRM_reg(code, 0))
2016-06-07 22:24:20 +02:00
{
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-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-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-02-15 13:31:42 +01:00
case 0x89:
{
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-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;
}
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;
s_tls_reg3 = x64_reg_t{vreg};
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;
}
}
if (vopm == 0x2) switch (vop1) // Implied leading bytes 0x0F 0x38
{
case 0xf7:
{
if (!repe && !repne && vlen == 16) // BEXTR r32,mem,r32
{
out_op = X64OP_BEXTR;
out_reg = get_modRM_reg_xmm(code, rex);
out_size = opx & 0x80 ? 8 : 4;
out_length += get_modRM_size(code);
return;
}
break;
}
}
break;
}
2015-02-15 13:31:42 +01:00
case 0xc6:
{
2016-06-07 22:24:20 +02:00
if (!lock && !oso && get_modRM_reg(code, 0) == 0) // MOV r8/m8, imm8
{
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;
return;
}
2015-02-15 13:31:42 +01:00
break;
}
2015-02-15 13:31:42 +01:00
case 0xc7:
{
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;
}
2016-06-22 23:39:39 +02:00
case 0xf6:
{
2021-01-12 11:01:06 +01:00
switch (get_modRM_reg(code, 0))
2016-06-22 23:39:39 +02:00
{
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:
{
2021-01-12 11:01:06 +01:00
switch (get_modRM_reg(code, 0))
2016-06-22 23:39:39 +02:00
{
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-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;
}
#ifdef _WIN32
2015-01-18 14:57:39 +01:00
typedef CONTEXT x64_context;
typedef CONTEXT ucontext_t;
2015-01-18 14:57:39 +01:00
2015-02-17 01:08:23 +01:00
#define X64REG(context, reg) (&(&(context)->Rax)[reg])
#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))
#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
2020-12-18 09:43:50 +01:00
u64* darwin_x64reg(x64_context *context, int reg)
2015-02-11 05:17:39 +01:00
{
2015-02-13 21:24:18 +01:00
auto *state = &context->uc_mcontext->__ss;
switch(reg)
{
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:
sig_log.error("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__
2019-12-04 21:56:19 +01:00
# define XMMREG(context, reg) (reinterpret_cast<v128*>((reinterpret_cast<union savefpu*>(context)->uc_mcontext.mc_fpregs)->sv_xmm.sv_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
#else
2019-12-04 21:56:19 +01:00
# define XMMREG(context, reg) (reinterpret_cast<v128*>((reinterpret_cast<struct savefpu*>(context)->uc_mcontext.mc_fpstate)->sv_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
#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:
sig_log.error("Invalid register index: %d", 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
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;
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
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:
sig_log.error("Invalid register index: %d", 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
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
2018-12-30 02:12:01 +01:00
static const int reg_table[] =
{
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
#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))
2020-12-18 08:39:54 +01:00
bool get_x64_reg_value(x64_context* context, x64_reg_t reg, usz d_size, usz i_size, u64& out_value)
2015-02-15 18:13:06 +01:00
{
// 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 = static_cast<u8>(reg_value); return true;
case 2: out_value = static_cast<u16>(reg_value); return true;
case 4: out_value = static_cast<u32>(reg_value); return true;
2015-02-15 18:13:06 +01:00
case 8: out_value = reg_value; return true;
}
}
else if (reg - X64R_AL < 4 && d_size == 1)
{
out_value = static_cast<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 = static_cast<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)
{
// load the immediate value (assuming it's at the end of the instruction)
const s8 imm_value = *reinterpret_cast<s8*>(RIP(context) + i_size - 1);
2015-02-19 21:38:25 +01:00
switch (d_size)
{
case 1: out_value = static_cast<u8>(imm_value); return true;
case 2: out_value = static_cast<u16>(imm_value); return true; // sign-extended
case 4: out_value = static_cast<u32>(imm_value); return true; // sign-extended
case 8: out_value = static_cast<u64>(imm_value); return true; // sign-extended
2015-02-19 21:38:25 +01:00
}
}
else if (reg == X64_IMM16)
{
const s16 imm_value = *reinterpret_cast<s16*>(RIP(context) + i_size - 2);
2015-02-19 21:38:25 +01:00
switch (d_size)
{
case 2: out_value = static_cast<u16>(imm_value); return true;
2015-02-19 21:38:25 +01:00
}
}
2015-02-15 18:13:06 +01:00
else if (reg == X64_IMM32)
{
const s32 imm_value = *reinterpret_cast<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 = static_cast<u32>(imm_value); return true;
case 8: out_value = static_cast<u64>(imm_value); return true; // sign-extended
2015-02-15 18:13:06 +01:00
}
}
else if (reg == X64R_ECX)
{
out_value = static_cast<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
sig_log.error("get_x64_reg_value(): invalid arguments (reg=%d, d_size=%lld, i_size=%lld)", +reg, d_size, i_size);
2015-02-15 18:13:06 +01:00
return false;
}
2020-12-18 08:39:54 +01:00
bool put_x64_reg_value(x64_context* context, x64_reg_t reg, usz d_size, u64 value)
2015-02-15 18:13:06 +01:00
{
// 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)
{
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
}
sig_log.error("put_x64_reg_value(): invalid destination (reg=%d, d_size=%lld, value=0x%llx)", +reg, d_size, value);
2015-02-15 18:13:06 +01:00
return false;
}
2020-12-18 08:39:54 +01:00
bool set_x64_cmp_flags(x64_context* context, usz 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: sig_log.error("set_x64_cmp_flags(): invalid d_size (%lld)", d_size); return false;
2015-02-17 01:08:23 +01:00
}
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 = static_cast<u8>(diff) ^ (static_cast<u8>(diff) >> 4);
2015-02-17 01:08:23 +01:00
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;
}
2020-12-18 08:39:54 +01:00
usz get_x64_access_size(x64_context* context, x64_op_t op, x64_reg_t reg, usz d_size, usz 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
{
// 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
{
2021-02-17 20:58:10 +01:00
u64 counter = 1;
2015-02-17 16:27:15 +01:00
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
}
#elif defined(ARCH_ARM64)
#if defined(__APPLE__)
// https://github.com/bombela/backward-cpp/issues/200
#define RIP(context) ((context)->uc_mcontext->__ss.__pc)
#elif defined(__FreeBSD__)
#define RIP(context) ((context)->uc_mcontext.mc_gpregs.gp_elr)
#elif defined(__NetBSD__)
#define RIP(context) ((context)->uc_mcontext.__gregs[_REG_PC])
#elif defined(__OpenBSD__)
#define RIP(context) ((context)->sc_elr)
#else
#define RIP(context) ((context)->uc_mcontext.pc)
#endif
#endif /* ARCH_ */
namespace rsx
{
extern std::function<bool(u32 addr, bool is_writing)> g_access_violation_handler;
}
bool handle_access_violation(u32 addr, bool is_writing, ucontext_t* context) noexcept
2015-01-18 14:57:39 +01:00
{
g_tls_fault_all++;
2017-03-13 11:35:20 +01:00
const auto cpu = get_current_cpu_thread();
struct spu_unsavable
{
spu_thread* _spu;
spu_unsavable(cpu_thread* cpu) noexcept
: _spu(cpu ? cpu->try_get<spu_thread>() : nullptr)
{
if (_spu)
{
if (_spu->unsavable)
{
_spu = nullptr;
}
else
{
// Must not be saved inside access violation handler because it is unpredictable
_spu->unsavable = true;
}
}
}
~spu_unsavable() noexcept
{
if (_spu)
{
_spu->unsavable = false;
}
}
} spu_protection{cpu};
2022-08-31 19:56:23 +02:00
if (addr < RAW_SPU_BASE_ADDR && vm::check_addr(addr) && rsx::g_access_violation_handler)
{
bool state_changed = false;
if (cpu)
2017-03-13 11:35:20 +01:00
{
state_changed = vm::temporary_unlock(*cpu);
}
bool handled = rsx::g_access_violation_handler(addr, is_writing);
2017-03-13 11:35:20 +01:00
if (state_changed && (cpu->state += cpu_flag::temp, cpu->test_stopped()))
{
//
}
if (handled)
{
g_tls_fault_rsx++;
return true;
}
}
#if defined(ARCH_X64)
const u8* const code = reinterpret_cast<u8*>(RIP(context));
2015-02-15 18:13:06 +01:00
2015-02-15 13:31:42 +01:00
x64_op_t op;
x64_reg_t reg;
2020-12-18 08:39:54 +01:00
usz d_size;
usz 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)
{
be_t<v128> dump;
std::memcpy(&dump, code, sizeof(dump));
sig_log.error("decode_x64_reg_op(%p): unsupported opcode: %s", code, dump);
2015-07-28 18:01:07 +02:00
}
};
if (0x1'0000'0000ull - addr < d_size)
2015-02-16 02:53:53 +01:00
{
sig_log.error("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
2020-12-18 08:39:54 +01:00
usz a_size = get_x64_access_size(context, op, reg, d_size, i_size);
2015-02-16 02:53:53 +01:00
if (0x1'0000'0000ull - addr < a_size)
2015-02-17 01:08:23 +01:00
{
sig_log.error("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
do if (addr - RAW_SPU_BASE_ADDR < (6 * RAW_SPU_OFFSET) && (addr % RAW_SPU_OFFSET) >= RAW_SPU_PROB_OFFSET)
{
auto thread = idm::get<named_thread<spu_thread>>(spu_thread::find_raw_spu((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
{
break;
2015-03-04 22:51:14 +01:00
}
if (!a_size || !d_size || !i_size)
2015-02-15 13:31:42 +01:00
{
sig_log.error("Invalid or unsupported instruction (op=%d, reg=%d, d_size=%lld, a_size=0x%llx, i_size=%lld)", +op, +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
}
if (a_size != 4)
{
// Might be unimplemented, such as writing MFC proxy EAL+EAH using 64-bit store
break;
}
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 = stx::se_storage<u32>::swap(value);
2016-06-22 23:39:39 +02:00
}
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_BEXTR:
{
u32 value;
if (is_writing || !thread->read_reg(addr, value))
{
return false;
}
value = stx::se_storage<u32>::swap(value);
u64 ctrl;
if (!get_x64_reg_value(context, s_tls_reg3, d_size, i_size, ctrl))
{
return false;
}
u8 start = ctrl & 0xff;
u8 _len = (ctrl & 0xff00) >> 8;
if (_len > 32)
_len = 32;
if (start > 32)
start = 32;
value = (u64{value} >> start) & ~(u64{umax} << _len);
if (!put_x64_reg_value(context, reg, d_size, value) || !set_x64_cmp_flags(context, d_size, value, 0))
{
return false;
}
break;
}
2015-01-18 14:57:39 +01:00
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;
}
u32 val32 = static_cast<u32>(reg_value);
if (!thread->write_reg(addr, op == X64OP_STORE ? stx::se_storage<u32>::swap(val32) : val32))
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:
{
sig_log.error("Invalid or unsupported operation (op=%d, reg=%d, d_size=%lld, i_size=%lld)", +op, +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;
g_tls_fault_spu++;
2015-02-17 01:08:23 +01:00
return true;
} while (0);
#else
static_cast<void>(context);
#endif /* ARCH_ */
2015-02-17 01:08:23 +01:00
2020-11-11 12:03:03 +01:00
if (vm::check_addr(addr, is_writing ? vm::page_writable : vm::page_readable))
2017-03-11 00:14:48 +01:00
{
return true;
}
// Hack: allocate memory in case the emulator is stopping
const auto hack_alloc = [&]()
{
g_tls_access_violation_recovered = true;
if (vm::check_addr(addr, is_writing ? vm::page_writable : vm::page_readable))
{
return true;
}
const auto area = vm::reserve_map(vm::any, addr & -0x10000, 0x10000);
if (!area)
{
return false;
}
if (vm::writer_lock mlock; area->flags & vm::preallocated || vm::check_addr(addr, 0))
{
// For allocated memory with protection lower than required (such as protection::no or read-only while writing to it)
utils::memory_protect(vm::base(addr & -0x1000), 0x1000, utils::protection::rw);
return true;
}
return area->falloc(addr & -0x10000, 0x10000) || vm::check_addr(addr, is_writing ? vm::page_writable : vm::page_readable);
};
if (cpu && (cpu->get_class() == thread_class::ppu || cpu->get_class() == thread_class::spu))
{
2020-05-21 11:46:49 +02:00
vm::temporary_unlock(*cpu);
u32 pf_port_id = 0;
2021-03-02 12:59:19 +01:00
if (auto& pf_entries = g_fxo->get<page_fault_notification_entries>(); true)
{
if (auto mem = vm::get(vm::any, addr))
{
2021-03-02 12:59:19 +01:00
reader_lock lock(pf_entries.mutex);
2021-03-02 12:59:19 +01:00
for (const auto& entry : pf_entries.entries)
{
if (entry.start_addr == mem->addr)
{
pf_port_id = entry.port_id;
break;
}
}
}
}
if (auto pf_port = idm::get<lv2_obj, lv2_event_port>(pf_port_id); pf_port && pf_port->queue)
{
// 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.
u64 data1 = addr;
2021-02-17 20:58:10 +01:00
u64 data2 = 0;
2021-05-20 06:00:22 +02:00
if (cpu->try_get<ppu_thread>())
{
data2 = (SYS_MEMORY_PAGE_FAULT_TYPE_PPU_THREAD << 32) | cpu->id;
}
2021-05-20 06:00:22 +02:00
else if (auto spu = cpu->try_get<spu_thread>())
{
2021-05-20 06:00:22 +02:00
const u64 type = spu->get_type() == spu_type::threaded ?
2019-12-10 17:17:03 +01:00
SYS_MEMORY_PAGE_FAULT_TYPE_SPU_THREAD :
SYS_MEMORY_PAGE_FAULT_TYPE_RAW_SPU;
2021-05-20 06:00:22 +02:00
data2 = (type << 32) | spu->lv2_id;
}
u64 data3;
{
vm::writer_lock rlock;
2020-11-11 12:03:03 +01:00
if (vm::check_addr(addr, is_writing ? vm::page_writable : vm::page_readable))
{
// Memory was allocated inbetween, retry
return true;
}
2020-11-11 12:03:03 +01:00
else if (vm::check_addr(addr))
{
data3 = SYS_MEMORY_PAGE_FAULT_CAUSE_READ_ONLY; // TODO
}
else
{
data3 = SYS_MEMORY_PAGE_FAULT_CAUSE_NON_MAPPED;
}
}
// Now, place the page fault event onto table so that other functions [sys_mmapper_free_address and pagefault recovery funcs etc]
// know that this thread is page faulted and where.
2021-03-02 12:59:19 +01:00
auto& pf_events = g_fxo->get<page_fault_event_entries>();
// De-schedule
if (cpu->get_class() == thread_class::ppu)
{
cpu->state -= cpu_flag::signal; // Cannot use check_state here and signal must be removed if exists
lv2_obj::sleep(*cpu);
}
auto send_event = [&]() -> error_code
{
lv2_obj::notify_all_t notify_later{};
2021-03-02 12:59:19 +01:00
std::lock_guard pf_lock(pf_events.pf_mutex);
if (auto error = pf_port->queue->send(pf_port->name ? pf_port->name : ((u64{process_getpid() + 0u} << 32) | u64{pf_port_id}), data1, data2, data3))
{
return error;
}
2021-03-02 12:59:19 +01:00
pf_events.events.emplace(cpu, addr);
return {};
};
sig_log.warning("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");
if (cpu->get_class() == thread_class::ppu)
{
if (const auto func = static_cast<ppu_thread*>(cpu)->current_function)
{
sig_log.warning("Page_fault while in function %s", func);
}
}
error_code sending_error = not_an_error(CELL_EBUSY);
2018-02-09 13:24:46 +01:00
// If we fail due to being busy, wait a bit and try again.
2024-08-16 19:06:20 +02:00
for (u64 sleep_until = get_system_time(); static_cast<u32>(sending_error) == CELL_EBUSY; thread_ctrl::wait_until(&sleep_until, 1000))
{
sending_error = send_event();
if (cpu->is_stopped())
{
sending_error = {};
break;
}
}
if (sending_error)
{
2021-01-27 16:50:39 +01:00
vm_log.error("Unknown error 0x%x while trying to pass page fault.", +sending_error);
return false;
}
else
{
// Wait until the thread is recovered
while (auto state = cpu->state.fetch_sub(cpu_flag::signal))
{
if (is_stopped(state) || state & cpu_flag::signal)
{
break;
}
thread_ctrl::wait_on(cpu->state, state);
}
}
// Reschedule, test cpu state and try recovery if stopped
if (cpu->test_stopped() && !hack_alloc())
{
2021-01-27 16:50:39 +01:00
return false;
}
return true;
}
if (cpu->get_class() == thread_class::spu)
{
if (!g_tls_access_violation_recovered)
{
vm_log.notice("\n%s", dump_useful_thread_info());
vm_log.always()("[%s] Access violation %s location 0x%x (%s)", cpu->get_name(), is_writing ? "writing" : "reading", addr, (is_writing && vm::check_addr(addr)) ? "read-only memory" : "unmapped memory");
}
// TODO:
// RawSPU: Send appropriate interrupt
// SPUThread: Send sys_spu exception event
cpu->state += cpu_flag::dbg_pause;
if (cpu->check_state() && !hack_alloc())
{
2021-01-27 16:50:39 +01:00
return false;
}
return true;
}
else
{
if (auto last_func = static_cast<ppu_thread*>(cpu)->current_function)
{
ppu_log.fatal("Function aborted: %s", last_func);
}
lv2_obj::sleep(*cpu);
}
}
if (cpu)
{
cpu->state += cpu_flag::wait;
}
Emu.Pause(true);
if (!g_tls_access_violation_recovered)
{
vm_log.notice("\n%s", dump_useful_thread_info());
}
// Note: a thread may access violate more than once after hack_alloc recovery
// Do not log any further access violations in this case.
if (!g_tls_access_violation_recovered)
{
vm_log.fatal("Access violation %s location 0x%x (%s)", is_writing ? "writing" : (cpu && cpu->get_class() == thread_class::ppu && cpu->get_pc() == addr ? "executing" : "reading"), addr, (is_writing && vm::check_addr(addr)) ? "read-only memory" : "unmapped memory");
}
while (Emu.IsPaused())
{
thread_ctrl::wait();
}
if (Emu.IsStopped() && !hack_alloc())
{
2021-01-27 16:50:39 +01:00
return false;
}
return true;
2015-01-18 14:57:39 +01:00
}
static void append_thread_name(std::string& msg)
{
if (thread_ctrl::get_current())
{
fmt::append(msg, "Emu Thread Name: '%s'.\n", thread_ctrl::get_name());
}
else if (thread_ctrl::is_main())
{
2021-03-15 16:38:07 +01:00
fmt::append(msg, "Thread: Main Thread.\n");
}
else
{
fmt::append(msg, "Thread id = %u.\n", thread_ctrl::get_tid());
}
}
2015-12-16 15:20:46 +01:00
#ifdef _WIN32
2020-02-08 17:35:13 +01:00
static LONG exception_handler(PEXCEPTION_POINTERS pExp) noexcept
2015-02-07 00:39:51 +01:00
{
if (pExp->ExceptionRecord->ExceptionCode == EXCEPTION_BREAKPOINT)
{
return EXCEPTION_CONTINUE_SEARCH;
}
const auto ptr = reinterpret_cast<u8*>(pExp->ExceptionRecord->ExceptionInformation[1]);
const bool is_writing = pExp->ExceptionRecord->ExceptionInformation[0] == 1;
const bool is_executing = pExp->ExceptionRecord->ExceptionInformation[0] == 8;
2015-02-07 00:39:51 +01:00
if (pExp->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && !is_executing)
2015-02-07 00:39:51 +01:00
{
u32 addr = 0;
if (auto [addr0, ok] = vm::try_get_addr(ptr); ok)
2016-02-01 22:55:43 +01:00
{
addr = addr0;
}
else if (const usz exec64 = (ptr - vm::g_exec_addr) / 2; exec64 <= u32{umax})
{
addr = static_cast<u32>(exec64);
}
else
{
return EXCEPTION_CONTINUE_SEARCH;
2016-02-01 22:55:43 +01:00
}
if (thread_ctrl::get_current() && handle_access_violation(addr, is_writing, pExp->ContextRecord))
{
return EXCEPTION_CONTINUE_EXECUTION;
}
}
2015-02-07 00:39:51 +01:00
switch (pExp->ExceptionRecord->ExceptionCode)
{
case EXCEPTION_ACCESS_VIOLATION:
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
case EXCEPTION_DATATYPE_MISALIGNMENT:
case EXCEPTION_ILLEGAL_INSTRUCTION:
case EXCEPTION_IN_PAGE_ERROR:
case EXCEPTION_INT_DIVIDE_BY_ZERO:
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
case EXCEPTION_PRIV_INSTRUCTION:
//case EXCEPTION_STACK_OVERFLOW:
{
sys_log.notice("\n%s", dump_useful_thread_info());
logs::listener::sync_all();
break;
}
default:
{
break;
}
}
return EXCEPTION_CONTINUE_SEARCH;
}
static LONG exception_filter(PEXCEPTION_POINTERS pExp) noexcept
{
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] == 8 ? "executing" :
pExp->ExceptionRecord->ExceptionInformation[0] == 1 ? "writing" : "reading";
2015-07-01 00:25:52 +02:00
fmt::append(msg, "Segfault %s location %p at %p.\n", cause, pExp->ExceptionRecord->ExceptionInformation[1], pExp->ExceptionRecord->ExceptionAddress);
2015-12-16 15:20:46 +01:00
}
else
{
fmt::append(msg, "Exception address: %p.\n", pExp->ExceptionRecord->ExceptionAddress);
2015-12-16 15:20:46 +01:00
for (DWORD i = 0; i < pExp->ExceptionRecord->NumberParameters; i++)
{
fmt::append(msg, "ExceptionInformation[0x%x]: %p.\n", i, pExp->ExceptionRecord->ExceptionInformation[i]);
2015-12-16 15:20:46 +01:00
}
}
append_thread_name(msg);
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;
}
}
#if defined(ARCH_X64)
const auto exec_addr = pExp->ContextRecord->Rip;
#elif defined(ARCH_ARM64)
const auto exec_addr = pExp->ContextRecord->Pc;
#else
#error "Unimplemented exception handling for this architecture"
#endif
2024-09-07 17:20:25 +02:00
fmt::append(msg, "Instruction address: %p.\n", exec_addr);
2016-08-06 14:09:44 +02:00
DWORD64 unwind_base;
2024-09-07 17:20:25 +02:00
if (const auto rtf = RtlLookupFunctionEntry(exec_addr, &unwind_base, nullptr))
2016-08-06 14:09:44 +02:00
{
// Get function address
const DWORD64 func_addr = rtf->BeginAddress + unwind_base;
fmt::append(msg, "Function address: %p (base+0x%x).\n", func_addr, rtf->BeginAddress);
2016-08-06 14:09:44 +02:00
// Access UNWIND_INFO structure
//const auto uw = (u8*)(unwind_base + rtf->UnwindData);
}
for (HMODULE _module : modules)
2016-08-06 14:09:44 +02:00
{
MODULEINFO info;
if (GetModuleInformation(GetCurrentProcess(), _module, &info, sizeof(info)))
2016-08-06 14:09:44 +02:00
{
const DWORD64 base = reinterpret_cast<DWORD64>(info.lpBaseOfDll);
2016-08-06 14:09:44 +02:00
2024-09-07 17:20:25 +02:00
if (exec_addr >= base && exec_addr < base + info.SizeOfImage)
2016-08-06 14:09:44 +02:00
{
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);
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;
}
}
fmt::append(msg, "Module name: '%s'.\n", module_name);
fmt::append(msg, "Module base: %p.\n", info.lpBaseOfDll);
2016-08-06 14:09:44 +02:00
}
}
}
fmt::append(msg, "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
sys_log.fatal("\n%s", msg);
logs::listener::sync_all();
2021-01-27 16:50:39 +01:00
thread_ctrl::emergency_exit(msg);
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
{
2023-04-12 23:47:14 +02:00
#ifdef USE_ASAN
if (!AddVectoredExceptionHandler(FALSE, static_cast<PVECTORED_EXCEPTION_HANDLER>(exception_handler)))
2023-04-12 23:47:14 +02:00
#else
if (!AddVectoredExceptionHandler(1, static_cast<PVECTORED_EXCEPTION_HANDLER>(exception_handler)))
2023-04-12 23:47:14 +02:00
#endif
2016-01-06 00:52:48 +01:00
{
report_fatal_error("AddVectoredExceptionHandler() failed.");
}
if (!SetUnhandledExceptionFilter(static_cast<LPTOP_LEVEL_EXCEPTION_FILTER>(exception_filter)))
{
report_fatal_error("SetUnhandledExceptionFilter() failed.");
}
2016-01-06 00:52:48 +01:00
return true;
}();
2015-07-01 00:25:52 +02:00
#else
2021-03-05 20:05:37 +01:00
static void signal_handler(int /*sig*/, siginfo_t* info, void* uct) noexcept
{
ucontext_t* context = static_cast<ucontext_t*>(uct);
2015-02-11 05:17:39 +01:00
#if defined(ARCH_X64)
2015-02-11 05:17:39 +01:00
#ifdef __APPLE__
const u64 err = context->uc_mcontext->__es.__err;
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 u64 err = context->uc_mcontext.mc_err;
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(__OpenBSD__)
const u64 err = context->sc_err;
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(__NetBSD__)
const u64 err = context->uc_mcontext.__gregs[_REG_ERR];
2015-02-11 05:17:39 +01:00
#else
const u64 err = context->uc_mcontext.gregs[REG_ERR];
2015-02-11 05:17:39 +01:00
#endif
2015-02-08 14:38:08 +01:00
const bool is_executing = err & 0x10;
const bool is_writing = err & 0x2;
#elif defined(ARCH_ARM64)
const bool is_executing = uptr(info->si_addr) == uptr(RIP(context));
2024-08-21 03:58:03 +02:00
2024-08-24 01:09:22 +02:00
#if defined(__linux__) || defined(__APPLE__)
2024-08-21 03:58:03 +02:00
// Current CPU state decoder is reverse-engineered from the linux kernel and may not work on other platforms.
const auto decoded_reason = aarch64::decode_fault_reason(context);
const bool is_writing = (decoded_reason == aarch64::fault_reason::data_write);
if (decoded_reason != aarch64::fault_reason::data_write &&
decoded_reason != aarch64::fault_reason::data_read)
{
// We don't expect other classes of exceptions during normal executions
sig_log.warning("Unexpected fault. Reason: %d", static_cast<int>(decoded_reason));
}
#else
2024-08-24 01:09:22 +02:00
const u32 insn = is_executing ? 0 : *reinterpret_cast<u32*>(RIP(context));
2024-08-20 03:30:57 +02:00
const bool is_writing =
(insn & 0xbfff0000) == 0x0c000000 || // STR <Wt>, [<Xn>, #<imm>] (store word with immediate offset)
(insn & 0xbfe00000) == 0x0c800000 || // STP <Wt1>, <Wt2>, [<Xn>, #<imm>] (store pair of registers with immediate offset)
(insn & 0xbfdf0000) == 0x0d000000 || // STR <Wt>, [<Xn>, <Xm>] (store word with register offset)
(insn & 0xbfc00000) == 0x0d800000 || // STP <Wt1>, <Wt2>, [<Xn>, <Xm>] (store pair of registers with register offset)
(insn & 0x3f400000) == 0x08000000 || // STR <Vd>, [<Xn>, #<imm>] (store SIMD/FP register with immediate offset)
(insn & 0x3bc00000) == 0x39000000 || // STR <Wt>, [<Xn>, #<imm>] (store word with immediate offset)
(insn & 0x3fc00000) == 0x3d800000 || // STR <Vd>, [<Xn>, <Xm>] (store SIMD/FP register with register offset)
(insn & 0x3bc00000) == 0x38000000 || // STR <Wt>, [<Xn>, <Xm>] (store word with register offset)
(insn & 0x3fe00000) == 0x3c800000 || // STUR <Vd>, [<Xn>, #<imm>] (store unprivileged register with immediate offset)
(insn & 0x3fe00000) == 0x3ca00000 || // STR <Vd>, [<Xn>, #<imm>] (store SIMD/FP register with immediate offset)
(insn & 0x3a400000) == 0x28000000 || // STP <Wt1>, <Wt2>, [<Xn>, #<imm>] (store pair of registers with immediate offset)
2024-08-21 03:58:03 +02:00
(insn & 0xbf000000) == 0xad000000 || // STP <Vd1>, <Vd2>, [<Xn>, #<imm>] (store SIMD/FP 128-bit register pair with immediate offset)
(insn & 0xbf000000) == 0x6d000000; // STP <Dd1>, <Dd2>, [<Xn>, #<imm>] (store SIMD/FP 64-bit register pair with immediate offset)
#endif
#else
#error "signal_handler not implemented"
#endif
const u64 exec64 = (reinterpret_cast<u64>(info->si_addr) - reinterpret_cast<u64>(vm::g_exec_addr)) / 2;
const auto cause = is_executing ? "executing" : is_writing ? "writing" : "reading";
2015-12-16 15:20:46 +01:00
if (auto [addr, ok] = vm::try_get_addr(info->si_addr); ok && !is_executing)
{
2015-12-16 15:20:46 +01:00
// Try to process access violation
if (thread_ctrl::get_current() && handle_access_violation(addr, is_writing, context))
{
return;
}
}
if (exec64 < 0x100000000ull && !is_executing)
{
if (thread_ctrl::get_current() && handle_access_violation(static_cast<u32>(exec64), is_writing, context))
{
return;
}
}
std::string msg = fmt::format("Segfault %s location %p at %p.\n", cause, info->si_addr, RIP(context));
append_thread_name(msg);
sys_log.fatal("\n%s", msg);
sys_log.notice("\n%s", dump_useful_thread_info());
logs::listener::sync_all();
if (IsDebuggerPresent())
{
// Convert to SIGTRAP
raise(SIGTRAP);
return;
}
2021-01-27 16:50:39 +01:00
thread_ctrl::emergency_exit(msg);
}
static void sigill_handler(int /*sig*/, siginfo_t* info, void* /*uct*/) noexcept
{
std::string msg = fmt::format("Illegal instruction at %p (%s).\n", info->si_addr, *reinterpret_cast<be_t<u128>*>(info->si_addr));
append_thread_name(msg);
sys_log.fatal("\n%s", msg);
sys_log.notice("\n%s", dump_useful_thread_info());
logs::listener::sync_all();
if (IsDebuggerPresent())
{
// Convert to SIGTRAP
raise(SIGTRAP);
return;
}
thread_ctrl::emergency_exit(msg);
}
void sigpipe_signaling_handler(int)
{
}
2016-02-01 22:55:43 +01:00
const bool s_exception_handler_set = []() -> bool
{
2016-01-06 00:52:48 +01:00
struct ::sigaction sa;
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)
{
std::fprintf(stderr, "sigaction(SIGSEGV) failed (%d).\n", errno);
2016-07-16 19:58:42 +02:00
std::abort();
}
#ifdef __APPLE__
if (::sigaction(SIGBUS, &sa, NULL) == -1)
{
std::fprintf(stderr, "sigaction(SIGBUS) failed (%d).\n", errno);
std::abort();
}
#endif
sa.sa_sigaction = sigill_handler;
if (::sigaction(SIGILL, &sa, NULL) == -1)
{
std::fprintf(stderr, "sigaction(SIGILL) failed (%d).\n", errno);
std::abort();
}
sa.sa_handler = sigpipe_signaling_handler;
if (::sigaction(SIGPIPE, &sa, NULL) == -1)
{
std::fprintf(stderr, "sigaction(SIGPIPE) failed (%d).\n", errno);
std::abort();
}
std::printf("Debugger: %d\n", +IsDebuggerPresent());
2016-01-06 00:52:48 +01:00
return true;
}();
#endif
const bool s_terminate_handler_set = []() -> bool
{
std::set_terminate([]()
{
if (IsDebuggerPresent())
{
logs::listener::sync_all();
utils::trap();
}
report_fatal_error("RPCS3 has abnormally terminated.");
});
return true;
}();
thread_local DECLARE(thread_ctrl::g_tls_this_thread) = nullptr;
thread_local DECLARE(thread_ctrl::g_tls_error_callback) = nullptr;
DECLARE(thread_ctrl::g_native_core_layout) { native_core_arrangement::undefined };
void thread_base::start()
{
m_sync.atomic_op([&](u32& v)
{
v &= ~static_cast<u32>(thread_state::mask);
v |= static_cast<u32>(thread_state::created);
});
#ifdef _WIN32
m_thread = ::_beginthreadex(nullptr, 0, entry_point, this, CREATE_SUSPENDED, nullptr);
ensure(m_thread);
ensure(::ResumeThread(reinterpret_cast<HANDLE>(+m_thread)) != static_cast<DWORD>(-1));
#elif defined(__APPLE__)
pthread_attr_t stack_size_attr;
pthread_attr_init(&stack_size_attr);
pthread_attr_setstacksize(&stack_size_attr, 0x800000);
ensure(pthread_create(reinterpret_cast<pthread_t*>(&m_thread.raw()), &stack_size_attr, entry_point, this) == 0);
#else
ensure(pthread_create(reinterpret_cast<pthread_t*>(&m_thread.raw()), nullptr, entry_point, this) == 0);
#endif
}
void thread_base::initialize(void (*error_cb)())
2015-07-01 00:25:52 +02:00
{
#ifndef _WIN32
m_thread.release(reinterpret_cast<u64>(pthread_self()));
#endif
// Initialize TLS variables
thread_ctrl::g_tls_this_thread = this;
thread_ctrl::g_tls_error_callback = error_cb;
g_tls_log_prefix = []
{
return thread_ctrl::get_name_cached();
};
atomic_wait_engine::set_wait_callback([](const void*, u64 attempts, u64 stamp0) -> bool
{
if (attempts == umax)
{
g_tls_wait_time += utils::get_tsc() - stamp0;
}
else if (attempts > 1)
{
g_tls_wait_fail += attempts - 1;
}
return true;
});
2020-11-12 21:24:35 +01:00
set_name(thread_ctrl::get_name_cached());
}
2020-11-12 21:24:35 +01:00
void thread_base::set_name(std::string name)
{
#ifdef _WIN32
if (SetThreadDescriptionImport)
{
SetThreadDescriptionImport(GetCurrentThread(), utf8_to_wchar(name).c_str());
}
#endif
#ifdef _MSC_VER
struct THREADNAME_INFO
{
DWORD dwType;
LPCSTR szName;
DWORD dwThreadID;
DWORD dwFlags;
};
// Set thread name for VS debugger
if (IsDebuggerPresent()) [&]() NEVER_INLINE
{
THREADNAME_INFO info;
info.dwType = 0x1000;
info.szName = 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
#if defined(__APPLE__)
2020-12-18 08:39:54 +01:00
name.resize(std::min<usz>(15, name.size()));
pthread_setname_np(name.c_str());
#elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
pthread_set_name_np(pthread_self(), name.c_str());
#elif defined(__NetBSD__)
pthread_setname_np(pthread_self(), "%s", name.data());
#elif !defined(_WIN32)
2020-12-18 08:39:54 +01:00
name.resize(std::min<usz>(15, name.size()));
pthread_setname_np(pthread_self(), name.c_str());
2018-03-11 17:30:44 +01:00
#endif
}
u64 thread_base::finalize(thread_state result_state) noexcept
{
// Report pending errors
error_code::error_report(0, nullptr, nullptr, nullptr, nullptr);
2015-11-26 09:06:29 +01:00
2016-05-13 16:01:48 +02:00
#ifdef _WIN32
static thread_local ULONG64 tls_cycles{};
static thread_local u64 tls_time{};
ULONG64 cycles{};
QueryThreadCycleTime(GetCurrentThread(), &cycles);
cycles -= tls_cycles;
tls_cycles += cycles;
FILETIME ctime, etime, ktime, utime;
GetThreadTimes(GetCurrentThread(), &ctime, &etime, &ktime, &utime);
const u64 time = ((ktime.dwLowDateTime | static_cast<u64>(ktime.dwHighDateTime) << 32) + (utime.dwLowDateTime | static_cast<u64>(utime.dwHighDateTime) << 32)) * 100ull - tls_time;
tls_time += time;
const u64 fsoft = 0;
const u64 fhard = 0;
const u64 ctxvol = 0;
const u64 ctxinv = 0;
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)
static thread_local u64 tls_time{}, tls_fsoft{}, tls_fhard{}, tls_ctxvol{}, tls_ctxinv{};
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 - tls_time;
tls_time += time;
const u64 fsoft = stats.ru_minflt - tls_fsoft;
tls_fsoft += fsoft;
const u64 fhard = stats.ru_majflt - tls_fhard;
tls_fhard += fhard;
const u64 ctxvol = stats.ru_nvcsw - tls_ctxvol;
tls_ctxvol += ctxvol;
const u64 ctxinv = stats.ru_nivcsw - tls_ctxinv;
tls_ctxinv += ctxinv;
#else
const u64 cycles = 0;
const u64 time = 0;
const u64 fsoft = 0;
const u64 fhard = 0;
const u64 ctxvol = 0;
const u64 ctxinv = 0;
#endif
2017-03-13 11:14:34 +01:00
g_tls_log_prefix = []
{
return thread_ctrl::get_name_cached();
2017-03-13 11:14:34 +01:00
};
2024-03-27 11:04:31 +01:00
const bool is_cpu_thread = !!cpu_thread::get_current();
auto& thread_log = (is_cpu_thread || g_tls_fault_all ? sig_log.notice : sig_log.trace);
thread_log("Thread time: %fs (%fGc); Faults: %u [rsx:%u, spu:%u]; [soft:%u hard:%u]; Switches:[vol:%u unvol:%u]; Wait:[%.3fs, spur:%u]",
time / 1000000000.,
cycles / 1000000000.,
g_tls_fault_all,
g_tls_fault_rsx,
g_tls_fault_spu,
fsoft, fhard, ctxvol, ctxinv,
g_tls_wait_time / (utils::get_tsc_freq() / 1.),
g_tls_wait_fail);
atomic_wait_engine::set_wait_callback(nullptr);
// Avoid race with the destructor
const u64 _self = m_thread;
// Set result state (errored or finalized)
m_sync.fetch_op([&](u32& v)
{
v &= -4;
v |= static_cast<u32>(result_state);
2021-01-12 11:01:06 +01:00
});
// Signal waiting threads
m_sync.notify_all();
return _self;
}
thread_base::native_entry thread_base::finalize(u64 _self) noexcept
{
g_tls_fault_all = 0;
g_tls_fault_rsx = 0;
g_tls_fault_spu = 0;
g_tls_wait_time = 0;
g_tls_wait_fail = 0;
g_tls_access_violation_recovered = false;
g_tls_log_prefix = []() -> std::string { return {}; };
if (_self == umax)
2020-11-12 21:24:35 +01:00
{
thread_ctrl::g_tls_this_thread = nullptr;
return nullptr;
2020-11-12 21:24:35 +01:00
}
#ifdef _WIN32
_endthreadex(0);
#else
pthread_exit(nullptr);
#endif
return nullptr;
}
thread_base::native_entry thread_base::make_trampoline(u64(*entry)(thread_base* _base))
{
return build_function_asm<native_entry>("", [&](native_asm& c, auto& args)
{
using namespace asmjit;
#if defined(ARCH_X64)
Label _ret = c.newLabel();
c.push(x86::rbp);
c.sub(x86::rsp, 0x20);
// Call entry point (TODO: support for detached threads missing?)
2022-01-17 17:24:53 +01:00
c.call(entry);
// Call finalize, return if zero
c.mov(args[0], x86::rax);
2022-01-17 17:24:53 +01:00
c.call(static_cast<native_entry(*)(u64)>(&finalize));
c.test(x86::rax, x86::rax);
c.jz(_ret);
// Otherwise, call it as an entry point with first arg = new current thread
c.mov(x86::rbp, x86::rax);
2022-01-17 17:24:53 +01:00
c.call(thread_ctrl::get_current);
c.mov(args[0], x86::rax);
c.add(x86::rsp, 0x28);
c.jmp(x86::rbp);
c.bind(_ret);
c.add(x86::rsp, 0x28);
c.ret();
#else
UNUSED(c);
UNUSED(args);
UNUSED(entry);
#endif
});
}
thread_state thread_ctrl::state()
{
auto _this = g_tls_this_thread;
// Guard for recursive calls (TODO: may be more effective to reuse one of m_sync bits)
static thread_local bool s_tls_exec = false;
// Drain execution queue
if (!s_tls_exec)
{
s_tls_exec = true;
_this->exec();
s_tls_exec = false;
}
return static_cast<thread_state>(_this->m_sync & 3);
}
2020-06-23 15:41:16 +02:00
void thread_ctrl::wait_for(u64 usec, [[maybe_unused]] bool alert /* true */)
2016-05-13 16:01:48 +02:00
{
if (!usec)
{
return;
}
auto _this = g_tls_this_thread;
2016-05-13 16:01:48 +02:00
if (!alert && usec > 50000)
{
usec = 50000;
}
#ifdef __linux__
static thread_local struct linux_timer_handle_t
{
2020-06-23 15:41:16 +02:00
// Allocate timer only if needed (i.e. someone calls wait_for with alert and short period)
const int m_timer = timerfd_create(CLOCK_MONOTONIC, 0);
linux_timer_handle_t() noexcept
{
if (m_timer == -1)
{
sig_log.error("Linux timer allocation failed, using the fallback instead.");
}
}
operator int() const
{
return m_timer;
}
~linux_timer_handle_t()
{
if (m_timer != -1)
{
close(m_timer);
}
}
} fd_timer;
if (!alert && fd_timer != -1)
{
struct itimerspec timeout;
u64 missed;
timeout.it_value.tv_nsec = usec % 1'000'000 * 1'000ull;
timeout.it_value.tv_sec = usec / 1'000'000;
timeout.it_interval.tv_sec = 0;
timeout.it_interval.tv_nsec = 0;
timerfd_settime(fd_timer, 0, &timeout, NULL);
if (read(fd_timer, &missed, sizeof(missed)) != sizeof(missed))
sig_log.error("timerfd: read() failed");
return;
}
#endif
if (alert)
{
if (_this->m_sync.bit_test_reset(2) || _this->m_taskq)
{
return;
}
}
// Wait for signal and thread state abort
atomic_wait::list<2> list{};
if (alert)
{
list.set<0>(_this->m_sync, 0);
list.set<1>(utils::bless<atomic_t<u32>>(&_this->m_taskq)[1], 0);
}
else
{
list.set<0>(_this->m_dummy, 0);
}
list.wait(atomic_wait_timeout{usec <= 0xffff'ffff'ffff'ffff / 1000 ? usec * 1000 : 0xffff'ffff'ffff'ffff});
}
2024-08-16 19:06:20 +02:00
void thread_ctrl::wait_until(u64* wait_time, u64 add_time, u64 min_wait, bool update_to_current_time)
{
*wait_time = utils::add_saturate<u64>(*wait_time, add_time);
// TODO: Implement proper support for "waiting until" inside atomic wait engine
const u64 current_time = get_system_time();
if (current_time > *wait_time)
{
if (update_to_current_time)
{
*wait_time = current_time + (add_time - (current_time - *wait_time) % add_time);
}
else if (!min_wait)
{
return;
}
}
if (min_wait)
{
*wait_time = std::max<u64>(*wait_time, utils::add_saturate<u64>(current_time, min_wait));
}
wait_for(*wait_time - current_time);
}
2020-06-23 15:41:16 +02:00
void thread_ctrl::wait_for_accurate(u64 usec)
{
if (!usec)
{
return;
}
if (usec > 50000)
{
fmt::throw_exception("thread_ctrl::wait_for_accurate: unsupported amount");
}
#ifdef __linux__
return wait_for(usec, false);
#else
2020-06-23 15:41:16 +02:00
using namespace std::chrono_literals;
const auto until = std::chrono::steady_clock::now() + 1us * usec;
while (true)
{
// Host scheduler quantum for windows (worst case)
constexpr u64 host_min_quantum = 500;
2020-06-23 15:41:16 +02:00
if (usec >= host_min_quantum)
{
// Wait on multiple of min quantum for large durations to avoid overloading low thread cpus
wait_for(usec - (usec % host_min_quantum), false);
}
// TODO: Determine best value for yield delay
else if (usec >= host_min_quantum / 2)
{
std::this_thread::yield();
}
else
{
busy_wait(100);
}
const auto current = std::chrono::steady_clock::now();
if (current >= until)
{
break;
}
usec = std::chrono::duration_cast<std::chrono::microseconds>(until - current).count();
2020-06-23 15:41:16 +02:00
}
#endif
2020-06-23 15:41:16 +02:00
}
std::string thread_ctrl::get_name_cached()
{
auto _this = thread_ctrl::g_tls_this_thread;
if (!_this)
{
return {};
}
static thread_local shared_ptr<std::string> name_cache;
if (!_this->m_tname.is_equal(name_cache)) [[unlikely]]
{
_this->m_tname.peek_op([&](const shared_ptr<std::string>& ptr)
{
if (ptr != name_cache)
{
name_cache = ptr;
}
});
}
return *name_cache;
}
2021-05-01 08:34:52 +02:00
thread_base::thread_base(native_entry entry, std::string name)
: entry_point(entry)
2021-05-01 08:34:52 +02:00
, m_tname(make_single_value(std::move(name)))
{
}
thread_base::~thread_base()
{
// Cleanup abandoned tasks: initialize default results and signal
this->exec();
// Cleanup
{
#ifdef _WIN32
const HANDLE handle0 = reinterpret_cast<HANDLE>(m_thread.load());
WaitForSingleObject(handle0, INFINITE);
CloseHandle(handle0);
#else
pthread_join(reinterpret_cast<pthread_t>(m_thread.load()), nullptr);
#endif
}
}
2020-12-16 09:07:02 +01:00
bool thread_base::join(bool dtor) const
{
2020-12-16 09:07:02 +01:00
// Check if already finished
if (m_sync & 2)
{
return (m_sync & 3) == 3;
}
// Hacked for too sleepy threads (1ms) TODO: make sure it's unneeded and remove
2020-12-16 09:07:02 +01:00
const auto timeout = dtor && Emu.IsStopped() ? atomic_wait_timeout{1'000'000} : atomic_wait_timeout::inf;
auto stamp0 = utils::get_tsc();
for (u64 i = 0; (m_sync & 3) <= 1; i++)
{
m_sync.wait(m_sync & ~2, timeout);
if (m_sync & 2)
{
break;
}
if (i >= 16 && !(i & (i - 1)) && timeout != atomic_wait_timeout::inf)
{
sig_log.error(u8"Thread [%s] is too sleepy. Waiting for it %.3fµs already!", *m_tname.load(), (utils::get_tsc() - stamp0) / (utils::get_tsc_freq() / 1000000.));
}
}
return (m_sync & 3) == 3;
}
void thread_base::notify()
{
// Set notification
m_sync |= 4;
m_sync.notify_all();
}
u64 thread_base::get_native_id() const
{
#ifdef _WIN32
return GetThreadId(reinterpret_cast<HANDLE>(m_thread.load()));
#else
return m_thread.load();
#endif
}
u64 thread_base::get_cycles()
{
u64 cycles = 0;
const u64 handle = m_thread;
#ifdef _WIN32
if (QueryThreadCycleTime(reinterpret_cast<HANDLE>(handle), &cycles))
{
2018-11-10 15:43:38 +01:00
#elif __APPLE__
mach_port_name_t port = pthread_mach_thread_np(reinterpret_cast<pthread_t>(handle));
2018-11-10 15:43:38 +01:00
mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT;
thread_basic_info_data_t info;
2019-12-04 21:56:19 +01:00
kern_return_t ret = thread_info(port, THREAD_BASIC_INFO, reinterpret_cast<thread_info_t>(&info), &count);
2018-11-10 15:43:38 +01:00
if (ret == KERN_SUCCESS)
{
cycles = static_cast<u64>(info.user_time.seconds + info.system_time.seconds) * 1'000'000'000 +
static_cast<u64>(info.user_time.microseconds + info.system_time.microseconds) * 1'000;
#else
clockid_t _clock;
struct timespec thread_time;
if (!pthread_getcpuclockid(reinterpret_cast<pthread_t>(handle), &_clock) && !clock_gettime(_clock, &thread_time))
{
cycles = static_cast<u64>(thread_time.tv_sec) * 1'000'000'000 + thread_time.tv_nsec;
#endif
if (const u64 old_cycles = m_cycles.exchange(cycles))
{
return cycles - old_cycles;
}
// Report 0 the first time this function is called
return 0;
}
else
{
return m_cycles;
}
}
void thread_base::push(shared_ptr<thread_future> task)
{
const auto next = &task->next;
m_taskq.push_head(*next, std::move(task));
m_taskq.notify_one();
}
void thread_base::exec()
{
if (!m_taskq) [[likely]]
{
return;
}
while (shared_ptr<thread_future> head = m_taskq.exchange(null_ptr))
{
// TODO: check if adapting reverse algorithm is feasible here
2023-04-26 21:39:26 +02:00
thread_future* prev_head{head.get()};
2023-04-26 21:39:26 +02:00
for (thread_future* prev{};;)
{
2023-04-26 21:39:26 +02:00
utils::prefetch_exec(prev_head->exec.load());
2023-04-26 21:39:26 +02:00
if (auto next = prev_head->next.get())
{
2023-04-26 21:39:26 +02:00
prev = std::exchange(prev_head, next);
prev_head->prev = prev;
}
else
{
break;
}
}
2023-04-26 21:39:26 +02:00
for (auto ptr = prev_head; ptr; ptr = ptr->prev)
{
if (auto task = ptr->exec.load()) [[likely]]
{
// Execute or discard (if aborting)
if ((m_sync & 3) == 0) [[likely]]
{
task(this, ptr);
}
else
{
task(nullptr, ptr);
}
// Notify waiters
ptr->done.release(1);
ptr->done.notify_all();
}
if (ptr->next)
{
// Partial cleanup
ptr->next.reset();
}
}
if (!m_taskq) [[likely]]
{
return;
}
}
}
[[noreturn]] void thread_ctrl::emergency_exit(std::string_view reason)
{
if (const std::string info = dump_useful_thread_info(); !info.empty())
{
sys_log.notice("\n%s", info);
}
std::string reason_buf;
if (auto ppu = cpu_thread::get_current<ppu_thread>())
{
if (auto func = ppu->current_function)
{
fmt::append(reason_buf, "%s (PPU: %s)", reason, func);
}
}
if (!reason_buf.empty())
{
reason = reason_buf;
}
sig_log.fatal("Thread terminated due to fatal error: %s", reason);
2023-12-25 13:35:09 +01:00
logs::listener::sync_all();
if (IsDebuggerPresent())
{
// Prevent repeatedly halting the debugger in case multiple threads crashed at once
static atomic_t<u64> s_last_break = 0;
const u64 current_break = get_system_time() & -2;
if (s_last_break.fetch_op([current_break](u64& v)
{
if (current_break >= (v & -2) && current_break - (v & -2) >= 20'000'000)
{
v = current_break;
return true;
}
// Let's allow a single more thread to halt the debugger so the programmer sees the pattern
if (!(v & 1))
{
v |= 1;
return true;
}
return false;
}).second)
{
utils::trap();
}
}
if (const auto _this = g_tls_this_thread)
{
g_tls_error_callback();
u64 _self = _this->finalize(thread_state::errored);
if (_self == umax)
{
// Unused, detached thread support remnant
delete _this;
}
thread_base::finalize(umax);
#ifdef _WIN32
_endthreadex(0);
#else
2020-12-29 02:08:37 +01:00
pthread_exit(nullptr);
#endif
}
report_fatal_error(reason);
}
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_cpu_brand();
2020-03-05 12:05:23 +01:00
if (system_id.find("Ryzen") != umax)
{
g_native_core_layout.store(native_core_arrangement::amd_ccx);
}
2020-03-05 12:05:23 +01:00
else if (system_id.find("Intel") != umax)
2018-12-23 19:01:09 +01:00
{
#ifdef _WIN32
const LOGICAL_PROCESSOR_RELATIONSHIP relationship = LOGICAL_PROCESSOR_RELATIONSHIP::RelationProcessorCore;
DWORD buffer_size = 0;
// If buffer size is set to 0 bytes, it will be overwritten with the required size
if (GetLogicalProcessorInformationEx(relationship, nullptr, &buffer_size))
{
sig_log.error("GetLogicalProcessorInformationEx returned 0 bytes");
2018-12-23 19:01:09 +01:00
return;
}
DWORD error_code = GetLastError();
if (error_code != ERROR_INSUFFICIENT_BUFFER)
{
sig_log.error("Unexpected windows error code when detecting CPU layout: %u", error_code);
2018-12-23 19:01:09 +01:00
return;
}
std::vector<u8> buffer(buffer_size);
if (!GetLogicalProcessorInformationEx(relationship,
reinterpret_cast<SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *>(buffer.data()), &buffer_size))
{
2023-03-04 11:05:32 +01:00
sig_log.error("GetLogicalProcessorInformationEx failed (size=%u, error=%s)", buffer_size, fmt::win_error{GetLastError(), nullptr});
2018-12-23 19:01:09 +01:00
}
else
{
// Iterate through the buffer until a core with hyperthreading is found
2020-12-12 14:29:55 +01:00
auto ptr = reinterpret_cast<uptr>(buffer.data());
const uptr end = ptr + buffer_size;
2018-05-29 12:19:01 +02:00
2018-12-23 19:01:09 +01:00
while (ptr < end)
{
auto info = reinterpret_cast<SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *>(ptr);
if (info->Relationship == relationship && info->Processor.Flags == LTP_PC_SMT)
{
g_native_core_layout.store(native_core_arrangement::intel_ht);
break;
}
ptr += info->Size;
}
}
#else
sig_log.todo("Thread scheduler is not implemented for Intel and this OS");
2018-12-23 19:01:09 +01:00
#endif
}
}
u64 thread_ctrl::get_affinity_mask(thread_class group)
{
detect_cpu_layout();
if (const auto thread_count = utils::get_thread_count())
{
const u64 all_cores_mask = process_affinity_mask;
switch (g_native_core_layout)
{
default:
case native_core_arrangement::generic:
{
return all_cores_mask;
}
case native_core_arrangement::amd_ccx:
{
2020-12-09 19:29:48 +01:00
if (thread_count <= 8)
{
// Single CCX or not enough threads, do nothing
return all_cores_mask;
}
u64 spu_mask, ppu_mask, rsx_mask;
2020-12-09 19:29:48 +01:00
spu_mask = ppu_mask = rsx_mask = all_cores_mask; // Fallback, in case someone is messing with core config
const auto system_id = utils::get_cpu_brand();
2020-12-09 19:29:48 +01:00
const auto family_id = utils::get_cpu_family();
const auto model_id = utils::get_cpu_model();
switch (family_id)
{
2020-12-09 19:29:48 +01:00
case 0x17: // Zen, Zen+, Zen2
case 0x18: // Dhyana core (Zen)
{
if (model_id > 0x30)
{
2020-12-09 19:29:48 +01:00
// Zen2 (models 49, 96, 113, 144)
// Much improved inter-CCX latency
switch (thread_count)
{
case 128:
case 64:
case 48:
case 32:
// TR 3000 series, or R9 3950X, Assign threads 9-32
ppu_mask = 0b11111111000000000000000000000000;
spu_mask = 0b00000000111111110000000000000000;
rsx_mask = 0b00000000000000001111111100000000;
break;
case 24:
// 3900X, Assign threads 7-24
2020-12-09 19:29:48 +01:00
ppu_mask = 0b111111000000000000000000;
spu_mask = 0b000000111111000000000000;
rsx_mask = 0b000000000000111111000000;
break;
case 16:
// 3700, 3800 family, Assign threads 1-16
ppu_mask = 0b0000000011110000;
spu_mask = 0b1111111100000000;
rsx_mask = 0b0000000000001111;
break;
case 12:
// 3600 family, Assign threads 1-12
ppu_mask = 0b000000111000;
spu_mask = 0b111111000000;
rsx_mask = 0b000000000111;
break;
default:
break;
}
}
else
{
2020-12-09 19:29:48 +01:00
// Zen, Zen+ (models 1, 8(+), 17, 24(+), 32)
switch (thread_count)
{
case 64:
// TR 2990WX, Assign threads 17-32
ppu_mask = 0b00000000111111110000000000000000;
spu_mask = ppu_mask;
rsx_mask = 0b11111111000000000000000000000000;
break;
case 48:
// TR 2970WX, Assign threads 9-24
ppu_mask = 0b000000111111000000000000;
spu_mask = ppu_mask;
rsx_mask = 0b111111000000000000000000;
break;
case 32:
// TR 2950X, TR 1950X, Assign threads 17-32
ppu_mask = 0b00000000111111110000000000000000;
spu_mask = ppu_mask;
rsx_mask = 0b11111111000000000000000000000000;
break;
case 24:
// TR 1920X, 2920X, Assign threads 13-24
ppu_mask = 0b000000111111000000000000;
spu_mask = ppu_mask;
rsx_mask = 0b111111000000000000000000;
break;
case 16:
// 1700, 1800, 2700, TR 1900X family
2021-03-17 17:28:03 +01:00
if (g_cfg.core.thread_scheduler == thread_scheduler_mode::alt)
{
ppu_mask = 0b0010000010000000;
spu_mask = 0b0000101010101010;
rsx_mask = 0b1000000000000000;
}
else // if (g_cfg.core.thread_scheduler == thread_scheduler_mode::old)
2021-03-17 17:28:03 +01:00
{
ppu_mask = 0b1111111100000000;
spu_mask = ppu_mask;
rsx_mask = 0b0000000000111100;
}
2020-12-09 19:29:48 +01:00
break;
case 12:
// 1600, 2600 family, Assign threads 3-12
ppu_mask = 0b111111000000;
spu_mask = ppu_mask;
rsx_mask = 0b000000111100;
break;
default:
break;
}
}
2020-12-09 19:29:48 +01:00
break;
}
2020-12-09 19:29:48 +01:00
case 0x19: // Zen3
{
2020-12-09 19:29:48 +01:00
// Single-CCX architecture, just disable SMT if wide enough
// CCX now holds upto 16 threads
// Lack of hw availability makes testing difficult
switch (thread_count)
{
2020-12-09 19:29:48 +01:00
case 24:
// 5900X, Use same scheduler as 3900X
// Unverified on windows, may be worse than just disabling SMT and scheduler
ppu_mask = 0b111111000000000000000000;
spu_mask = 0b000000111111000000000000;
rsx_mask = 0b000000000000111111000000;
2020-12-09 19:29:48 +01:00
break;
2021-03-17 17:28:03 +01:00
case 16:
// 5800X
if (g_cfg.core.thread_scheduler == thread_scheduler_mode::alt)
{
ppu_mask = 0b0000000011110000;
spu_mask = 0b1111111100000000;
rsx_mask = 0b0000000000001111;
}
else // if (g_cfg.core.thread_scheduler == thread_scheduler_mode::old)
2020-12-09 19:29:48 +01:00
{
// Verified by more than one windows user on 16-thread CPU
ppu_mask = spu_mask = rsx_mask = (0b10101010101010101010101010101010 & all_cores_mask);
}
2021-04-09 21:12:47 +02:00
break;
2021-03-17 17:28:03 +01:00
case 12:
// 5600X
if (g_cfg.core.thread_scheduler == thread_scheduler_mode::alt)
{
ppu_mask = 0b000000001100;
spu_mask = 0b111111110000;
rsx_mask = 0b000000000011;
}
else // if (g_cfg.core.thread_scheduler == thread_scheduler_mode::old)
2020-12-09 19:29:48 +01:00
{
ppu_mask = spu_mask = rsx_mask = all_cores_mask;
}
2021-04-09 21:12:47 +02:00
break;
2021-03-17 17:28:03 +01:00
default:
if (thread_count > 24)
{
ppu_mask = spu_mask = rsx_mask = (0b10101010101010101010101010101010 & all_cores_mask);
}
2020-12-09 19:29:48 +01:00
break;
}
2020-12-09 19:29:48 +01:00
break;
}
2020-12-09 19:29:48 +01:00
default:
{
2020-12-09 19:29:48 +01:00
break;
}
}
switch (group)
{
default:
case thread_class::general:
return all_cores_mask;
case thread_class::rsx:
return rsx_mask;
case thread_class::ppu:
return ppu_mask;
case thread_class::spu:
return spu_mask;
}
}
case native_core_arrangement::intel_ht:
{
2021-03-17 17:28:03 +01:00
if (thread_count >= 12 && g_cfg.core.thread_scheduler == thread_scheduler_mode::alt)
return (0b10101010101010101010101010101010 & all_cores_mask); // Potentially improves performance by mimicking HT off
return all_cores_mask;
}
}
}
return -1;
}
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))
{
2023-03-04 11:05:32 +01:00
sig_log.error("SetThreadPriority() failed: %s", fmt::win_error{GetLastError(), nullptr});
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, &param);
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, &param))
{
sig_log.error("pthread_setschedparam() failed: %d", err);
2017-10-31 23:49:54 +01:00
}
2017-06-24 17:36:49 +02:00
#endif
}
u64 thread_ctrl::get_process_affinity_mask()
{
static const u64 mask = []() -> u64
{
#ifdef _WIN32
DWORD_PTR res, _sys;
if (!GetProcessAffinityMask(GetCurrentProcess(), &res, &_sys))
{
sig_log.error("Failed to get process affinity mask.");
return 0;
}
return res;
#else
// Assume it's called from the main thread (this is a bit shaky)
return thread_ctrl::get_thread_affinity_mask();
#endif
}();
return mask;
}
DECLARE(thread_ctrl::process_affinity_mask) = get_process_affinity_mask();
void thread_ctrl::set_thread_affinity_mask(u64 mask)
2017-06-24 17:36:49 +02:00
{
sig_log.trace("set_thread_affinity_mask called with mask=0x%x", mask);
2017-06-24 17:36:49 +02:00
#ifdef _WIN32
HANDLE _this_thread = GetCurrentThread();
if (!SetThreadAffinityMask(_this_thread, !mask ? process_affinity_mask : mask))
{
2023-03-04 11:05:32 +01:00
sig_log.error("Failed to set thread affinity 0x%x: error: %s", mask, fmt::win_error{GetLastError(), nullptr});
}
#elif __APPLE__
// Supports only one core
thread_affinity_policy_data_t policy = { static_cast<integer_t>(std::countr_zero(mask)) };
thread_port_t mach_thread = pthread_mach_thread_np(pthread_self());
thread_policy_set(mach_thread, THREAD_AFFINITY_POLICY, reinterpret_cast<thread_policy_t>(&policy), !mask ? 0 : 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__)
if (!mask)
{
// Reset affinity mask
mask = process_affinity_mask;
}
cpu_set_t cs;
CPU_ZERO(&cs);
for (u32 core = 0; core < 64u; ++core)
{
const u64 shifted = mask >> core;
if (shifted & 1)
{
2020-02-04 19:37:00 +01:00
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast"
CPU_SET(core, &cs);
2020-02-04 19:37:00 +01:00
#pragma GCC diagnostic pop
}
if (shifted <= 1)
{
break;
}
}
if (int err = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cs))
{
sig_log.error("Failed to set thread affinity 0x%x: error %d.", mask, err);
}
#endif
}
u64 thread_ctrl::get_thread_affinity_mask()
{
#ifdef _WIN32
const u64 res = process_affinity_mask;
if (DWORD_PTR result = SetThreadAffinityMask(GetCurrentThread(), res))
{
if (res != result)
{
SetThreadAffinityMask(GetCurrentThread(), result);
}
return result;
}
sig_log.error("Failed to get thread affinity mask.");
return 0;
#elif defined(__linux__) || defined(__DragonFly__) || defined(__FreeBSD__)
cpu_set_t cs;
CPU_ZERO(&cs);
if (int err = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cs))
{
sig_log.error("Failed to get thread affinity mask: error %d.", err);
return 0;
}
u64 result = 0;
for (u32 core = 0; core < 64u; core++)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast"
if (CPU_ISSET(core, &cs))
#pragma GCC diagnostic pop
{
result |= 1ull << core;
}
}
if (result == 0)
{
sig_log.error("Thread affinity mask is out of u64 range.");
return 0;
}
return result;
#else
return -1;
2017-06-24 17:36:49 +02:00
#endif
}
2020-12-18 08:39:54 +01:00
std::pair<void*, usz> thread_ctrl::get_thread_stack()
{
#ifdef _WIN32
ULONG_PTR _min = 0;
ULONG_PTR _max = 0;
GetCurrentThreadStackLimits(&_min, &_max);
2020-12-18 08:39:54 +01:00
const usz ssize = _max - _min;
const auto saddr = reinterpret_cast<void*>(_min);
#else
void* saddr = 0;
2020-12-18 08:39:54 +01:00
usz ssize = 0;
#if defined(__linux__)
2021-05-09 09:05:48 +02:00
pthread_attr_t attr;
pthread_getattr_np(pthread_self(), &attr);
pthread_attr_getstack(&attr, &saddr, &ssize);
#elif defined(__APPLE__)
saddr = pthread_get_stackaddr_np(pthread_self());
ssize = pthread_get_stacksize_np(pthread_self());
#else
2021-05-09 09:05:48 +02:00
pthread_attr_t attr;
pthread_attr_get_np(pthread_self(), &attr);
pthread_attr_getstackaddr(&attr, &saddr);
pthread_attr_getstacksize(&attr, &ssize);
#endif
#endif
return {saddr, ssize};
}
2021-03-06 18:10:48 +01:00
u64 thread_ctrl::get_tid()
{
#ifdef _WIN32
return GetCurrentThreadId();
#elif defined(__linux__)
return syscall(SYS_gettid);
2021-03-06 18:10:48 +01:00
#else
return reinterpret_cast<u64>(pthread_self());
#endif
}
2021-03-06 19:02:37 +01:00
bool thread_ctrl::is_main()
{
return get_tid() == utils::main_tid;
}