Merge branch 'master' of https://github.com/dolphin-emu/dolphin into dolphin-emu-master

This commit is contained in:
Nayla Hanegan 2024-08-23 13:38:17 -04:00
commit 7e6752e8fc
516 changed files with 60670 additions and 270317 deletions

View file

@ -87,26 +87,6 @@ void ARM64XEmitter::SetCodePtr(u8* ptr, u8* end, bool write_failed)
m_lastCacheFlushEnd = ptr;
}
const u8* ARM64XEmitter::GetCodePtr() const
{
return m_code;
}
u8* ARM64XEmitter::GetWritableCodePtr()
{
return m_code;
}
const u8* ARM64XEmitter::GetCodeEnd() const
{
return m_code_end;
}
u8* ARM64XEmitter::GetWritableCodeEnd()
{
return m_code_end;
}
void ARM64XEmitter::ReserveCodeSpace(u32 bytes)
{
for (u32 i = 0; i < bytes / 4; i++)

View file

@ -680,10 +680,10 @@ public:
void SetCodePtr(u8* ptr, u8* end, bool write_failed = false);
void SetCodePtrUnsafe(u8* ptr, u8* end, bool write_failed = false);
const u8* GetCodePtr() const;
u8* GetWritableCodePtr();
const u8* GetCodeEnd() const;
u8* GetWritableCodeEnd();
const u8* GetCodePtr() const { return m_code; }
u8* GetWritableCodePtr() { return m_code; }
const u8* GetCodeEnd() const { return m_code_end; }
u8* GetWritableCodeEnd() { return m_code_end; }
void ReserveCodeSpace(u32 bytes);
u8* AlignCode16();
u8* AlignCodePage();

View file

@ -15,11 +15,16 @@
#include <Windows.h>
#include <arm64intr.h>
#include "Common/WindowsRegistry.h"
#else
#ifndef __FreeBSD__
#elif defined(__linux__)
#include <asm/hwcap.h>
#endif
#include <sys/auxv.h>
#elif defined(__FreeBSD__)
#include <sys/auxv.h>
#elif defined(__OpenBSD__)
#include <machine/armreg.h>
#include <machine/cpu.h>
#include <sys/sysctl.h>
#include <sys/types.h>
#endif
#include <fmt/format.h>
@ -183,7 +188,7 @@ static bool Read_MIDR_EL1(u64* value)
#endif
#ifndef __APPLE__
#if defined(_WIN32) || defined(__linux__) || defined(__FreeBSD__)
static std::string MIDRToString(u64 midr)
{
@ -248,7 +253,7 @@ void CPUInfo::Detect()
{
cpu_id = MIDRToString(reg);
}
#else
#elif defined(__linux__) || defined(__FreeBSD__)
// Linux, Android, and FreeBSD
#if defined(__FreeBSD__)
@ -277,6 +282,33 @@ void CPUInfo::Detect()
{
cpu_id = MIDRToString(midr);
}
#elif defined(__OpenBSD__)
// OpenBSD
int mib[2];
size_t len;
char hwmodel[256];
uint64_t isar0;
mib[0] = CTL_HW;
mib[1] = HW_MODEL;
len = std::size(hwmodel);
if (sysctl(mib, 2, &hwmodel, &len, nullptr, 0) != -1)
model_name = std::string(hwmodel, len - 1);
mib[0] = CTL_MACHDEP;
mib[1] = CPU_ID_AA64ISAR0;
len = sizeof(isar0);
if (sysctl(mib, 2, &isar0, &len, nullptr, 0) != -1)
{
if (ID_AA64ISAR0_AES(isar0) >= ID_AA64ISAR0_AES_BASE)
bAES = true;
if (ID_AA64ISAR0_SHA1(isar0) >= ID_AA64ISAR0_SHA1_BASE)
bSHA1 = true;
if (ID_AA64ISAR0_SHA2(isar0) >= ID_AA64ISAR0_SHA2_BASE)
bSHA2 = true;
if (ID_AA64ISAR0_CRC32(isar0) >= ID_AA64ISAR0_CRC32_BASE)
bCRC32 = true;
}
#endif
model_name = ReplaceAll(model_name, ",", "_");

View file

@ -42,40 +42,40 @@ constexpr ExtendedMnemonicDesc INVALID_EXT_MNEMONIC = {0, nullptr};
// All operands as referenced by the Gekko/Broadway user manual
// See section 12.1.2 under Chapter 12
constexpr OperandDesc _A = OperandDesc{Mask(11, 15), {16, false}};
constexpr OperandDesc _B = OperandDesc{Mask(16, 20), {11, false}};
constexpr OperandDesc _BD = OperandDesc{Mask(16, 29), {0, true}};
constexpr OperandDesc _BI = OperandDesc{Mask(11, 15), {16, false}};
constexpr OperandDesc _BO = OperandDesc{Mask(6, 10), {21, false}};
constexpr OperandDesc _C = OperandDesc{Mask(21, 25), {6, false}};
constexpr OperandDesc _Crba = OperandDesc{Mask(11, 15), {16, false}};
constexpr OperandDesc _Crbb = OperandDesc{Mask(16, 20), {11, false}};
constexpr OperandDesc _Crbd = OperandDesc{Mask(6, 10), {21, false}};
constexpr OperandDesc _Crfd = OperandDesc{Mask(6, 8), {23, false}};
constexpr OperandDesc _Crfs = OperandDesc{Mask(11, 13), {18, false}};
constexpr OperandDesc _CRM = OperandDesc{Mask(12, 19), {12, false}};
constexpr OperandDesc _D = OperandDesc{Mask(6, 10), {21, false}};
constexpr OperandDesc _FM = OperandDesc{Mask(7, 14), {17, false}};
constexpr OperandDesc _W1 = OperandDesc{Mask(16, 16), {15, false}};
constexpr OperandDesc _W2 = OperandDesc{Mask(21, 21), {10, false}};
constexpr OperandDesc _IMM = OperandDesc{Mask(16, 19), {12, false}};
constexpr OperandDesc _L = OperandDesc{Mask(10, 10), {21, false}};
constexpr OperandDesc _LI = OperandDesc{Mask(6, 29), {0, true}};
constexpr OperandDesc _MB = OperandDesc{Mask(21, 25), {6, false}};
constexpr OperandDesc _ME = OperandDesc{Mask(26, 30), {1, false}};
constexpr OperandDesc _NB = OperandDesc{Mask(16, 20), {11, false}};
constexpr OperandDesc _Offd = OperandDesc{Mask(16, 31), {0, true}};
constexpr OperandDesc _OffdPs = OperandDesc{Mask(20, 31), {0, true}};
constexpr OperandDesc _S = OperandDesc{Mask(6, 10), {21, false}};
constexpr OperandDesc _SH = OperandDesc{Mask(16, 20), {11, false}};
constexpr OperandDesc _SIMM = OperandDesc{Mask(16, 31), {0, true}};
constexpr OperandDesc _SPR = OperandDesc{Mask(11, 20), {11, false}};
constexpr OperandDesc _SR = OperandDesc{Mask(12, 15), {16, false}};
constexpr OperandDesc _TO = OperandDesc{Mask(6, 10), {21, false}};
constexpr OperandDesc _TPR = OperandDesc{Mask(11, 20), {11, false}};
constexpr OperandDesc _UIMM = OperandDesc{Mask(16, 31), {0, false}};
constexpr OperandDesc _I1 = OperandDesc{Mask(17, 19), {12, false}};
constexpr OperandDesc _I2 = OperandDesc{Mask(22, 24), {7, false}};
constexpr OperandDesc OpDesc_A = OperandDesc{Mask(11, 15), {16, false}};
constexpr OperandDesc OpDesc_B = OperandDesc{Mask(16, 20), {11, false}};
constexpr OperandDesc OpDesc_BD = OperandDesc{Mask(16, 29), {0, true}};
constexpr OperandDesc OpDesc_BI = OperandDesc{Mask(11, 15), {16, false}};
constexpr OperandDesc OpDesc_BO = OperandDesc{Mask(6, 10), {21, false}};
constexpr OperandDesc OpDesc_C = OperandDesc{Mask(21, 25), {6, false}};
constexpr OperandDesc OpDesc_Crba = OperandDesc{Mask(11, 15), {16, false}};
constexpr OperandDesc OpDesc_Crbb = OperandDesc{Mask(16, 20), {11, false}};
constexpr OperandDesc OpDesc_Crbd = OperandDesc{Mask(6, 10), {21, false}};
constexpr OperandDesc OpDesc_Crfd = OperandDesc{Mask(6, 8), {23, false}};
constexpr OperandDesc OpDesc_Crfs = OperandDesc{Mask(11, 13), {18, false}};
constexpr OperandDesc OpDesc_CRM = OperandDesc{Mask(12, 19), {12, false}};
constexpr OperandDesc OpDesc_D = OperandDesc{Mask(6, 10), {21, false}};
constexpr OperandDesc OpDesc_FM = OperandDesc{Mask(7, 14), {17, false}};
constexpr OperandDesc OpDesc_W1 = OperandDesc{Mask(16, 16), {15, false}};
constexpr OperandDesc OpDesc_W2 = OperandDesc{Mask(21, 21), {10, false}};
constexpr OperandDesc OpDesc_IMM = OperandDesc{Mask(16, 19), {12, false}};
constexpr OperandDesc OpDesc_L = OperandDesc{Mask(10, 10), {21, false}};
constexpr OperandDesc OpDesc_LI = OperandDesc{Mask(6, 29), {0, true}};
constexpr OperandDesc OpDesc_MB = OperandDesc{Mask(21, 25), {6, false}};
constexpr OperandDesc OpDesc_ME = OperandDesc{Mask(26, 30), {1, false}};
constexpr OperandDesc OpDesc_NB = OperandDesc{Mask(16, 20), {11, false}};
constexpr OperandDesc OpDesc_Offd = OperandDesc{Mask(16, 31), {0, true}};
constexpr OperandDesc OpDesc_OffdPs = OperandDesc{Mask(20, 31), {0, true}};
constexpr OperandDesc OpDesc_S = OperandDesc{Mask(6, 10), {21, false}};
constexpr OperandDesc OpDesc_SH = OperandDesc{Mask(16, 20), {11, false}};
constexpr OperandDesc OpDesc_SIMM = OperandDesc{Mask(16, 31), {0, true}};
constexpr OperandDesc OpDesc_SPR = OperandDesc{Mask(11, 20), {11, false}};
constexpr OperandDesc OpDesc_SR = OperandDesc{Mask(12, 15), {16, false}};
constexpr OperandDesc OpDesc_TO = OperandDesc{Mask(6, 10), {21, false}};
constexpr OperandDesc OpDesc_TPR = OperandDesc{Mask(11, 20), {11, false}};
constexpr OperandDesc OpDesc_UIMM = OperandDesc{Mask(16, 31), {0, false}};
constexpr OperandDesc OpDesc_I1 = OperandDesc{Mask(17, 19), {12, false}};
constexpr OperandDesc OpDesc_I2 = OperandDesc{Mask(22, 24), {7, false}};
} // namespace
void OperandList::Insert(size_t before, u32 val)
@ -675,288 +675,293 @@ extern const CaseInsensitiveDict<ParseInfo, '.', '_', '+', '-'> extended_mnemoni
// Defines all basic mnemonics that Broadway/Gekko supports
extern const std::array<MnemonicDesc, NUM_MNEMONICS* VARIANT_PERMUTATIONS> mnemonics = {
// A-2
OERC_MNEMONIC(31, InsertVal(266, 22, 30), _D, _A, _B), // add
OERC_MNEMONIC(31, InsertVal(10, 22, 30), _D, _A, _B), // addc
OERC_MNEMONIC(31, InsertVal(138, 22, 30), _D, _A, _B), // adde
BASIC_MNEMONIC(14, _D, _A, _SIMM), // addi
BASIC_MNEMONIC(12, _D, _A, _SIMM), // addic
BASIC_MNEMONIC(13, _D, _A, _SIMM), // addic.
BASIC_MNEMONIC(15, _D, _A, _SIMM), // addis
OERC_MNEMONIC(31, InsertVal(234, 22, 30), _D, _A), // addme
OERC_MNEMONIC(31, InsertVal(202, 22, 30), _D, _A), // addze
OERC_MNEMONIC(31, InsertVal(491, 22, 30), _D, _A, _B), // divw
OERC_MNEMONIC(31, InsertVal(459, 22, 30), _D, _A, _B), // divwu
RC_MNEMONIC(31, InsertVal(75, 22, 30), _D, _A, _B), // mulhw
RC_MNEMONIC(31, InsertVal(11, 22, 30), _D, _A, _B), // mulhwu
BASIC_MNEMONIC(7, _D, _A, _SIMM), // mulli
OERC_MNEMONIC(31, InsertVal(235, 22, 30), _D, _A, _B), // mullw
OERC_MNEMONIC(31, InsertVal(104, 22, 30), _D, _A), // neg
OERC_MNEMONIC(31, InsertVal(40, 22, 30), _D, _A, _B), // subf
OERC_MNEMONIC(31, InsertVal(8, 22, 30), _D, _A, _B), // subfc
OERC_MNEMONIC(31, InsertVal(136, 22, 30), _D, _A, _B), // subfe
BASIC_MNEMONIC(8, _D, _A, _SIMM), // subfic
OERC_MNEMONIC(31, InsertVal(232, 22, 30), _D, _A), // subfme
OERC_MNEMONIC(31, InsertVal(200, 22, 30), _D, _A), // subfze
OERC_MNEMONIC(31, InsertVal(266, 22, 30), OpDesc_D, OpDesc_A, OpDesc_B), // add
OERC_MNEMONIC(31, InsertVal(10, 22, 30), OpDesc_D, OpDesc_A, OpDesc_B), // addc
OERC_MNEMONIC(31, InsertVal(138, 22, 30), OpDesc_D, OpDesc_A, OpDesc_B), // adde
BASIC_MNEMONIC(14, OpDesc_D, OpDesc_A, OpDesc_SIMM), // addi
BASIC_MNEMONIC(12, OpDesc_D, OpDesc_A, OpDesc_SIMM), // addic
BASIC_MNEMONIC(13, OpDesc_D, OpDesc_A, OpDesc_SIMM), // addic.
BASIC_MNEMONIC(15, OpDesc_D, OpDesc_A, OpDesc_SIMM), // addis
OERC_MNEMONIC(31, InsertVal(234, 22, 30), OpDesc_D, OpDesc_A), // addme
OERC_MNEMONIC(31, InsertVal(202, 22, 30), OpDesc_D, OpDesc_A), // addze
OERC_MNEMONIC(31, InsertVal(491, 22, 30), OpDesc_D, OpDesc_A, OpDesc_B), // divw
OERC_MNEMONIC(31, InsertVal(459, 22, 30), OpDesc_D, OpDesc_A, OpDesc_B), // divwu
RC_MNEMONIC(31, InsertVal(75, 22, 30), OpDesc_D, OpDesc_A, OpDesc_B), // mulhw
RC_MNEMONIC(31, InsertVal(11, 22, 30), OpDesc_D, OpDesc_A, OpDesc_B), // mulhwu
BASIC_MNEMONIC(7, OpDesc_D, OpDesc_A, OpDesc_SIMM), // mulli
OERC_MNEMONIC(31, InsertVal(235, 22, 30), OpDesc_D, OpDesc_A, OpDesc_B), // mullw
OERC_MNEMONIC(31, InsertVal(104, 22, 30), OpDesc_D, OpDesc_A), // neg
OERC_MNEMONIC(31, InsertVal(40, 22, 30), OpDesc_D, OpDesc_A, OpDesc_B), // subf
OERC_MNEMONIC(31, InsertVal(8, 22, 30), OpDesc_D, OpDesc_A, OpDesc_B), // subfc
OERC_MNEMONIC(31, InsertVal(136, 22, 30), OpDesc_D, OpDesc_A, OpDesc_B), // subfe
BASIC_MNEMONIC(8, OpDesc_D, OpDesc_A, OpDesc_SIMM), // subfic
OERC_MNEMONIC(31, InsertVal(232, 22, 30), OpDesc_D, OpDesc_A), // subfme
OERC_MNEMONIC(31, InsertVal(200, 22, 30), OpDesc_D, OpDesc_A), // subfze
// A-3
MNEMONIC(31, InsertVal(0, 21, 30), _Crfd, _L, _A, _B), // cmp
BASIC_MNEMONIC(11, _Crfd, _L, _A, _SIMM), // cmpi
MNEMONIC(31, InsertVal(32, 21, 30), _Crfd, _L, _A, _B), // cmpl
BASIC_MNEMONIC(10, _Crfd, _L, _A, _UIMM), // cmpli
MNEMONIC(31, InsertVal(0, 21, 30), OpDesc_Crfd, OpDesc_L, OpDesc_A, OpDesc_B), // cmp
BASIC_MNEMONIC(11, OpDesc_Crfd, OpDesc_L, OpDesc_A, OpDesc_SIMM), // cmpi
MNEMONIC(31, InsertVal(32, 21, 30), OpDesc_Crfd, OpDesc_L, OpDesc_A, OpDesc_B), // cmpl
BASIC_MNEMONIC(10, OpDesc_Crfd, OpDesc_L, OpDesc_A, OpDesc_UIMM), // cmpli
// A-4
RC_MNEMONIC(31, InsertVal(28, 21, 30), _A, _S, _B), // and
RC_MNEMONIC(31, InsertVal(60, 21, 30), _A, _S, _B), // andc
BASIC_MNEMONIC(28, _A, _S, _UIMM), // andi.
BASIC_MNEMONIC(29, _A, _S, _UIMM), // andis.
RC_MNEMONIC(31, InsertVal(26, 21, 30), _A, _S), // cntlzw
RC_MNEMONIC(31, InsertVal(284, 21, 30), _A, _S, _B), // eqv
RC_MNEMONIC(31, InsertVal(954, 21, 30), _A, _S), // extsb
RC_MNEMONIC(31, InsertVal(922, 21, 30), _A, _S), // extsh
RC_MNEMONIC(31, InsertVal(476, 21, 30), _A, _S, _B), // nand
RC_MNEMONIC(31, InsertVal(124, 21, 30), _A, _S, _B), // nor
RC_MNEMONIC(31, InsertVal(444, 21, 30), _A, _S, _B), // or
RC_MNEMONIC(31, InsertVal(412, 21, 30), _A, _S, _B), // orc
BASIC_MNEMONIC(24, _A, _S, _UIMM), // ori
BASIC_MNEMONIC(25, _A, _S, _UIMM), // oris
RC_MNEMONIC(31, InsertVal(316, 21, 30), _A, _S, _B), // xor
BASIC_MNEMONIC(26, _A, _S, _UIMM), // xori
BASIC_MNEMONIC(27, _A, _S, _UIMM), // xoris
RC_MNEMONIC(31, InsertVal(28, 21, 30), OpDesc_A, OpDesc_S, OpDesc_B), // and
RC_MNEMONIC(31, InsertVal(60, 21, 30), OpDesc_A, OpDesc_S, OpDesc_B), // andc
BASIC_MNEMONIC(28, OpDesc_A, OpDesc_S, OpDesc_UIMM), // andi.
BASIC_MNEMONIC(29, OpDesc_A, OpDesc_S, OpDesc_UIMM), // andis.
RC_MNEMONIC(31, InsertVal(26, 21, 30), OpDesc_A, OpDesc_S), // cntlzw
RC_MNEMONIC(31, InsertVal(284, 21, 30), OpDesc_A, OpDesc_S, OpDesc_B), // eqv
RC_MNEMONIC(31, InsertVal(954, 21, 30), OpDesc_A, OpDesc_S), // extsb
RC_MNEMONIC(31, InsertVal(922, 21, 30), OpDesc_A, OpDesc_S), // extsh
RC_MNEMONIC(31, InsertVal(476, 21, 30), OpDesc_A, OpDesc_S, OpDesc_B), // nand
RC_MNEMONIC(31, InsertVal(124, 21, 30), OpDesc_A, OpDesc_S, OpDesc_B), // nor
RC_MNEMONIC(31, InsertVal(444, 21, 30), OpDesc_A, OpDesc_S, OpDesc_B), // or
RC_MNEMONIC(31, InsertVal(412, 21, 30), OpDesc_A, OpDesc_S, OpDesc_B), // orc
BASIC_MNEMONIC(24, OpDesc_A, OpDesc_S, OpDesc_UIMM), // ori
BASIC_MNEMONIC(25, OpDesc_A, OpDesc_S, OpDesc_UIMM), // oris
RC_MNEMONIC(31, InsertVal(316, 21, 30), OpDesc_A, OpDesc_S, OpDesc_B), // xor
BASIC_MNEMONIC(26, OpDesc_A, OpDesc_S, OpDesc_UIMM), // xori
BASIC_MNEMONIC(27, OpDesc_A, OpDesc_S, OpDesc_UIMM), // xoris
// A-5
RC_MNEMONIC(20, 0, _A, _S, _SH, _MB, _ME), // rlwimi
RC_MNEMONIC(21, 0, _A, _S, _SH, _MB, _ME), // rlwinm
RC_MNEMONIC(23, 0, _A, _S, _B, _MB, _ME), // rlwnm
RC_MNEMONIC(20, 0, OpDesc_A, OpDesc_S, OpDesc_SH, OpDesc_MB, OpDesc_ME), // rlwimi
RC_MNEMONIC(21, 0, OpDesc_A, OpDesc_S, OpDesc_SH, OpDesc_MB, OpDesc_ME), // rlwinm
RC_MNEMONIC(23, 0, OpDesc_A, OpDesc_S, OpDesc_B, OpDesc_MB, OpDesc_ME), // rlwnm
// A-6
RC_MNEMONIC(31, InsertVal(24, 21, 30), _A, _S, _B), // slw
RC_MNEMONIC(31, InsertVal(792, 21, 30), _A, _S, _B), // sraw
RC_MNEMONIC(31, InsertVal(824, 21, 30), _A, _S, _SH), // srawi
RC_MNEMONIC(31, InsertVal(536, 21, 30), _A, _S, _B), // srw
RC_MNEMONIC(31, InsertVal(24, 21, 30), OpDesc_A, OpDesc_S, OpDesc_B), // slw
RC_MNEMONIC(31, InsertVal(792, 21, 30), OpDesc_A, OpDesc_S, OpDesc_B), // sraw
RC_MNEMONIC(31, InsertVal(824, 21, 30), OpDesc_A, OpDesc_S, OpDesc_SH), // srawi
RC_MNEMONIC(31, InsertVal(536, 21, 30), OpDesc_A, OpDesc_S, OpDesc_B), // srw
// A-7
RC_MNEMONIC(63, InsertVal(21, 26, 30), _D, _A, _B), // fadd
RC_MNEMONIC(59, InsertVal(21, 26, 30), _D, _A, _B), // fadds
RC_MNEMONIC(63, InsertVal(18, 26, 30), _D, _A, _B), // fdiv
RC_MNEMONIC(59, InsertVal(18, 26, 30), _D, _A, _B), // fdivs
RC_MNEMONIC(63, InsertVal(25, 26, 30), _D, _A, _C), // fmul
RC_MNEMONIC(59, InsertVal(25, 26, 30), _D, _A, _C), // fmuls
RC_MNEMONIC(59, InsertVal(24, 26, 30), _D, _B), // fres
RC_MNEMONIC(63, InsertVal(26, 26, 30), _D, _B), // frsqrte
RC_MNEMONIC(63, InsertVal(20, 26, 30), _D, _A, _B), // fsub
RC_MNEMONIC(59, InsertVal(20, 26, 30), _D, _A, _B), // fsubs
RC_MNEMONIC(63, InsertVal(23, 26, 30), _D, _A, _C, _B), // fsel
RC_MNEMONIC(63, InsertVal(21, 26, 30), OpDesc_D, OpDesc_A, OpDesc_B), // fadd
RC_MNEMONIC(59, InsertVal(21, 26, 30), OpDesc_D, OpDesc_A, OpDesc_B), // fadds
RC_MNEMONIC(63, InsertVal(18, 26, 30), OpDesc_D, OpDesc_A, OpDesc_B), // fdiv
RC_MNEMONIC(59, InsertVal(18, 26, 30), OpDesc_D, OpDesc_A, OpDesc_B), // fdivs
RC_MNEMONIC(63, InsertVal(25, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C), // fmul
RC_MNEMONIC(59, InsertVal(25, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C), // fmuls
RC_MNEMONIC(59, InsertVal(24, 26, 30), OpDesc_D, OpDesc_B), // fres
RC_MNEMONIC(63, InsertVal(26, 26, 30), OpDesc_D, OpDesc_B), // frsqrte
RC_MNEMONIC(63, InsertVal(20, 26, 30), OpDesc_D, OpDesc_A, OpDesc_B), // fsub
RC_MNEMONIC(59, InsertVal(20, 26, 30), OpDesc_D, OpDesc_A, OpDesc_B), // fsubs
RC_MNEMONIC(63, InsertVal(23, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C, OpDesc_B), // fsel
// A-8
RC_MNEMONIC(63, InsertVal(29, 26, 30), _D, _A, _C, _B), // fmadd
RC_MNEMONIC(59, InsertVal(29, 26, 30), _D, _A, _C, _B), // fmadds
RC_MNEMONIC(63, InsertVal(28, 26, 30), _D, _A, _C, _B), // fmsub
RC_MNEMONIC(59, InsertVal(28, 26, 30), _D, _A, _C, _B), // fmsubs
RC_MNEMONIC(63, InsertVal(31, 26, 30), _D, _A, _C, _B), // fnmadd
RC_MNEMONIC(59, InsertVal(31, 26, 30), _D, _A, _C, _B), // fnmadds
RC_MNEMONIC(63, InsertVal(30, 26, 30), _D, _A, _C, _B), // fnmsub
RC_MNEMONIC(59, InsertVal(30, 26, 30), _D, _A, _C, _B), // fnmsubs
RC_MNEMONIC(63, InsertVal(29, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C, OpDesc_B), // fmadd
RC_MNEMONIC(59, InsertVal(29, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C, OpDesc_B), // fmadds
RC_MNEMONIC(63, InsertVal(28, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C, OpDesc_B), // fmsub
RC_MNEMONIC(59, InsertVal(28, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C, OpDesc_B), // fmsubs
RC_MNEMONIC(63, InsertVal(31, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C, OpDesc_B), // fnmadd
RC_MNEMONIC(59, InsertVal(31, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C, OpDesc_B), // fnmadds
RC_MNEMONIC(63, InsertVal(30, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C, OpDesc_B), // fnmsub
RC_MNEMONIC(59, InsertVal(30, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C, OpDesc_B), // fnmsubs
// A-9
RC_MNEMONIC(63, InsertVal(14, 21, 30), _D, _B), // fctiw
RC_MNEMONIC(63, InsertVal(15, 21, 30), _D, _B), // fctiwz
RC_MNEMONIC(63, InsertVal(12, 21, 30), _D, _B), // frsp
RC_MNEMONIC(63, InsertVal(14, 21, 30), OpDesc_D, OpDesc_B), // fctiw
RC_MNEMONIC(63, InsertVal(15, 21, 30), OpDesc_D, OpDesc_B), // fctiwz
RC_MNEMONIC(63, InsertVal(12, 21, 30), OpDesc_D, OpDesc_B), // frsp
// A-10
MNEMONIC(63, InsertVal(32, 21, 30), _Crfd, _A, _B), // fcmpo
MNEMONIC(63, InsertVal(0, 21, 30), _Crfd, _A, _B), // fcmpu
MNEMONIC(63, InsertVal(32, 21, 30), OpDesc_Crfd, OpDesc_A, OpDesc_B), // fcmpo
MNEMONIC(63, InsertVal(0, 21, 30), OpDesc_Crfd, OpDesc_A, OpDesc_B), // fcmpu
// A-11
MNEMONIC(63, InsertVal(64, 21, 30), _Crfd, _Crfs), // mcrfs
RC_MNEMONIC(63, InsertVal(583, 21, 30), _D), // mffs
RC_MNEMONIC(63, InsertVal(70, 21, 30), _Crbd), // mtfsb0
RC_MNEMONIC(63, InsertVal(38, 21, 30), _Crbd), // mtfsb1
RC_MNEMONIC(63, InsertVal(711, 21, 30), _FM, _B), // mtfsf
RC_MNEMONIC(63, InsertVal(134, 21, 30), _Crfd, _IMM), // mtfsfi
MNEMONIC(63, InsertVal(64, 21, 30), OpDesc_Crfd, OpDesc_Crfs), // mcrfs
RC_MNEMONIC(63, InsertVal(583, 21, 30), OpDesc_D), // mffs
RC_MNEMONIC(63, InsertVal(70, 21, 30), OpDesc_Crbd), // mtfsb0
RC_MNEMONIC(63, InsertVal(38, 21, 30), OpDesc_Crbd), // mtfsb1
RC_MNEMONIC(63, InsertVal(711, 21, 30), OpDesc_FM, OpDesc_B), // mtfsf
RC_MNEMONIC(63, InsertVal(134, 21, 30), OpDesc_Crfd, OpDesc_IMM), // mtfsfi
// A-12
BASIC_MNEMONIC(34, _D, _Offd, _A), // lbz
BASIC_MNEMONIC(35, _D, _Offd, _A), // lbzu
MNEMONIC(31, InsertVal(119, 21, 30), _D, _A, _B), // lbzux
MNEMONIC(31, InsertVal(87, 21, 30), _D, _A, _B), // lbzx
BASIC_MNEMONIC(42, _D, _Offd, _A), // lha
BASIC_MNEMONIC(43, _D, _Offd, _A), // lhau
MNEMONIC(31, InsertVal(375, 21, 30), _D, _A, _B), // lhaux
MNEMONIC(31, InsertVal(343, 21, 30), _D, _A, _B), // lhax
BASIC_MNEMONIC(40, _D, _Offd, _A), // lhz
BASIC_MNEMONIC(41, _D, _Offd, _A), // lhzu
MNEMONIC(31, InsertVal(311, 21, 30), _D, _A, _B), // lhzux
MNEMONIC(31, InsertVal(279, 21, 30), _D, _A, _B), // lhzx
BASIC_MNEMONIC(32, _D, _Offd, _A), // lwz
BASIC_MNEMONIC(33, _D, _Offd, _A), // lwzu
MNEMONIC(31, InsertVal(55, 21, 30), _D, _A, _B), // lwzux
MNEMONIC(31, InsertVal(23, 21, 30), _D, _A, _B), // lwzx
BASIC_MNEMONIC(34, OpDesc_D, OpDesc_Offd, OpDesc_A), // lbz
BASIC_MNEMONIC(35, OpDesc_D, OpDesc_Offd, OpDesc_A), // lbzu
MNEMONIC(31, InsertVal(119, 21, 30), OpDesc_D, OpDesc_A, OpDesc_B), // lbzux
MNEMONIC(31, InsertVal(87, 21, 30), OpDesc_D, OpDesc_A, OpDesc_B), // lbzx
BASIC_MNEMONIC(42, OpDesc_D, OpDesc_Offd, OpDesc_A), // lha
BASIC_MNEMONIC(43, OpDesc_D, OpDesc_Offd, OpDesc_A), // lhau
MNEMONIC(31, InsertVal(375, 21, 30), OpDesc_D, OpDesc_A, OpDesc_B), // lhaux
MNEMONIC(31, InsertVal(343, 21, 30), OpDesc_D, OpDesc_A, OpDesc_B), // lhax
BASIC_MNEMONIC(40, OpDesc_D, OpDesc_Offd, OpDesc_A), // lhz
BASIC_MNEMONIC(41, OpDesc_D, OpDesc_Offd, OpDesc_A), // lhzu
MNEMONIC(31, InsertVal(311, 21, 30), OpDesc_D, OpDesc_A, OpDesc_B), // lhzux
MNEMONIC(31, InsertVal(279, 21, 30), OpDesc_D, OpDesc_A, OpDesc_B), // lhzx
BASIC_MNEMONIC(32, OpDesc_D, OpDesc_Offd, OpDesc_A), // lwz
BASIC_MNEMONIC(33, OpDesc_D, OpDesc_Offd, OpDesc_A), // lwzu
MNEMONIC(31, InsertVal(55, 21, 30), OpDesc_D, OpDesc_A, OpDesc_B), // lwzux
MNEMONIC(31, InsertVal(23, 21, 30), OpDesc_D, OpDesc_A, OpDesc_B), // lwzx
// A-13
BASIC_MNEMONIC(38, _S, _Offd, _A), // stb
BASIC_MNEMONIC(39, _S, _Offd, _A), // stbu
MNEMONIC(31, InsertVal(247, 21, 30), _S, _A, _B), // stbux
MNEMONIC(31, InsertVal(215, 21, 30), _S, _A, _B), // stbx
BASIC_MNEMONIC(44, _S, _Offd, _A), // sth
BASIC_MNEMONIC(45, _S, _Offd, _A), // sthu
MNEMONIC(31, InsertVal(439, 21, 30), _S, _A, _B), // sthux
MNEMONIC(31, InsertVal(407, 21, 30), _S, _A, _B), // sthx
BASIC_MNEMONIC(36, _S, _Offd, _A), // stw
BASIC_MNEMONIC(37, _S, _Offd, _A), // stwu
MNEMONIC(31, InsertVal(183, 21, 30), _S, _A, _B), // stwux
MNEMONIC(31, InsertVal(151, 21, 30), _S, _A, _B), // stwx
BASIC_MNEMONIC(38, OpDesc_S, OpDesc_Offd, OpDesc_A), // stb
BASIC_MNEMONIC(39, OpDesc_S, OpDesc_Offd, OpDesc_A), // stbu
MNEMONIC(31, InsertVal(247, 21, 30), OpDesc_S, OpDesc_A, OpDesc_B), // stbux
MNEMONIC(31, InsertVal(215, 21, 30), OpDesc_S, OpDesc_A, OpDesc_B), // stbx
BASIC_MNEMONIC(44, OpDesc_S, OpDesc_Offd, OpDesc_A), // sth
BASIC_MNEMONIC(45, OpDesc_S, OpDesc_Offd, OpDesc_A), // sthu
MNEMONIC(31, InsertVal(439, 21, 30), OpDesc_S, OpDesc_A, OpDesc_B), // sthux
MNEMONIC(31, InsertVal(407, 21, 30), OpDesc_S, OpDesc_A, OpDesc_B), // sthx
BASIC_MNEMONIC(36, OpDesc_S, OpDesc_Offd, OpDesc_A), // stw
BASIC_MNEMONIC(37, OpDesc_S, OpDesc_Offd, OpDesc_A), // stwu
MNEMONIC(31, InsertVal(183, 21, 30), OpDesc_S, OpDesc_A, OpDesc_B), // stwux
MNEMONIC(31, InsertVal(151, 21, 30), OpDesc_S, OpDesc_A, OpDesc_B), // stwx
// A-14
MNEMONIC(31, InsertVal(790, 21, 30), _D, _A, _B), // lhbrx
MNEMONIC(31, InsertVal(534, 21, 30), _D, _A, _B), // lwbrx
MNEMONIC(31, InsertVal(918, 21, 30), _S, _A, _B), // sthbrx
MNEMONIC(31, InsertVal(662, 21, 30), _S, _A, _B), // stwbrx
MNEMONIC(31, InsertVal(790, 21, 30), OpDesc_D, OpDesc_A, OpDesc_B), // lhbrx
MNEMONIC(31, InsertVal(534, 21, 30), OpDesc_D, OpDesc_A, OpDesc_B), // lwbrx
MNEMONIC(31, InsertVal(918, 21, 30), OpDesc_S, OpDesc_A, OpDesc_B), // sthbrx
MNEMONIC(31, InsertVal(662, 21, 30), OpDesc_S, OpDesc_A, OpDesc_B), // stwbrx
// A-15
BASIC_MNEMONIC(46, _D, _Offd, _A), // lmw
BASIC_MNEMONIC(47, _S, _Offd, _A), // stmw
BASIC_MNEMONIC(46, OpDesc_D, OpDesc_Offd, OpDesc_A), // lmw
BASIC_MNEMONIC(47, OpDesc_S, OpDesc_Offd, OpDesc_A), // stmw
// A-16
MNEMONIC(31, InsertVal(597, 21, 30), _D, _A, _NB), // lswi
MNEMONIC(31, InsertVal(533, 21, 30), _D, _A, _B), // lswx
MNEMONIC(31, InsertVal(725, 21, 30), _S, _A, _NB), // stswi
MNEMONIC(31, InsertVal(661, 21, 30), _S, _A, _B), // stswx
MNEMONIC(31, InsertVal(597, 21, 30), OpDesc_D, OpDesc_A, OpDesc_NB), // lswi
MNEMONIC(31, InsertVal(533, 21, 30), OpDesc_D, OpDesc_A, OpDesc_B), // lswx
MNEMONIC(31, InsertVal(725, 21, 30), OpDesc_S, OpDesc_A, OpDesc_NB), // stswi
MNEMONIC(31, InsertVal(661, 21, 30), OpDesc_S, OpDesc_A, OpDesc_B), // stswx
// A-17
MNEMONIC(31, InsertVal(854, 21, 30)), // eieio
MNEMONIC(19, InsertVal(150, 21, 30)), // isync
MNEMONIC(31, InsertVal(20, 21, 30), _D, _A, _B), // lwarx
MNEMONIC(31, InsertVal(150, 21, 30) | InsertVal(1, 31, 31), _S, _A, _B), // stwcx.
MNEMONIC(31, InsertVal(598, 21, 30)), // sync
MNEMONIC(31, InsertVal(854, 21, 30)), // eieio
MNEMONIC(19, InsertVal(150, 21, 30)), // isync
MNEMONIC(31, InsertVal(20, 21, 30), OpDesc_D, OpDesc_A, OpDesc_B), // lwarx
MNEMONIC(31, InsertVal(150, 21, 30) | InsertVal(1, 31, 31), OpDesc_S, OpDesc_A,
OpDesc_B), // stwcx.
MNEMONIC(31, InsertVal(598, 21, 30)), // sync
// A-18
BASIC_MNEMONIC(50, _D, _Offd, _A), // lfd
BASIC_MNEMONIC(51, _D, _Offd, _A), // lfdu
MNEMONIC(31, InsertVal(631, 21, 30), _D, _A, _B), // lfdux
MNEMONIC(31, InsertVal(599, 21, 30), _D, _A, _B), // lfdx
BASIC_MNEMONIC(48, _D, _Offd, _A), // lfs
BASIC_MNEMONIC(49, _D, _Offd, _A), // lfsu
MNEMONIC(31, InsertVal(567, 21, 30), _D, _A, _B), // lfsux
MNEMONIC(31, InsertVal(535, 21, 30), _D, _A, _B), // lfsx
BASIC_MNEMONIC(50, OpDesc_D, OpDesc_Offd, OpDesc_A), // lfd
BASIC_MNEMONIC(51, OpDesc_D, OpDesc_Offd, OpDesc_A), // lfdu
MNEMONIC(31, InsertVal(631, 21, 30), OpDesc_D, OpDesc_A, OpDesc_B), // lfdux
MNEMONIC(31, InsertVal(599, 21, 30), OpDesc_D, OpDesc_A, OpDesc_B), // lfdx
BASIC_MNEMONIC(48, OpDesc_D, OpDesc_Offd, OpDesc_A), // lfs
BASIC_MNEMONIC(49, OpDesc_D, OpDesc_Offd, OpDesc_A), // lfsu
MNEMONIC(31, InsertVal(567, 21, 30), OpDesc_D, OpDesc_A, OpDesc_B), // lfsux
MNEMONIC(31, InsertVal(535, 21, 30), OpDesc_D, OpDesc_A, OpDesc_B), // lfsx
// A-19
BASIC_MNEMONIC(54, _S, _Offd, _A), // stfd
BASIC_MNEMONIC(55, _S, _Offd, _A), // stfdu
MNEMONIC(31, InsertVal(759, 21, 30), _S, _A, _B), // stfdux
MNEMONIC(31, InsertVal(727, 21, 30), _S, _A, _B), // stfdx
MNEMONIC(31, InsertVal(983, 21, 30), _S, _A, _B), // stfiwx
BASIC_MNEMONIC(52, _S, _Offd, _A), // stfs
BASIC_MNEMONIC(53, _S, _Offd, _A), // stfsu
MNEMONIC(31, InsertVal(695, 21, 30), _S, _A, _B), // stfsux
MNEMONIC(31, InsertVal(663, 21, 30), _S, _A, _B), // stfsx
BASIC_MNEMONIC(54, OpDesc_S, OpDesc_Offd, OpDesc_A), // stfd
BASIC_MNEMONIC(55, OpDesc_S, OpDesc_Offd, OpDesc_A), // stfdu
MNEMONIC(31, InsertVal(759, 21, 30), OpDesc_S, OpDesc_A, OpDesc_B), // stfdux
MNEMONIC(31, InsertVal(727, 21, 30), OpDesc_S, OpDesc_A, OpDesc_B), // stfdx
MNEMONIC(31, InsertVal(983, 21, 30), OpDesc_S, OpDesc_A, OpDesc_B), // stfiwx
BASIC_MNEMONIC(52, OpDesc_S, OpDesc_Offd, OpDesc_A), // stfs
BASIC_MNEMONIC(53, OpDesc_S, OpDesc_Offd, OpDesc_A), // stfsu
MNEMONIC(31, InsertVal(695, 21, 30), OpDesc_S, OpDesc_A, OpDesc_B), // stfsux
MNEMONIC(31, InsertVal(663, 21, 30), OpDesc_S, OpDesc_A, OpDesc_B), // stfsx
// A-20
RC_MNEMONIC(63, InsertVal(264, 21, 30), _D, _B), // fabs
RC_MNEMONIC(63, InsertVal(72, 21, 30), _D, _B), // fmr
RC_MNEMONIC(63, InsertVal(136, 21, 30), _D, _B), // fnabs
RC_MNEMONIC(63, InsertVal(40, 21, 30), _D, _B), // fneg
RC_MNEMONIC(63, InsertVal(264, 21, 30), OpDesc_D, OpDesc_B), // fabs
RC_MNEMONIC(63, InsertVal(72, 21, 30), OpDesc_D, OpDesc_B), // fmr
RC_MNEMONIC(63, InsertVal(136, 21, 30), OpDesc_D, OpDesc_B), // fnabs
RC_MNEMONIC(63, InsertVal(40, 21, 30), OpDesc_D, OpDesc_B), // fneg
// A-21
AALK_MNEMONIC(18, 0, _LI), // b
AALK_MNEMONIC(16, 0, _BO, _BI, _BD), // bc
LK_MNEMONIC(19, InsertVal(528, 21, 30), _BO, _BI), // bcctr
LK_MNEMONIC(19, InsertVal(16, 21, 30), _BO, _BI), // bclr
AALK_MNEMONIC(18, 0, OpDesc_LI), // b
AALK_MNEMONIC(16, 0, OpDesc_BO, OpDesc_BI, OpDesc_BD), // bc
LK_MNEMONIC(19, InsertVal(528, 21, 30), OpDesc_BO, OpDesc_BI), // bcctr
LK_MNEMONIC(19, InsertVal(16, 21, 30), OpDesc_BO, OpDesc_BI), // bclr
// A-22
MNEMONIC(19, InsertVal(257, 21, 30), _Crbd, _Crba, _Crbb), // crand
MNEMONIC(19, InsertVal(129, 21, 30), _Crbd, _Crba, _Crbb), // crandc
MNEMONIC(19, InsertVal(289, 21, 30), _Crbd, _Crba, _Crbb), // creqv
MNEMONIC(19, InsertVal(225, 21, 30), _Crbd, _Crba, _Crbb), // crnand
MNEMONIC(19, InsertVal(33, 21, 30), _Crbd, _Crba, _Crbb), // crnor
MNEMONIC(19, InsertVal(449, 21, 30), _Crbd, _Crba, _Crbb), // cror
MNEMONIC(19, InsertVal(417, 21, 30), _Crbd, _Crba, _Crbb), // crorc
MNEMONIC(19, InsertVal(193, 21, 30), _Crbd, _Crba, _Crbb), // crxor
MNEMONIC(19, InsertVal(0, 21, 30), _Crfd, _Crfs), // mcrf
MNEMONIC(19, InsertVal(257, 21, 30), OpDesc_Crbd, OpDesc_Crba, OpDesc_Crbb), // crand
MNEMONIC(19, InsertVal(129, 21, 30), OpDesc_Crbd, OpDesc_Crba, OpDesc_Crbb), // crandc
MNEMONIC(19, InsertVal(289, 21, 30), OpDesc_Crbd, OpDesc_Crba, OpDesc_Crbb), // creqv
MNEMONIC(19, InsertVal(225, 21, 30), OpDesc_Crbd, OpDesc_Crba, OpDesc_Crbb), // crnand
MNEMONIC(19, InsertVal(33, 21, 30), OpDesc_Crbd, OpDesc_Crba, OpDesc_Crbb), // crnor
MNEMONIC(19, InsertVal(449, 21, 30), OpDesc_Crbd, OpDesc_Crba, OpDesc_Crbb), // cror
MNEMONIC(19, InsertVal(417, 21, 30), OpDesc_Crbd, OpDesc_Crba, OpDesc_Crbb), // crorc
MNEMONIC(19, InsertVal(193, 21, 30), OpDesc_Crbd, OpDesc_Crba, OpDesc_Crbb), // crxor
MNEMONIC(19, InsertVal(0, 21, 30), OpDesc_Crfd, OpDesc_Crfs), // mcrf
// A-23
MNEMONIC(19, InsertVal(50, 21, 30)), // rfi
MNEMONIC(17, InsertVal(1, 30, 30)), // sc
// A-24
MNEMONIC(31, InsertVal(4, 21, 30), _TO, _A, _B), // tw
BASIC_MNEMONIC(3, _TO, _A, _SIMM), // twi
MNEMONIC(31, InsertVal(4, 21, 30), OpDesc_TO, OpDesc_A, OpDesc_B), // tw
BASIC_MNEMONIC(3, OpDesc_TO, OpDesc_A, OpDesc_SIMM), // twi
// A-25
MNEMONIC(31, InsertVal(512, 21, 30), _Crfd), // mcrxr
MNEMONIC(31, InsertVal(19, 21, 30), _D), // mfcr
MNEMONIC(31, InsertVal(83, 21, 30), _D), // mfmsr
MNEMONIC(31, InsertVal(339, 21, 30), _D, _SPR), // mfspr
MNEMONIC(31, InsertVal(371, 21, 30), _D, _TPR), // mftb
MNEMONIC(31, InsertVal(144, 21, 30), _CRM, _S), // mtcrf
MNEMONIC(31, InsertVal(146, 21, 30), _S), // mtmsr
MNEMONIC(31, InsertVal(467, 21, 30), _SPR, _D), // mtspr
MNEMONIC(31, InsertVal(512, 21, 30), OpDesc_Crfd), // mcrxr
MNEMONIC(31, InsertVal(19, 21, 30), OpDesc_D), // mfcr
MNEMONIC(31, InsertVal(83, 21, 30), OpDesc_D), // mfmsr
MNEMONIC(31, InsertVal(339, 21, 30), OpDesc_D, OpDesc_SPR), // mfspr
MNEMONIC(31, InsertVal(371, 21, 30), OpDesc_D, OpDesc_TPR), // mftb
MNEMONIC(31, InsertVal(144, 21, 30), OpDesc_CRM, OpDesc_S), // mtcrf
MNEMONIC(31, InsertVal(146, 21, 30), OpDesc_S), // mtmsr
MNEMONIC(31, InsertVal(467, 21, 30), OpDesc_SPR, OpDesc_D), // mtspr
// A-26
MNEMONIC(31, InsertVal(86, 21, 30), _A, _B), // dcbf
MNEMONIC(31, InsertVal(470, 21, 30), _A, _B), // dcbi
MNEMONIC(31, InsertVal(54, 21, 30), _A, _B), // dcbst
MNEMONIC(31, InsertVal(278, 21, 30), _A, _B), // dcbt
MNEMONIC(31, InsertVal(246, 21, 30), _A, _B), // dcbtst
MNEMONIC(31, InsertVal(1014, 21, 30), _A, _B), // dcbz
MNEMONIC(31, InsertVal(982, 21, 30), _A, _B), // icbi
MNEMONIC(31, InsertVal(86, 21, 30), OpDesc_A, OpDesc_B), // dcbf
MNEMONIC(31, InsertVal(470, 21, 30), OpDesc_A, OpDesc_B), // dcbi
MNEMONIC(31, InsertVal(54, 21, 30), OpDesc_A, OpDesc_B), // dcbst
MNEMONIC(31, InsertVal(278, 21, 30), OpDesc_A, OpDesc_B), // dcbt
MNEMONIC(31, InsertVal(246, 21, 30), OpDesc_A, OpDesc_B), // dcbtst
MNEMONIC(31, InsertVal(1014, 21, 30), OpDesc_A, OpDesc_B), // dcbz
MNEMONIC(31, InsertVal(982, 21, 30), OpDesc_A, OpDesc_B), // icbi
// A-27
MNEMONIC(31, InsertVal(595, 21, 30), _D, _SR), // mfsr
MNEMONIC(31, InsertVal(659, 21, 30), _D, _B), // mfsrin
MNEMONIC(31, InsertVal(210, 21, 30), _SR, _S), // mtsr
MNEMONIC(31, InsertVal(242, 21, 30), _S, _B), // mtsrin
MNEMONIC(31, InsertVal(595, 21, 30), OpDesc_D, OpDesc_SR), // mfsr
MNEMONIC(31, InsertVal(659, 21, 30), OpDesc_D, OpDesc_B), // mfsrin
MNEMONIC(31, InsertVal(210, 21, 30), OpDesc_SR, OpDesc_S), // mtsr
MNEMONIC(31, InsertVal(242, 21, 30), OpDesc_S, OpDesc_B), // mtsrin
// A-28
MNEMONIC(31, InsertVal(306, 21, 30), _B), // tlbie
MNEMONIC(31, InsertVal(566, 21, 30)), // tlbsync
MNEMONIC(31, InsertVal(306, 21, 30), OpDesc_B), // tlbie
MNEMONIC(31, InsertVal(566, 21, 30)), // tlbsync
// A-29
MNEMONIC(31, InsertVal(310, 21, 30), _D, _A, _B), // eciwx
MNEMONIC(31, InsertVal(438, 21, 30), _S, _A, _B), // ecowx
MNEMONIC(31, InsertVal(310, 21, 30), OpDesc_D, OpDesc_A, OpDesc_B), // eciwx
MNEMONIC(31, InsertVal(438, 21, 30), OpDesc_S, OpDesc_A, OpDesc_B), // ecowx
// A-30
MNEMONIC(4, InsertVal(6, 25, 30), _D, _A, _B, _W2, _I2), // psq_lx
MNEMONIC(4, InsertVal(7, 25, 30), _S, _A, _B, _W2, _I2), // psq_stx
MNEMONIC(4, InsertVal(38, 25, 30), _D, _A, _B, _W2, _I2), // psq_lux
MNEMONIC(4, InsertVal(39, 25, 30), _S, _A, _B, _W2, _I2), // psq_stux
BASIC_MNEMONIC(56, _D, _OffdPs, _A, _W1, _I1), // psq_l
BASIC_MNEMONIC(57, _D, _OffdPs, _A, _W1, _I1), // psq_lu
BASIC_MNEMONIC(60, _S, _OffdPs, _A, _W1, _I1), // psq_st
BASIC_MNEMONIC(61, _S, _OffdPs, _A, _W1, _I1), // psq_stu
MNEMONIC(4, InsertVal(6, 25, 30), OpDesc_D, OpDesc_A, OpDesc_B, OpDesc_W2,
OpDesc_I2), // psq_lx
MNEMONIC(4, InsertVal(7, 25, 30), OpDesc_S, OpDesc_A, OpDesc_B, OpDesc_W2,
OpDesc_I2), // psq_stx
MNEMONIC(4, InsertVal(38, 25, 30), OpDesc_D, OpDesc_A, OpDesc_B, OpDesc_W2,
OpDesc_I2), // psq_lux
MNEMONIC(4, InsertVal(39, 25, 30), OpDesc_S, OpDesc_A, OpDesc_B, OpDesc_W2,
OpDesc_I2), // psq_stux
BASIC_MNEMONIC(56, OpDesc_D, OpDesc_OffdPs, OpDesc_A, OpDesc_W1, OpDesc_I1), // psq_l
BASIC_MNEMONIC(57, OpDesc_D, OpDesc_OffdPs, OpDesc_A, OpDesc_W1, OpDesc_I1), // psq_lu
BASIC_MNEMONIC(60, OpDesc_S, OpDesc_OffdPs, OpDesc_A, OpDesc_W1, OpDesc_I1), // psq_st
BASIC_MNEMONIC(61, OpDesc_S, OpDesc_OffdPs, OpDesc_A, OpDesc_W1, OpDesc_I1), // psq_stu
// A-31
RC_MNEMONIC(4, InsertVal(18, 26, 30), _D, _A, _B), // ps_div
RC_MNEMONIC(4, InsertVal(20, 26, 30), _D, _A, _B), // ps_sub
RC_MNEMONIC(4, InsertVal(21, 26, 30), _D, _A, _B), // ps_add
RC_MNEMONIC(4, InsertVal(23, 26, 30), _D, _A, _C, _B), // ps_sel
RC_MNEMONIC(4, InsertVal(24, 26, 30), _D, _B), // ps_res
RC_MNEMONIC(4, InsertVal(25, 26, 30), _D, _A, _C), // ps_mul
RC_MNEMONIC(4, InsertVal(26, 26, 30), _D, _B), // ps_rsqrte
RC_MNEMONIC(4, InsertVal(28, 26, 30), _D, _A, _C, _B), // ps_msub
RC_MNEMONIC(4, InsertVal(29, 26, 30), _D, _A, _C, _B), // ps_madd
RC_MNEMONIC(4, InsertVal(30, 26, 30), _D, _A, _C, _B), // ps_nmsub
RC_MNEMONIC(4, InsertVal(31, 26, 30), _D, _A, _C, _B), // ps_nmadd
RC_MNEMONIC(4, InsertVal(40, 21, 30), _D, _B), // ps_neg
RC_MNEMONIC(4, InsertVal(72, 21, 30), _D, _B), // ps_mr
RC_MNEMONIC(4, InsertVal(136, 21, 30), _D, _B), // ps_nabs
RC_MNEMONIC(4, InsertVal(264, 21, 30), _D, _B), // ps_abs
RC_MNEMONIC(4, InsertVal(18, 26, 30), OpDesc_D, OpDesc_A, OpDesc_B), // ps_div
RC_MNEMONIC(4, InsertVal(20, 26, 30), OpDesc_D, OpDesc_A, OpDesc_B), // ps_sub
RC_MNEMONIC(4, InsertVal(21, 26, 30), OpDesc_D, OpDesc_A, OpDesc_B), // ps_add
RC_MNEMONIC(4, InsertVal(23, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C, OpDesc_B), // ps_sel
RC_MNEMONIC(4, InsertVal(24, 26, 30), OpDesc_D, OpDesc_B), // ps_res
RC_MNEMONIC(4, InsertVal(25, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C), // ps_mul
RC_MNEMONIC(4, InsertVal(26, 26, 30), OpDesc_D, OpDesc_B), // ps_rsqrte
RC_MNEMONIC(4, InsertVal(28, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C, OpDesc_B), // ps_msub
RC_MNEMONIC(4, InsertVal(29, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C, OpDesc_B), // ps_madd
RC_MNEMONIC(4, InsertVal(30, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C, OpDesc_B), // ps_nmsub
RC_MNEMONIC(4, InsertVal(31, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C, OpDesc_B), // ps_nmadd
RC_MNEMONIC(4, InsertVal(40, 21, 30), OpDesc_D, OpDesc_B), // ps_neg
RC_MNEMONIC(4, InsertVal(72, 21, 30), OpDesc_D, OpDesc_B), // ps_mr
RC_MNEMONIC(4, InsertVal(136, 21, 30), OpDesc_D, OpDesc_B), // ps_nabs
RC_MNEMONIC(4, InsertVal(264, 21, 30), OpDesc_D, OpDesc_B), // ps_abs
// A-32
RC_MNEMONIC(4, InsertVal(10, 26, 30), _D, _A, _C, _B), // ps_sum0
RC_MNEMONIC(4, InsertVal(11, 26, 30), _D, _A, _C, _B), // ps_sum1
RC_MNEMONIC(4, InsertVal(12, 26, 30), _D, _A, _C), // ps_muls0
RC_MNEMONIC(4, InsertVal(13, 26, 30), _D, _A, _C), // ps_muls1
RC_MNEMONIC(4, InsertVal(14, 26, 30), _D, _A, _C, _B), // ps_madds0
RC_MNEMONIC(4, InsertVal(15, 26, 30), _D, _A, _C, _B), // ps_madds1
MNEMONIC(4, InsertVal(0, 21, 30), _Crfd, _A, _B), // ps_cmpu0
MNEMONIC(4, InsertVal(32, 21, 30), _Crfd, _A, _B), // ps_cmpo0
MNEMONIC(4, InsertVal(64, 21, 30), _Crfd, _A, _B), // ps_cmpu1
MNEMONIC(4, InsertVal(96, 21, 30), _Crfd, _A, _B), // ps_cmpo1
RC_MNEMONIC(4, InsertVal(528, 21, 30), _D, _A, _B), // ps_merge00
RC_MNEMONIC(4, InsertVal(560, 21, 30), _D, _A, _B), // ps_merge01
RC_MNEMONIC(4, InsertVal(592, 21, 30), _D, _A, _B), // ps_merge10
RC_MNEMONIC(4, InsertVal(624, 21, 30), _D, _A, _B), // ps_merge11
MNEMONIC(4, InsertVal(1014, 21, 30), _A, _B), // dcbz_l
RC_MNEMONIC(4, InsertVal(10, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C, OpDesc_B), // ps_sum0
RC_MNEMONIC(4, InsertVal(11, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C, OpDesc_B), // ps_sum1
RC_MNEMONIC(4, InsertVal(12, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C), // ps_muls0
RC_MNEMONIC(4, InsertVal(13, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C), // ps_muls1
RC_MNEMONIC(4, InsertVal(14, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C, OpDesc_B), // ps_madds0
RC_MNEMONIC(4, InsertVal(15, 26, 30), OpDesc_D, OpDesc_A, OpDesc_C, OpDesc_B), // ps_madds1
MNEMONIC(4, InsertVal(0, 21, 30), OpDesc_Crfd, OpDesc_A, OpDesc_B), // ps_cmpu0
MNEMONIC(4, InsertVal(32, 21, 30), OpDesc_Crfd, OpDesc_A, OpDesc_B), // ps_cmpo0
MNEMONIC(4, InsertVal(64, 21, 30), OpDesc_Crfd, OpDesc_A, OpDesc_B), // ps_cmpu1
MNEMONIC(4, InsertVal(96, 21, 30), OpDesc_Crfd, OpDesc_A, OpDesc_B), // ps_cmpo1
RC_MNEMONIC(4, InsertVal(528, 21, 30), OpDesc_D, OpDesc_A, OpDesc_B), // ps_merge00
RC_MNEMONIC(4, InsertVal(560, 21, 30), OpDesc_D, OpDesc_A, OpDesc_B), // ps_merge01
RC_MNEMONIC(4, InsertVal(592, 21, 30), OpDesc_D, OpDesc_A, OpDesc_B), // ps_merge10
RC_MNEMONIC(4, InsertVal(624, 21, 30), OpDesc_D, OpDesc_A, OpDesc_B), // ps_merge11
MNEMONIC(4, InsertVal(1014, 21, 30), OpDesc_A, OpDesc_B), // dcbz_l
};
namespace

View file

@ -4,6 +4,7 @@
#include "Common/Assembler/GekkoLexer.h"
#include "Common/Assert.h"
#include "Common/StringUtil.h"
#include <iterator>
#include <numeric>
@ -181,6 +182,11 @@ std::optional<T> EvalIntegral(TokenType tp, std::string_view val)
case TokenType::BinaryLit:
return std::accumulate(val.begin() + 2, val.end(), T{0}, bin_step);
case TokenType::GPR:
if (CaseInsensitiveEquals(val, "sp"))
return T{1};
if (CaseInsensitiveEquals(val, "rtoc"))
return T{2};
[[fallthrough]];
case TokenType::FPR:
return std::accumulate(val.begin() + 1, val.end(), T{0}, dec_step);
case TokenType::CRField:
@ -643,50 +649,43 @@ TokenType Lexer::ClassifyAlnum() const
if (rn[0] == '3')
{
return rn[1] <= '2';
return rn[1] < '2';
}
}
return false;
};
constexpr auto eq_nocase = [](std::string_view str, std::string_view lwr) {
auto it_l = str.cbegin(), it_r = lwr.cbegin();
for (; it_l != str.cend() && it_r != lwr.cend(); it_l++, it_r++)
{
if (std::tolower(*it_l) != *it_r)
{
return false;
}
}
return it_l == str.end() && it_r == lwr.end();
};
if (std::tolower(alnum[0]) == 'r' && valid_regnum(alnum.substr(1)))
{
return TokenType::GPR;
}
else if ((CaseInsensitiveEquals(alnum, "sp")) || (CaseInsensitiveEquals(alnum, "rtoc")))
{
return TokenType::GPR;
}
else if (std::tolower(alnum[0]) == 'f' && valid_regnum(alnum.substr(1)))
{
return TokenType::FPR;
}
else if (alnum.length() == 3 && eq_nocase(alnum.substr(0, 2), "cr") && alnum[2] >= '0' &&
alnum[2] <= '7')
else if (alnum.length() == 3 && CaseInsensitiveEquals(alnum.substr(0, 2), "cr") &&
alnum[2] >= '0' && alnum[2] <= '7')
{
return TokenType::CRField;
}
else if (eq_nocase(alnum, "lt"))
else if (CaseInsensitiveEquals(alnum, "lt"))
{
return TokenType::Lt;
}
else if (eq_nocase(alnum, "gt"))
else if (CaseInsensitiveEquals(alnum, "gt"))
{
return TokenType::Gt;
}
else if (eq_nocase(alnum, "eq"))
else if (CaseInsensitiveEquals(alnum, "eq"))
{
return TokenType::Eq;
}
else if (eq_nocase(alnum, "so"))
else if (CaseInsensitiveEquals(alnum, "so"))
{
return TokenType::So;
}

View file

@ -312,7 +312,7 @@ class BitFieldArrayConstRef
friend class BitFieldArrayConstIterator<position, bits, size, T, S>;
public:
constexpr T Value() const { return m_array->Value(m_index); };
constexpr T Value() const { return m_array->Value(m_index); }
constexpr operator T() const { return Value(); }
private:
@ -333,7 +333,7 @@ class BitFieldArrayRef
friend class BitFieldArrayIterator<position, bits, size, T, S>;
public:
constexpr T Value() const { return m_array->Value(m_index); };
constexpr T Value() const { return m_array->Value(m_index); }
constexpr operator T() const { return Value(); }
T operator=(const BitFieldArrayRef<position, bits, size, T, S>& value) const
{

View file

@ -4,6 +4,7 @@
#pragma once
#include <array>
#include <bit>
#include <climits>
#include <cstddef>
#include <cstdint>
@ -166,50 +167,10 @@ inline auto BitCastPtr(PtrType* ptr) noexcept -> BitCastPtrType<T, PtrType>
}
// Similar to BitCastPtr, but specifically for aliasing structs to arrays.
template <typename ArrayType, typename T,
typename Container = std::array<ArrayType, sizeof(T) / sizeof(ArrayType)>>
inline auto BitCastToArray(const T& obj) noexcept -> Container
template <typename ValueType, typename From>
[[nodiscard]] constexpr auto BitCastToArray(const From& obj) noexcept
{
static_assert(sizeof(T) % sizeof(ArrayType) == 0,
"Size of array type must be a factor of size of source type.");
static_assert(std::is_trivially_copyable<T>(),
"BitCastToArray source type must be trivially copyable.");
static_assert(std::is_trivially_copyable<Container>(),
"BitCastToArray array type must be trivially copyable.");
Container result;
std::memcpy(result.data(), &obj, sizeof(T));
return result;
}
template <typename ArrayType, typename T,
typename Container = std::array<ArrayType, sizeof(T) / sizeof(ArrayType)>>
inline void BitCastFromArray(const Container& array, T& obj) noexcept
{
static_assert(sizeof(T) % sizeof(ArrayType) == 0,
"Size of array type must be a factor of size of destination type.");
static_assert(std::is_trivially_copyable<Container>(),
"BitCastFromArray array type must be trivially copyable.");
static_assert(std::is_trivially_copyable<T>(),
"BitCastFromArray destination type must be trivially copyable.");
std::memcpy(&obj, array.data(), sizeof(T));
}
template <typename ArrayType, typename T,
typename Container = std::array<ArrayType, sizeof(T) / sizeof(ArrayType)>>
inline auto BitCastFromArray(const Container& array) noexcept -> T
{
static_assert(sizeof(T) % sizeof(ArrayType) == 0,
"Size of array type must be a factor of size of destination type.");
static_assert(std::is_trivially_copyable<Container>(),
"BitCastFromArray array type must be trivially copyable.");
static_assert(std::is_trivially_copyable<T>(),
"BitCastFromArray destination type must be trivially copyable.");
T obj;
std::memcpy(&obj, array.data(), sizeof(T));
return obj;
return std::bit_cast<std::array<ValueType, sizeof(From) / sizeof(ValueType)>>(obj);
}
template <typename T>

View file

@ -87,6 +87,7 @@ add_library(common
JitRegister.cpp
JitRegister.h
JsonUtil.h
JsonUtil.cpp
Lazy.h
LinearDiskCache.h
Logging/ConsoleListener.h
@ -143,6 +144,7 @@ add_library(common
TraversalClient.h
TraversalProto.h
TypeUtils.h
Unreachable.h
UPnP.cpp
UPnP.h
VariantUtil.h

View file

@ -17,7 +17,7 @@ namespace Common
// having to prefix them with gen-> or something similar.
// Example implementation:
// class JIT : public CodeBlock<ARMXEmitter> {}
template <class T>
template <class T, bool executable = true>
class CodeBlock : public T
{
private:
@ -53,7 +53,10 @@ public:
{
region_size = size;
total_region_size = size;
region = static_cast<u8*>(Common::AllocateExecutableMemory(total_region_size));
if constexpr (executable)
region = static_cast<u8*>(Common::AllocateExecutableMemory(total_region_size));
else
region = static_cast<u8*>(Common::AllocateMemoryPages(total_region_size));
T::SetCodePtr(region, region + size);
}

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "Common/ColorUtil.h"
#include "Common/Swap.h"
namespace Common

View file

@ -37,7 +37,7 @@ __declspec(dllimport) void __stdcall DebugBreak(void);
{ \
DebugBreak(); \
}
#endif // WIN32 ndef
#endif // _WIN32
namespace Common
{

View file

@ -11,7 +11,6 @@
#define ROOT_DIR "."
// The normal user directory
#ifndef STEAM
#ifdef _WIN32
#define NORMAL_USER_DIR "Dolphin Emulator"
#elif defined(__APPLE__)
@ -21,15 +20,6 @@
#else
#define NORMAL_USER_DIR "dolphin-emu"
#endif
#else // ifndef STEAM
#ifdef _WIN32
#define NORMAL_USER_DIR "Dolphin Emulator (Steam)"
#elif defined(__APPLE__)
#define NORMAL_USER_DIR "Library/Application Support/Dolphin (Steam)"
#else
#define NORMAL_USER_DIR "dolphin-emu-steam"
#endif
#endif
// The portable user directory
#ifdef _WIN32
@ -63,6 +53,7 @@
#define COVERCACHE_DIR "GameCovers"
#define REDUMPCACHE_DIR "Redump"
#define SHADERCACHE_DIR "Shaders"
#define RETROACHIEVEMENTSCACHE_DIR "RetroAchievements"
#define STATESAVES_DIR "StateSaves"
#define SCREENSHOTS_DIR "ScreenShots"
#define LOAD_DIR "Load"

View file

@ -261,4 +261,4 @@ int __cdecl EnableCompatPatches()
extern "C" {
__declspec(allocate(".CRT$XCZ")) decltype(&EnableCompatPatches)
enableCompatPatches = EnableCompatPatches;
};
}

View file

@ -1,6 +1,8 @@
// Copyright 2017 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "Common/Crypto/AES.h"
#include <array>
#include <bit>
#include <memory>
@ -9,7 +11,6 @@
#include "Common/Assert.h"
#include "Common/CPUDetect.h"
#include "Common/Crypto/AES.h"
#ifdef _MSC_VER
#include <intrin.h>

View file

@ -385,4 +385,20 @@ Digest CalculateDigest(const u8* msg, size_t len)
ctx->Update(msg, len);
return ctx->Finish();
}
std::string DigestToString(const Digest& digest)
{
static constexpr std::array<char, 16> lookup = {'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
std::string hash;
hash.reserve(digest.size() * 2);
for (size_t i = 0; i < digest.size(); ++i)
{
const u8 upper = static_cast<u8>((digest[i] >> 4) & 0xf);
const u8 lower = static_cast<u8>(digest[i] & 0xf);
hash.push_back(lookup[upper]);
hash.push_back(lookup[lower]);
}
return hash;
}
} // namespace Common::SHA1

View file

@ -6,6 +6,7 @@
#include <array>
#include <limits>
#include <memory>
#include <span>
#include <string_view>
#include <type_traits>
#include <vector>
@ -23,7 +24,11 @@ class Context
public:
virtual ~Context() = default;
virtual void Update(const u8* msg, size_t len) = 0;
void Update(const std::vector<u8>& msg) { return Update(msg.data(), msg.size()); }
void Update(std::span<const u8> msg) { return Update(msg.data(), msg.size()); }
void Update(std::string_view msg)
{
return Update(reinterpret_cast<const u8*>(msg.data()), msg.size());
}
virtual Digest Finish() = 0;
virtual bool HwAccelerated() const = 0;
};
@ -51,4 +56,6 @@ inline Digest CalculateDigest(const std::array<T, Size>& msg)
static_assert(std::is_trivially_copyable_v<T>);
return CalculateDigest(reinterpret_cast<const u8*>(msg.data()), sizeof(msg));
}
std::string DigestToString(const Digest& digest);
} // namespace Common::SHA1

View file

@ -14,7 +14,7 @@
namespace Core
{
class CPUThreadGuard;
};
}
namespace Common::Debug
{

View file

@ -553,7 +553,7 @@ bool SyncSDFolderToSDImage(const std::function<bool()>& cancelled, bool determin
}
MKFS_PARM options = {};
options.fmt = FM_FAT32;
options.fmt = FM_FAT32 | FM_SFD;
options.n_fat = 0; // Number of FATs: automatic
options.align = 1; // Alignment of the data region (in sectors)
options.n_root = 0; // Number of root directory entries: automatic (and unused for FAT32)

View file

@ -60,6 +60,10 @@
#include "jni/AndroidCommon/AndroidCommon.h"
#endif
#if defined(__FreeBSD__)
#include <sys/sysctl.h>
#endif
namespace fs = std::filesystem;
namespace File
@ -738,6 +742,15 @@ std::string GetExePath()
return PathToString(exe_path_absolute);
#elif defined(__APPLE__)
return GetBundleDirectory();
#elif defined(__FreeBSD__)
int name[4]{CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
size_t length = 0;
if (sysctl(name, 4, nullptr, &length, nullptr, 0) != 0 || length == 0)
return {};
std::string dolphin_exe_path(length, '\0');
if (sysctl(name, 4, dolphin_exe_path.data(), &length, nullptr, 0) != 0)
return {};
return dolphin_exe_path;
#else
char dolphin_exe_path[PATH_MAX];
ssize_t len = ::readlink("/proc/self/exe", dolphin_exe_path, sizeof(dolphin_exe_path));
@ -843,6 +856,8 @@ static void RebuildUserDirectories(unsigned int dir_index)
s_user_paths[D_COVERCACHE_IDX] = s_user_paths[D_CACHE_IDX] + COVERCACHE_DIR DIR_SEP;
s_user_paths[D_REDUMPCACHE_IDX] = s_user_paths[D_CACHE_IDX] + REDUMPCACHE_DIR DIR_SEP;
s_user_paths[D_SHADERCACHE_IDX] = s_user_paths[D_CACHE_IDX] + SHADERCACHE_DIR DIR_SEP;
s_user_paths[D_RETROACHIEVEMENTSCACHE_IDX] =
s_user_paths[D_CACHE_IDX] + RETROACHIEVEMENTSCACHE_DIR DIR_SEP;
s_user_paths[D_SHADERS_IDX] = s_user_paths[D_USER_IDX] + SHADERS_DIR DIR_SEP;
s_user_paths[D_STATESAVES_IDX] = s_user_paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP;
s_user_paths[D_SCREENSHOTS_IDX] = s_user_paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP;
@ -926,6 +941,8 @@ static void RebuildUserDirectories(unsigned int dir_index)
s_user_paths[D_COVERCACHE_IDX] = s_user_paths[D_CACHE_IDX] + COVERCACHE_DIR DIR_SEP;
s_user_paths[D_REDUMPCACHE_IDX] = s_user_paths[D_CACHE_IDX] + REDUMPCACHE_DIR DIR_SEP;
s_user_paths[D_SHADERCACHE_IDX] = s_user_paths[D_CACHE_IDX] + SHADERCACHE_DIR DIR_SEP;
s_user_paths[D_RETROACHIEVEMENTSCACHE_IDX] =
s_user_paths[D_CACHE_IDX] + RETROACHIEVEMENTSCACHE_DIR DIR_SEP;
break;
case D_GCUSER_IDX:

View file

@ -40,6 +40,7 @@ enum
D_COVERCACHE_IDX,
D_REDUMPCACHE_IDX,
D_SHADERCACHE_IDX,
D_RETROACHIEVEMENTSCACHE_IDX,
D_SHADERS_IDX,
D_STATESAVES_IDX,
D_SCREENSHOTS_IDX,

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "Common/GL/GLInterface/AGL.h"
#include "Common/Logging/Log.h"
// UpdateCachedDimensions and AttachContextToView contain calls to UI APIs, so they must only be

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "Common/GL/GLX11Window.h"
#include "Common/GL/GLContext.h"
GLX11Window::GLX11Window(Display* display, Window parent_window, Colormap color_map, Window window,

View file

@ -75,7 +75,7 @@ bool IniFile::Section::Get(std::string_view key, std::string* value,
bool IniFile::Section::Exists(std::string_view key) const
{
return values.find(key) != values.end();
return values.contains(key);
}
bool IniFile::Section::Delete(std::string_view key)

View file

@ -3,6 +3,10 @@
#include "Common/JsonUtil.h"
#include <fstream>
#include "Common/FileUtil.h"
picojson::object ToJsonObject(const Common::Vec3& vec)
{
picojson::object obj;
@ -38,3 +42,27 @@ std::optional<bool> ReadBoolFromJson(const picojson::object& obj, const std::str
return std::nullopt;
return it->second.get<bool>();
}
bool JsonToFile(const std::string& filename, const picojson::value& root, bool prettify)
{
std::ofstream json_stream;
File::OpenFStream(json_stream, filename, std::ios_base::out);
if (!json_stream.is_open())
{
return false;
}
json_stream << root.serialize(prettify);
return true;
}
bool JsonFromFile(const std::string& filename, picojson::value* root, std::string* error)
{
std::string json_data;
if (!File::ReadFileToString(filename, json_data))
{
return false;
}
*error = picojson::parse(*root, json_data);
return error->empty();
}

View file

@ -9,7 +9,6 @@
#include <picojson.h>
#include "Common/MathUtil.h"
#include "Common/Matrix.h"
// Ideally this would use a concept like, 'template <std::ranges::range Range>' to constrain it,
@ -47,7 +46,7 @@ std::optional<Type> ReadNumericFromJson(const picojson::object& obj, const std::
return std::nullopt;
if (!it->second.is<double>())
return std::nullopt;
return MathUtil::SaturatingCast<Type>(it->second.get<double>());
return static_cast<Type>(it->second.get<double>());
}
std::optional<std::string> ReadStringFromJson(const picojson::object& obj, const std::string& key);
@ -56,3 +55,6 @@ std::optional<bool> ReadBoolFromJson(const picojson::object& obj, const std::str
picojson::object ToJsonObject(const Common::Vec3& vec);
void FromJson(const picojson::object& obj, Common::Vec3& vec);
bool JsonToFile(const std::string& filename, const picojson::value& root, bool prettify = false);
bool JsonFromFile(const std::string& filename, picojson::value* root, std::string* error);

View file

@ -78,7 +78,7 @@ public:
{
static LdrDllNotifier notifier;
return notifier;
};
}
void Install(LdrObserver* observer);
void Uninstall(LdrObserver* observer);

View file

@ -54,7 +54,7 @@ public:
private:
Profiler* m_p;
};
}; // namespace Common
} // namespace Common
// Warning: This profiler isn't thread safe. Only profile functions which doesn't run simultaneously
#define PROFILE(name) \

View file

@ -3,6 +3,9 @@
#include "Common/SocketContext.h"
#include "Common/Logging/Log.h"
#include "Common/Network.h"
namespace Common
{
#ifdef _WIN32
@ -11,7 +14,23 @@ SocketContext::SocketContext()
std::lock_guard<std::mutex> g(s_lock);
if (s_num_objects == 0)
{
static_cast<void>(WSAStartup(MAKEWORD(2, 2), &s_data));
const int ret = WSAStartup(MAKEWORD(2, 2), &s_data);
if (ret == 0)
{
INFO_LOG_FMT(COMMON, "WSAStartup succeeded, wVersion={}.{}, wHighVersion={}.{}",
int(LOBYTE(s_data.wVersion)), int(HIBYTE(s_data.wVersion)),
int(LOBYTE(s_data.wHighVersion)), int(HIBYTE(s_data.wHighVersion)));
}
else
{
// The WSAStartup function directly returns the extended error code in the return value.
// A call to the WSAGetLastError function is not needed and should not be used.
//
// Source:
// https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsastartup
ERROR_LOG_FMT(COMMON, "WSAStartup failed with error {}: {}", ret,
Common::DecodeNetworkError(ret));
}
}
s_num_objects++;
}

View file

@ -195,7 +195,7 @@ std::from_chars_result FromChars(std::string_view sv, T& value,
const char* const last = first + sv.size();
return std::from_chars(first, last, value, fmt);
}
}; // namespace Common
} // namespace Common
std::string TabsToSpaces(int tab_size, std::string str);

View file

@ -82,17 +82,4 @@ static_assert(!IsNOf<int, 1, int, int>::value);
static_assert(IsNOf<int, 2, int, int>::value);
static_assert(IsNOf<int, 2, int, short>::value); // Type conversions ARE allowed
static_assert(!IsNOf<int, 2, int, char*>::value);
// TODO: This can be replaced with std::array's fill() once C++20 is fully supported.
// Prior to C++20, std::array's fill() function is, unfortunately, not constexpr.
// Ditto for <algorithm>'s std::fill. Although Dolphin targets C++20, Android doesn't
// seem to properly support constexpr fill(), so we need this for now.
template <typename T1, size_t N, typename T2>
constexpr void Fill(std::array<T1, N>& array, const T2& value)
{
for (auto& entry : array)
{
entry = value;
}
}
} // namespace Common

View file

@ -0,0 +1,21 @@
// Copyright 2024 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "Common/CommonFuncs.h"
namespace Common
{
// TODO C++23: Replace with std::unreachable.
[[noreturn]] inline void Unreachable()
{
#ifdef _DEBUG
Crash();
#elif defined(_MSC_VER) && !defined(__clang__)
__assume(false);
#else
__builtin_unreachable();
#endif
}
} // namespace Common

View file

@ -9,6 +9,8 @@
namespace Common
{
#define EMULATOR_NAME "Dolphin"
#ifdef _DEBUG
#define BUILD_TYPE_STR "Debug "
#elif defined DEBUGFAST
@ -41,6 +43,12 @@ const std::string& GetScmBranchStr()
return scm_branch_str;
}
const std::string& GetUserAgentStr()
{
static const std::string user_agent_str = EMULATOR_NAME "/" SCM_DESC_STR;
return user_agent_str;
}
const std::string& GetScmDistributorStr()
{
static const std::string scm_distributor_str = SCM_DISTRIBUTOR_STR;

View file

@ -11,6 +11,7 @@ const std::string& GetScmDescStr();
const std::string& GetScmBranchStr();
const std::string& GetScmRevStr();
const std::string& GetScmRevGitStr();
const std::string& GetUserAgentStr();
const std::string& GetScmDistributorStr();
const std::string& GetScmUpdateTrackStr();
const std::string& GetNetplayDolphinVer();

View file

@ -69,4 +69,4 @@ OSVERSIONINFOW GetOSVersion()
}
return info;
}
}; // namespace WindowsRegistry
} // namespace WindowsRegistry

View file

@ -15,4 +15,4 @@ template <>
bool ReadValue(std::string* value, const std::string& subkey, const std::string& name);
OSVERSIONINFOW GetOSVersion();
}; // namespace WindowsRegistry
} // namespace WindowsRegistry

View file

@ -6,6 +6,7 @@ var cmd_revision = " rev-parse HEAD";
var cmd_describe = " rev-parse --short HEAD";
var cmd_branch = " rev-parse --abbrev-ref HEAD";
var cmd_commits_ahead = " rev-list --count HEAD ^master";
var cmd_get_tag = " describe --exact-match HEAD";
function GetGitExe()
{
@ -59,6 +60,25 @@ function GetFirstStdOutLine(cmd)
}
}
function AttemptToExecuteCommand(cmd)
{
try
{
var exec = wshShell.Exec(cmd)
// wait until the command has finished
while (exec.Status == 0) {}
return exec.ExitCode;
}
catch (e)
{
// catch "the system cannot find the file specified" error
WScript.Echo("Failed to exec " + cmd + " this should never happen");
WScript.Quit(1);
}
}
function GetFileContents(f)
{
try
@ -88,6 +108,12 @@ if (default_update_track == "%DOLPHIN_DEFAULT_UPDATE_TRACK%") default_update_tra
// remove hash (and trailing "-0" if needed) from description
describe = describe.replace(/(-0)?-[^-]+(-dirty)?$/, '$2');
// set commits ahead to zero if on a tag
if (AttemptToExecuteCommand(gitexe + cmd_get_tag) == 0)
{
commits_ahead = "0";
}
var out_contents =
"#define SCM_REV_STR \"" + revision + "\"\n" +
"#define SCM_DESC_STR \"" + describe + "\"\n" +

View file

@ -50,7 +50,7 @@
// FIXME: avoid pushing all 16 XMM registers when possible? most functions we call probably
// don't actually clobber them.
#define ABI_ALL_CALLER_SAVED (BitSet32{RAX, RCX, RDX, RDI, RSI, R8, R9, R10, R11} | ABI_ALL_FPRS)
#endif // WIN32
#endif // _WIN32
#define ABI_ALL_CALLEE_SAVED (~ABI_ALL_CALLER_SAVED)

View file

@ -107,26 +107,6 @@ void XEmitter::SetCodePtr(u8* ptr, u8* end, bool write_failed)
m_write_failed = write_failed;
}
const u8* XEmitter::GetCodePtr() const
{
return code;
}
u8* XEmitter::GetWritableCodePtr()
{
return code;
}
const u8* XEmitter::GetCodeEnd() const
{
return m_code_end;
}
u8* XEmitter::GetWritableCodeEnd()
{
return m_code_end;
}
void XEmitter::Write8(u8 value)
{
if (code >= m_code_end)

View file

@ -394,10 +394,10 @@ public:
u8* AlignCode4();
u8* AlignCode16();
u8* AlignCodePage();
const u8* GetCodePtr() const;
u8* GetWritableCodePtr();
const u8* GetCodeEnd() const;
u8* GetWritableCodeEnd();
const u8* GetCodePtr() const { return code; }
u8* GetWritableCodePtr() { return code; }
const u8* GetCodeEnd() const { return m_code_end; }
u8* GetWritableCodeEnd() { return m_code_end; }
void LockFlags() { flags_locked = true; }
void UnlockFlags() { flags_locked = false; }