diff --git a/rpcs3/Emu/ARMv7/ARMv7Context.h b/rpcs3/Emu/ARMv7/ARMv7Context.h new file mode 100644 index 0000000000..f1cd694844 --- /dev/null +++ b/rpcs3/Emu/ARMv7/ARMv7Context.h @@ -0,0 +1,267 @@ +#pragma once + +class ARMv7Thread; + +enum ARMv7InstructionSet +{ + ARM, + Thumb, + Jazelle, + ThumbEE +}; + +union ARMv7Code +{ + struct + { + u16 code0; + u16 code1; + }; + + u32 data; +}; + +struct ARMv7Context +{ + ARMv7Thread& thread; + + ARMv7Context(ARMv7Thread& thread) : thread(thread) {} + + void write_pc(u32 value); + u32 read_pc(); + u32 get_stack_arg(u32 pos); + + union + { + u32 GPR[15]; + + struct + { + u32 pad[13]; + + union + { + u32 SP; + + struct { u16 SP_main, SP_process; }; + }; + + u32 LR; + }; + }; + + union + { + struct + { + u32 N : 1; //Negative condition code flag + u32 Z : 1; //Zero condition code flag + u32 C : 1; //Carry condition code flag + u32 V : 1; //Overflow condition code flag + u32 Q : 1; //Set to 1 if an SSAT or USAT instruction changes (saturates) the input value for the signed or unsigned range of the result + u32: 27; + }; + + u32 APSR; + + } APSR; + + union + { + struct + { + u32: 24; + u32 exception : 8; + }; + + u32 IPSR; + + } IPSR; + + ARMv7InstructionSet ISET; + + union + { + struct + { + u8 cond : 3; + u8 state : 5; + }; + + u8 IT; + + u32 advance() + { + const u32 res = (state & 0xf) ? (cond << 1 | state >> 4) : 0xe /* true */; + + state <<= 1; + if ((state & 0xf) == 0) // if no d + { + IT = 0; // clear ITSTATE + } + + return res; + } + + operator bool() const + { + return (state & 0xf) != 0; + } + + } ITSTATE; + + void write_gpr(u32 n, u32 value) + { + assert(n < 16); + + if (n < 15) + { + GPR[n] = value; + } + else + { + write_pc(value & ~1); + } + } + + u32 read_gpr(u32 n) + { + assert(n < 16); + + if (n < 15) + { + return GPR[n]; + } + + return read_pc(); + } +}; + +template::value> +struct cast_armv7_gpr +{ + static_assert(is_enum, "Invalid type for cast_armv7_gpr"); + + typedef typename std::underlying_type::type underlying_type; + + __forceinline static u32 to_gpr(const T& value) + { + return cast_armv7_gpr::to_gpr(static_cast(value)); + } + + __forceinline static T from_gpr(const u32 reg) + { + return static_cast(cast_armv7_gpr::from_gpr(reg)); + } +}; + +template<> +struct cast_armv7_gpr +{ + __forceinline static u32 to_gpr(const u8& value) + { + return value; + } + + __forceinline static u8 from_gpr(const u32 reg) + { + return static_cast(reg); + } +}; + +template<> +struct cast_armv7_gpr +{ + __forceinline static u32 to_gpr(const u16& value) + { + return value; + } + + __forceinline static u16 from_gpr(const u32 reg) + { + return static_cast(reg); + } +}; + +template<> +struct cast_armv7_gpr +{ + __forceinline static u32 to_gpr(const u32& value) + { + return value; + } + + __forceinline static u32 from_gpr(const u32 reg) + { + return reg; + } +}; + +template<> +struct cast_armv7_gpr +{ + __forceinline static u32 to_gpr(const s8& value) + { + return value; + } + + __forceinline static s8 from_gpr(const u32 reg) + { + return static_cast(reg); + } +}; + +template<> +struct cast_armv7_gpr +{ + __forceinline static u32 to_gpr(const s16& value) + { + return value; + } + + __forceinline static s16 from_gpr(const u32 reg) + { + return static_cast(reg); + } +}; + +template<> +struct cast_armv7_gpr +{ + __forceinline static u32 to_gpr(const s32& value) + { + return value; + } + + __forceinline static s32 from_gpr(const u32 reg) + { + return static_cast(reg); + } +}; + +template<> +struct cast_armv7_gpr +{ + __forceinline static u32 to_gpr(const bool& value) + { + return value; + } + + __forceinline static bool from_gpr(const u32 reg) + { + return reinterpret_cast(reg); + } +}; + +template +__forceinline u32 cast_to_armv7_gpr(const T& value) +{ + return cast_armv7_gpr::to_gpr(value); +} + +template +__forceinline T cast_from_armv7_gpr(const u32 reg) +{ + return cast_armv7_gpr::from_gpr(reg); +} + diff --git a/rpcs3/Emu/ARMv7/ARMv7Decoder.h b/rpcs3/Emu/ARMv7/ARMv7Decoder.h index 2a7de502f6..8e54b8880e 100644 --- a/rpcs3/Emu/ARMv7/ARMv7Decoder.h +++ b/rpcs3/Emu/ARMv7/ARMv7Decoder.h @@ -17,32 +17,33 @@ public: virtual u8 DecodeMemory(const u32 address) { - m_thr.update_code(address & ~1); + ARMv7Code code; + code.code0 = vm::psv::read16(address & ~1); + code.code1 = vm::psv::read16(address + 2 & ~1); + u32 arg = address & 0x1 ? code.data : (u32)code.code0 << 16 | code.code1; - // LOG_NOTICE(GENERAL, "code0 = 0x%04x, code1 = 0x%04x, data = 0x%08x", m_thr.code.code0, m_thr.code.code1, m_thr.code.data); - // LOG_NOTICE(GENERAL, "arg = 0x%08x", m_thr.m_arg); - // Emu.Pause(); + LOG_NOTICE(GENERAL, "code0 = 0x%04x, code1 = 0x%04x, data = 0x%08x, arg = 0x%08x", code.code0, code.code1, code.data, arg); // old decoding algorithm - /* + for (auto& opcode : ARMv7_opcode_table) { - if ((opcode.type < A1) == ((address & 0x1) == 0) && (m_thr.m_arg & opcode.mask) == opcode.code) + if ((opcode.type < A1) == ((address & 0x1) == 0) && (arg & opcode.mask) == opcode.code) { - m_thr.code.data = opcode.length == 2 ? m_thr.code.code0 : m_thr.m_arg; - (*opcode.func)(&m_thr, opcode.type); + code.data = opcode.length == 2 ? code.code0 : arg; + (*opcode.func)(m_thr.context, code, opcode.type); // LOG_NOTICE(GENERAL, "%s, %d \n\n", opcode.name, opcode.length); return opcode.length; } } - ARMv7_instrs::UNK(&m_thr); + ARMv7_instrs::UNK(m_thr.context, code); return address & 0x1 ? 4 : 2; - */ + - execute_main_group(&m_thr); - // LOG_NOTICE(GENERAL, "%s, %d \n\n", m_thr.m_last_instr_name, m_thr.m_last_instr_size); - m_thr.m_last_instr_name = "Unknown"; - return m_thr.m_last_instr_size; + //execute_main_group(&m_thr); + //// LOG_NOTICE(GENERAL, "%s, %d \n\n", m_thr.m_last_instr_name, m_thr.m_last_instr_size); + //m_thr.m_last_instr_name = "Unknown"; + //return m_thr.m_last_instr_size; } }; \ No newline at end of file diff --git a/rpcs3/Emu/ARMv7/ARMv7Interpreter.cpp b/rpcs3/Emu/ARMv7/ARMv7Interpreter.cpp index aa963e583b..3fbc1d0ff1 100644 --- a/rpcs3/Emu/ARMv7/ARMv7Interpreter.cpp +++ b/rpcs3/Emu/ARMv7/ARMv7Interpreter.cpp @@ -1,7 +1,9 @@ #include "stdafx.h" +#include "Utilities/Log.h" #include "Emu/System.h" #include "Emu/Memory/Memory.h" #include "Emu/CPU/CPUDecoder.h" + #include "ARMv7Thread.h" #include "PSVFuncList.h" #include "ARMv7Interpreter.h" @@ -101,7 +103,7 @@ u32 ARMv7_instrs::LSL_C(u32 x, s32 shift, bool& carry_out) return shift < 32 ? x << shift : 0; } -u32 ARMv7_instrs::LSL(u32 x, s32 shift) +u32 ARMv7_instrs::LSL_(u32 x, s32 shift) { assert(shift >= 0); return shift < 32 ? x << shift : 0; @@ -114,7 +116,7 @@ u32 ARMv7_instrs::LSR_C(u32 x, s32 shift, bool& carry_out) return shift < 32 ? x >> shift : 0; } -u32 ARMv7_instrs::LSR(u32 x, s32 shift) +u32 ARMv7_instrs::LSR_(u32 x, s32 shift) { assert(shift >= 0); return shift < 32 ? x >> shift : 0; @@ -127,7 +129,7 @@ s32 ARMv7_instrs::ASR_C(s32 x, s32 shift, bool& carry_out) return shift < 32 ? x >> shift : x >> 31; } -s32 ARMv7_instrs::ASR(s32 x, s32 shift) +s32 ARMv7_instrs::ASR_(s32 x, s32 shift) { assert(shift >= 0); return shift < 32 ? x >> shift : x >> 31; @@ -140,7 +142,7 @@ u32 ARMv7_instrs::ROR_C(u32 x, s32 shift, bool& carry_out) return x >> shift | x << (32 - shift); } -u32 ARMv7_instrs::ROR(u32 x, s32 shift) +u32 ARMv7_instrs::ROR_(u32 x, s32 shift) { return x >> shift | x << (32 - shift); } @@ -151,7 +153,7 @@ u32 ARMv7_instrs::RRX_C(u32 x, bool carry_in, bool& carry_out) return ((u32)carry_in << 31) | (x >> 1); } -u32 ARMv7_instrs::RRX(u32 x, bool carry_in) +u32 ARMv7_instrs::RRX_(u32 x, bool carry_in) { return ((u32)carry_in << 31) | (x >> 1); } @@ -222,25 +224,25 @@ u32 ARMv7_instrs::ThumbExpandImm_C(u32 imm12, bool carry_in, bool& carry_out) } } -u32 ARMv7_instrs::ThumbExpandImm(ARMv7Thread* CPU, u32 imm12) +u32 ARMv7_instrs::ThumbExpandImm(ARMv7Context& context, u32 imm12) { - bool carry = CPU->APSR.C; + bool carry = context.APSR.C; return ThumbExpandImm_C(imm12, carry, carry); } -bool ARMv7_instrs::ConditionPassed(ARMv7Thread* CPU, u32 cond) +bool ARMv7_instrs::ConditionPassed(ARMv7Context& context, u32 cond) { bool result = false; switch (cond >> 1) { - case 0: result = CPU->APSR.Z == 1; break; - case 1: result = CPU->APSR.C == 1; break; - case 2: result = CPU->APSR.N == 1; break; - case 3: result = CPU->APSR.V == 1; break; - case 4: result = CPU->APSR.C == 1 && CPU->APSR.Z == 0; break; - case 5: result = CPU->APSR.N == CPU->APSR.V; break; - case 6: result = CPU->APSR.N == CPU->APSR.V && CPU->APSR.Z == 0; break; + case 0: result = context.APSR.Z == 1; break; + case 1: result = context.APSR.C == 1; break; + case 2: result = context.APSR.N == 1; break; + case 3: result = context.APSR.V == 1; break; + case 4: result = context.APSR.C == 1 && context.APSR.Z == 0; break; + case 5: result = context.APSR.N == context.APSR.V; break; + case 6: result = context.APSR.N == context.APSR.V && context.APSR.Z == 0; break; case 7: return true; } @@ -253,46 +255,46 @@ bool ARMv7_instrs::ConditionPassed(ARMv7Thread* CPU, u32 cond) } // instructions -void ARMv7_instrs::UNK(ARMv7Thread* thr) +void ARMv7_instrs::UNK(ARMv7Context& context, const ARMv7Code code) { - LOG_ERROR(HLE, "Unknown/illegal opcode! (0x%04x : 0x%04x)", thr->code.data >> 16, thr->code.data & 0xffff); + LOG_ERROR(HLE, "Unknown/illegal opcode! (0x%04x : 0x%04x)", code.data >> 16, code.data & 0xffff); Emu.Pause(); } -void ARMv7_instrs::NULL_OP(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::NULL_OP(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - LOG_ERROR(HLE, "Null opcode found: data = 0x%x", thr->m_arg); + LOG_ERROR(HLE, "Null opcode found: data = 0x%x", code.data); Emu.Pause(); } -void ARMv7_instrs::HACK(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::HACK(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - u32 cond = thr->ITSTATE.advance(); - u32 code = 0; + u32 cond = context.ITSTATE.advance(); + u32 func = 0; switch (type) { case T1: { - code = thr->code.data & 0xffff; + func = code.data & 0xffff; break; } case A1: { - cond = thr->code.data >> 28; - code = (thr->code.data & 0xfff00) >> 4 | (thr->code.data & 0xf); + cond = code.data >> 28; + func = (code.data & 0xfff00) >> 4 | (code.data & 0xf); break; } default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { - execute_psv_func_by_index(*thr, code); + execute_psv_func_by_index(context, func); } } -void ARMv7_instrs::ADC_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::ADC_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -301,7 +303,7 @@ void ARMv7_instrs::ADC_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::ADC_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::ADC_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -310,7 +312,7 @@ void ARMv7_instrs::ADC_REG(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::ADC_RSR(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::ADC_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -320,10 +322,10 @@ void ARMv7_instrs::ADC_RSR(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::ADD_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::ADD_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - bool set_flags = !thr->ITSTATE; - u32 cond = thr->ITSTATE.advance(); + bool set_flags = !context.ITSTATE; + u32 cond = context.ITSTATE.advance(); u32 d = 0; u32 n = 0; u32 imm32 = 0; @@ -332,23 +334,23 @@ void ARMv7_instrs::ADD_IMM(ARMv7Thread* thr, const ARMv7_encoding type) { case T1: { - d = (thr->code.data & 0x7); - n = (thr->code.data & 0x38) >> 3; - imm32 = (thr->code.data & 0x1c0) >> 6; + d = (code.data & 0x7); + n = (code.data & 0x38) >> 3; + imm32 = (code.data & 0x1c0) >> 6; break; } case T2: { - d = n = (thr->code.data & 0x700) >> 8; - imm32 = (thr->code.data & 0xff); + d = n = (code.data & 0x700) >> 8; + imm32 = (code.data & 0xff); break; } case T3: { - d = (thr->code.data & 0xf00) >> 8; - n = (thr->code.data & 0xf0000) >> 16; - set_flags = (thr->code.data & 0x100000); - imm32 = ThumbExpandImm(thr, (thr->code.data & 0x4000000) >> 15 | (thr->code.data & 0x7000) >> 4 | (thr->code.data & 0xff)); + d = (code.data & 0xf00) >> 8; + n = (code.data & 0xf0000) >> 16; + set_flags = (code.data & 0x100000); + imm32 = ThumbExpandImm(context, (code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff)); if (d == 15 && set_flags) { @@ -362,10 +364,10 @@ void ARMv7_instrs::ADD_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } case T4: { - d = (thr->code.data & 0xf00) >> 8; - n = (thr->code.data & 0xf0000) >> 16; + d = (code.data & 0xf00) >> 8; + n = (code.data & 0xf0000) >> 16; set_flags = false; - imm32 = (thr->code.data & 0x4000000) >> 15 | (thr->code.data & 0x7000) >> 4 | (thr->code.data & 0xff); + imm32 = (code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff); if (n == 15) { @@ -381,29 +383,29 @@ void ARMv7_instrs::ADD_IMM(ARMv7Thread* thr, const ARMv7_encoding type) default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { if (set_flags) { bool carry, overflow; - const u32 res = AddWithCarry(thr->read_gpr(n), imm32, false, carry, overflow); - thr->write_gpr(d, res); - thr->APSR.N = res >> 31; - thr->APSR.Z = res == 0; - thr->APSR.C = carry; - thr->APSR.V = overflow; + const u32 res = AddWithCarry(context.read_gpr(n), imm32, false, carry, overflow); + context.write_gpr(d, res); + context.APSR.N = res >> 31; + context.APSR.Z = res == 0; + context.APSR.C = carry; + context.APSR.V = overflow; } else { - thr->write_gpr(d, thr->read_gpr(n) + imm32); + context.write_gpr(d, context.read_gpr(n) + imm32); } } } -void ARMv7_instrs::ADD_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::ADD_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - bool set_flags = !thr->ITSTATE; - u32 cond = thr->ITSTATE.advance(); + bool set_flags = !context.ITSTATE; + u32 cond = context.ITSTATE.advance(); u32 d = 0; u32 n = 0; u32 m = 0; @@ -414,15 +416,15 @@ void ARMv7_instrs::ADD_REG(ARMv7Thread* thr, const ARMv7_encoding type) { case T1: { - d = (thr->code.data & 0x7); - n = (thr->code.data & 0x38) >> 3; - m = (thr->code.data & 0x1c0) >> 6; + d = (code.data & 0x7); + n = (code.data & 0x38) >> 3; + m = (code.data & 0x1c0) >> 6; break; } case T2: { - n = d = (thr->code.data & 0x80) >> 4 | (thr->code.data & 0x7); - m = (thr->code.data & 0x78) >> 3; + n = d = (code.data & 0x80) >> 4 | (code.data & 0x7); + m = (code.data & 0x78) >> 3; set_flags = false; if (n == 13 || m == 13) @@ -433,11 +435,11 @@ void ARMv7_instrs::ADD_REG(ARMv7Thread* thr, const ARMv7_encoding type) } case T3: { - d = (thr->code.data & 0xf00) >> 8; - n = (thr->code.data & 0xf0000) >> 16; - m = (thr->code.data & 0xf); - set_flags = (thr->code.data & 0x100000); - shift_t = DecodeImmShift((thr->code.data & 0x30) >> 4, (thr->code.data & 0x7000) >> 10 | (thr->code.data & 0xc0) >> 6, &shift_n); + d = (code.data & 0xf00) >> 8; + n = (code.data & 0xf0000) >> 16; + m = (code.data & 0xf); + set_flags = (code.data & 0x100000); + shift_t = DecodeImmShift((code.data & 0x30) >> 4, (code.data & 0x7000) >> 10 | (code.data & 0xc0) >> 6, &shift_n); if (d == 15 && set_flags) { @@ -453,27 +455,27 @@ void ARMv7_instrs::ADD_REG(ARMv7Thread* thr, const ARMv7_encoding type) default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { - const u32 shifted = Shift(thr->read_gpr(m), shift_t, shift_n, true); + const u32 shifted = Shift(context.read_gpr(m), shift_t, shift_n, true); if (set_flags) { bool carry, overflow; - const u32 res = AddWithCarry(thr->read_gpr(n), shifted, false, carry, overflow); - thr->write_gpr(d, res); - thr->APSR.N = res >> 31; - thr->APSR.Z = res == 0; - thr->APSR.C = carry; - thr->APSR.V = overflow; + const u32 res = AddWithCarry(context.read_gpr(n), shifted, false, carry, overflow); + context.write_gpr(d, res); + context.APSR.N = res >> 31; + context.APSR.Z = res == 0; + context.APSR.C = carry; + context.APSR.V = overflow; } else { - thr->write_gpr(d, thr->read_gpr(n) + shifted); + context.write_gpr(d, context.read_gpr(n) + shifted); } } } -void ARMv7_instrs::ADD_RSR(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::ADD_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -482,9 +484,9 @@ void ARMv7_instrs::ADD_RSR(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::ADD_SPI(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::ADD_SPI(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - u32 cond = thr->ITSTATE.advance(); + u32 cond = context.ITSTATE.advance(); u32 d = 13; bool set_flags = false; u32 imm32 = 0; @@ -493,20 +495,20 @@ void ARMv7_instrs::ADD_SPI(ARMv7Thread* thr, const ARMv7_encoding type) { case T1: { - d = (thr->code.data & 0x700) >> 8; - imm32 = (thr->code.data & 0xff) << 2; + d = (code.data & 0x700) >> 8; + imm32 = (code.data & 0xff) << 2; break; } case T2: { - imm32 = (thr->code.data & 0x7f) << 2; + imm32 = (code.data & 0x7f) << 2; break; } case T3: { - d = (thr->code.data & 0xf00) >> 8; - set_flags = (thr->code.data & 0x100000); - imm32 = ThumbExpandImm(thr, (thr->code.data & 0x4000000) >> 15 | (thr->code.data & 0x7000) >> 4 | (thr->code.data & 0xff)); + d = (code.data & 0xf00) >> 8; + set_flags = (code.data & 0x100000); + imm32 = ThumbExpandImm(context, (code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff)); if (d == 15 && set_flags) { @@ -516,37 +518,37 @@ void ARMv7_instrs::ADD_SPI(ARMv7Thread* thr, const ARMv7_encoding type) } case T4: { - d = (thr->code.data & 0xf00) >> 8; + d = (code.data & 0xf00) >> 8; set_flags = false; - imm32 = (thr->code.data & 0x4000000) >> 15 | (thr->code.data & 0x7000) >> 4 | (thr->code.data & 0xff); + imm32 = (code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff); break; } case A1: throw __FUNCTION__; default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { if (set_flags) { bool carry, overflow; - const u32 res = AddWithCarry(thr->SP, imm32, false, carry, overflow); - thr->write_gpr(d, res); - thr->APSR.N = res >> 31; - thr->APSR.Z = res == 0; - thr->APSR.C = carry; - thr->APSR.V = overflow; + const u32 res = AddWithCarry(context.SP, imm32, false, carry, overflow); + context.write_gpr(d, res); + context.APSR.N = res >> 31; + context.APSR.Z = res == 0; + context.APSR.C = carry; + context.APSR.V = overflow; } else { - thr->write_gpr(d, thr->SP + imm32); + context.write_gpr(d, context.SP + imm32); } } } -void ARMv7_instrs::ADD_SPR(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::ADD_SPR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - u32 cond = thr->ITSTATE.advance(); + u32 cond = context.ITSTATE.advance(); u32 d = 13; u32 m = 0; bool set_flags = false; @@ -557,12 +559,12 @@ void ARMv7_instrs::ADD_SPR(ARMv7Thread* thr, const ARMv7_encoding type) { case T1: { - m = d = (thr->code.data & 0x80) >> 4 | (thr->code.data & 0x7); + m = d = (code.data & 0x80) >> 4 | (code.data & 0x7); break; } case T2: { - m = (thr->code.data & 0x78) >> 3; + m = (code.data & 0x78) >> 3; if (m == 13) { @@ -572,38 +574,38 @@ void ARMv7_instrs::ADD_SPR(ARMv7Thread* thr, const ARMv7_encoding type) } case T3: { - d = (thr->code.data & 0xf00) >> 8; - m = (thr->code.data & 0xf); - set_flags = (thr->code.data & 0x100000); - shift_t = DecodeImmShift((thr->code.data & 0x30) >> 4, (thr->code.data & 0x7000) >> 10 | (thr->code.data & 0xc0) >> 6, &shift_n); + d = (code.data & 0xf00) >> 8; + m = (code.data & 0xf); + set_flags = (code.data & 0x100000); + shift_t = DecodeImmShift((code.data & 0x30) >> 4, (code.data & 0x7000) >> 10 | (code.data & 0xc0) >> 6, &shift_n); break; } case A1: throw __FUNCTION__; default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { - const u32 shifted = Shift(thr->read_gpr(m), shift_t, shift_n, thr->APSR.C); + const u32 shifted = Shift(context.read_gpr(m), shift_t, shift_n, context.APSR.C); if (set_flags) { bool carry, overflow; - const u32 res = AddWithCarry(thr->SP, shifted, false, carry, overflow); - thr->write_gpr(d, res); - thr->APSR.N = res >> 31; - thr->APSR.Z = res == 0; - thr->APSR.C = carry; - thr->APSR.V = overflow; + const u32 res = AddWithCarry(context.SP, shifted, false, carry, overflow); + context.write_gpr(d, res); + context.APSR.N = res >> 31; + context.APSR.Z = res == 0; + context.APSR.C = carry; + context.APSR.V = overflow; } else { - thr->write_gpr(d, thr->SP + thr->read_gpr(m)); + context.write_gpr(d, context.SP + context.read_gpr(m)); } } } -void ARMv7_instrs::ADR(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::ADR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -613,7 +615,7 @@ void ARMv7_instrs::ADR(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::AND_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::AND_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -622,7 +624,7 @@ void ARMv7_instrs::AND_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::AND_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::AND_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -631,7 +633,7 @@ void ARMv7_instrs::AND_REG(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::AND_RSR(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::AND_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -641,7 +643,7 @@ void ARMv7_instrs::AND_RSR(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::ASR_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::ASR_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -650,7 +652,7 @@ void ARMv7_instrs::ASR_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::ASR_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::ASR_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -660,68 +662,68 @@ void ARMv7_instrs::ASR_REG(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::B(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::B(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - u32 cond = thr->ITSTATE.advance(); + u32 cond = context.ITSTATE.advance(); u32 jump = 0; // jump = instr_size + imm32 ??? switch (type) { case T1: { - cond = (thr->code.data >> 8) & 0xf; + cond = (code.data >> 8) & 0xf; if (cond == 0xf) { throw "SVC"; } - jump = 4 + sign<9, u32>((thr->code.data & 0xff) << 1); + jump = 4 + sign<9, u32>((code.data & 0xff) << 1); break; } case T2: { - jump = 4 + sign<12, u32>((thr->code.data & 0x7ff) << 1); + jump = 4 + sign<12, u32>((code.data & 0x7ff) << 1); break; } case T3: { - cond = (thr->code.data >> 6) & 0xf; + cond = (code.data >> 6) & 0xf; if (cond >= 0xe) { throw "B_T3: Related encodings"; } - u32 s = (thr->code.data >> 26) & 0x1; - u32 j1 = (thr->code.data >> 13) & 0x1; - u32 j2 = (thr->code.data >> 11) & 0x1; - jump = 4 + sign<21, u32>(s << 20 | j2 << 19 | j1 << 18 | (thr->code.data & 0x3f0000) >> 4 | (thr->code.data & 0x7ff) << 1); + u32 s = (code.data >> 26) & 0x1; + u32 j1 = (code.data >> 13) & 0x1; + u32 j2 = (code.data >> 11) & 0x1; + jump = 4 + sign<21, u32>(s << 20 | j2 << 19 | j1 << 18 | (code.data & 0x3f0000) >> 4 | (code.data & 0x7ff) << 1); break; } case T4: { - u32 s = (thr->code.data >> 26) & 0x1; - u32 i1 = (thr->code.data >> 13) & 0x1 ^ s ^ 1; - u32 i2 = (thr->code.data >> 11) & 0x1 ^ s ^ 1; - jump = 4 + sign<25, u32>(s << 24 | i2 << 23 | i1 << 22 | (thr->code.data & 0x3ff0000) >> 4 | (thr->code.data & 0x7ff) << 1); + u32 s = (code.data >> 26) & 0x1; + u32 i1 = (code.data >> 13) & 0x1 ^ s ^ 1; + u32 i2 = (code.data >> 11) & 0x1 ^ s ^ 1; + jump = 4 + sign<25, u32>(s << 24 | i2 << 23 | i1 << 22 | (code.data & 0x3ff0000) >> 4 | (code.data & 0x7ff) << 1); break; } case A1: { - cond = thr->code.data >> 28; - jump = 1 + 4 + sign<26, u32>((thr->code.data & 0xffffff) << 2); + cond = code.data >> 28; + jump = 1 + 4 + sign<26, u32>((code.data & 0xffffff) << 2); break; } default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { - thr->SetBranch(thr->PC + jump); + context.thread.SetBranch(context.thread.PC + jump); } } -void ARMv7_instrs::BFC(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::BFC(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -730,7 +732,7 @@ void ARMv7_instrs::BFC(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::BFI(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::BFI(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -740,7 +742,7 @@ void ARMv7_instrs::BFI(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::BIC_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::BIC_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -749,7 +751,7 @@ void ARMv7_instrs::BIC_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::BIC_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::BIC_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -758,7 +760,7 @@ void ARMv7_instrs::BIC_REG(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::BIC_RSR(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::BIC_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -768,7 +770,7 @@ void ARMv7_instrs::BIC_RSR(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::BKPT(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::BKPT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -778,132 +780,132 @@ void ARMv7_instrs::BKPT(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::BL(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::BL(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - u32 cond = thr->ITSTATE.advance(); - u32 newLR = thr->PC; + u32 cond = context.ITSTATE.advance(); + u32 newLR = context.thread.PC; u32 imm32 = 0; switch (type) { case T1: { - u32 s = (thr->code.data >> 26) & 0x1; - u32 i1 = (thr->code.data >> 13) & 0x1 ^ s ^ 1; - u32 i2 = (thr->code.data >> 11) & 0x1 ^ s ^ 1; - imm32 = 4 + sign<25, u32>(s << 24 | i2 << 23 | i1 << 22 | (thr->code.data & 0x3ff0000) >> 4 | (thr->code.data & 0x7ff) << 1); - newLR = (thr->PC + 4) | 1; + u32 s = (code.data >> 26) & 0x1; + u32 i1 = (code.data >> 13) & 0x1 ^ s ^ 1; + u32 i2 = (code.data >> 11) & 0x1 ^ s ^ 1; + imm32 = 4 + sign<25, u32>(s << 24 | i2 << 23 | i1 << 22 | (code.data & 0x3ff0000) >> 4 | (code.data & 0x7ff) << 1); + newLR = (context.thread.PC + 4) | 1; break; } case A1: { - cond = thr->code.data >> 28; - imm32 = 4 + sign<26, u32>((thr->code.data & 0xffffff) << 2); - newLR = (thr->PC + 4) - 4; + cond = code.data >> 28; + imm32 = 4 + sign<26, u32>((code.data & 0xffffff) << 2); + newLR = (context.thread.PC + 4) - 4; break; } default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { - thr->LR = newLR; - thr->SetBranch(thr->PC + imm32); + context.LR = newLR; + context.thread.SetBranch(context.thread.PC + imm32); } } -void ARMv7_instrs::BLX(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::BLX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - u32 cond = thr->ITSTATE.advance(); - u32 newLR = thr->PC; + u32 cond = context.ITSTATE.advance(); + u32 newLR = context.thread.PC; u32 target = 0; switch (type) { case T1: { - target = thr->read_gpr((thr->code.data >> 3) & 0xf); - newLR = (thr->PC + 2) | 1; // ??? + target = context.read_gpr((code.data >> 3) & 0xf); + newLR = (context.thread.PC + 2) | 1; // ??? break; } case T2: { - u32 s = (thr->code.data >> 26) & 0x1; - u32 i1 = (thr->code.data >> 13) & 0x1 ^ s ^ 1; - u32 i2 = (thr->code.data >> 11) & 0x1 ^ s ^ 1; - target = (thr->PC + 4 & ~3) + sign<25, u32>(s << 24 | i2 << 23 | i1 << 22 | (thr->code.data & 0x3ff0000) >> 4 | (thr->code.data & 0x7ff) << 1); - newLR = (thr->PC + 4) | 1; + u32 s = (code.data >> 26) & 0x1; + u32 i1 = (code.data >> 13) & 0x1 ^ s ^ 1; + u32 i2 = (code.data >> 11) & 0x1 ^ s ^ 1; + target = (context.thread.PC + 4 & ~3) + sign<25, u32>(s << 24 | i2 << 23 | i1 << 22 | (code.data & 0x3ff0000) >> 4 | (code.data & 0x7ff) << 1); + newLR = (context.thread.PC + 4) | 1; break; } case A1: { - cond = thr->code.data >> 28; - target = thr->read_gpr(thr->code.data & 0xf); - newLR = (thr->PC + 4) - 4; + cond = code.data >> 28; + target = context.read_gpr(code.data & 0xf); + newLR = (context.thread.PC + 4) - 4; break; } case A2: { - target = (thr->PC + 4 | 1) + sign<25, u32>((thr->code.data & 0xffffff) << 2 | (thr->code.data & 0x1000000) >> 23); - newLR = (thr->PC + 4) - 4; + target = (context.thread.PC + 4 | 1) + sign<25, u32>((code.data & 0xffffff) << 2 | (code.data & 0x1000000) >> 23); + newLR = (context.thread.PC + 4) - 4; break; } default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { - thr->LR = newLR; + context.LR = newLR; if (target & 1) { - thr->ISET = Thumb; - thr->SetBranch(target & ~1); + context.ISET = Thumb; + context.thread.SetBranch(target & ~1); } else { - thr->ISET = ARM; - thr->SetBranch(target); + context.ISET = ARM; + context.thread.SetBranch(target); } } } -void ARMv7_instrs::BX(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::BX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - u32 cond = thr->ITSTATE.advance(); + u32 cond = context.ITSTATE.advance(); u32 target = 0; switch (type) { case T1: { - target = thr->read_gpr((thr->code.data >> 3) & 0xf); + target = context.read_gpr((code.data >> 3) & 0xf); break; } case A1: { - cond = thr->code.data >> 28; - target = thr->read_gpr(thr->code.data & 0xf); + cond = code.data >> 28; + target = context.read_gpr(code.data & 0xf); } default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { if (target & 1) { - thr->ISET = Thumb; - thr->SetBranch(target & ~1); + context.ISET = Thumb; + context.thread.SetBranch(target & ~1); } else { - thr->ISET = ARM; - thr->SetBranch(target); + context.ISET = ARM; + context.thread.SetBranch(target); } } } -void ARMv7_instrs::CB_Z(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::CB_Z(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -911,14 +913,14 @@ void ARMv7_instrs::CB_Z(ARMv7Thread* thr, const ARMv7_encoding type) default: throw __FUNCTION__; } - if ((thr->read_gpr(thr->code.data & 0x7) == 0) ^ ((thr->code.data & 0x800) != 0)) + if ((context.read_gpr(code.data & 0x7) == 0) ^ ((code.data & 0x800) != 0)) { - thr->SetBranch(thr->PC + 2 + ((thr->code.data & 0xf8) >> 2) + ((thr->code.data & 0x200) >> 3)); + context.thread.SetBranch(context.thread.PC + 2 + ((code.data & 0xf8) >> 2) + ((code.data & 0x200) >> 3)); } } -void ARMv7_instrs::CLZ(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::CLZ(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -928,7 +930,7 @@ void ARMv7_instrs::CLZ(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::CMN_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::CMN_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -937,7 +939,7 @@ void ARMv7_instrs::CMN_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::CMN_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::CMN_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -946,7 +948,7 @@ void ARMv7_instrs::CMN_REG(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::CMN_RSR(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::CMN_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -956,9 +958,9 @@ void ARMv7_instrs::CMN_RSR(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::CMP_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::CMP_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - u32 cond = thr->ITSTATE.advance(); + u32 cond = context.ITSTATE.advance(); u32 n = 0; u32 imm32 = 0; @@ -966,34 +968,34 @@ void ARMv7_instrs::CMP_IMM(ARMv7Thread* thr, const ARMv7_encoding type) { case T1: { - n = (thr->code.data & 0x700) >> 8; - imm32 = (thr->code.data & 0xff); + n = (code.data & 0x700) >> 8; + imm32 = (code.data & 0xff); break; } case T2: { - n = (thr->code.data & 0xf0000) >> 16; - imm32 = ThumbExpandImm(thr, (thr->code.data & 0x4000000) >> 15 | (thr->code.data & 0x7000) >> 4 | (thr->code.data & 0xff)); + n = (code.data & 0xf0000) >> 16; + imm32 = ThumbExpandImm(context, (code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff)); break; } case A1: throw __FUNCTION__; default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { bool carry, overflow; - const u32 res = AddWithCarry(thr->read_gpr(n), ~imm32, true, carry, overflow); - thr->APSR.N = res >> 31; - thr->APSR.Z = res == 0; - thr->APSR.C = carry; - thr->APSR.V = overflow; + const u32 res = AddWithCarry(context.read_gpr(n), ~imm32, true, carry, overflow); + context.APSR.N = res >> 31; + context.APSR.Z = res == 0; + context.APSR.C = carry; + context.APSR.V = overflow; } } -void ARMv7_instrs::CMP_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::CMP_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - u32 cond = thr->ITSTATE.advance(); + u32 cond = context.ITSTATE.advance(); u32 n = 0; u32 m = 0; auto shift_t = SRType_LSL; @@ -1003,40 +1005,40 @@ void ARMv7_instrs::CMP_REG(ARMv7Thread* thr, const ARMv7_encoding type) { case T1: { - n = (thr->code.data & 0x7); - m = (thr->code.data & 0x38) >> 3; + n = (code.data & 0x7); + m = (code.data & 0x38) >> 3; break; } case T2: { - n = (thr->code.data & 0x80) >> 4 | (thr->code.data & 0x7); - m = (thr->code.data & 0x78) >> 3; + n = (code.data & 0x80) >> 4 | (code.data & 0x7); + m = (code.data & 0x78) >> 3; break; } case T3: { - n = (thr->code.data & 0xf0000) >> 16; - m = (thr->code.data & 0xf); - shift_t = DecodeImmShift((thr->code.data & 0x30) >> 4, (thr->code.data & 0x7000) >> 10 | (thr->code.data & 0xc0) >> 6, &shift_n); + n = (code.data & 0xf0000) >> 16; + m = (code.data & 0xf); + shift_t = DecodeImmShift((code.data & 0x30) >> 4, (code.data & 0x7000) >> 10 | (code.data & 0xc0) >> 6, &shift_n); break; } case A1: throw __FUNCTION__; default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { bool carry, overflow; - const u32 shifted = Shift(thr->read_gpr(m), shift_t, shift_n, true); - const u32 res = AddWithCarry(thr->read_gpr(n), ~shifted, true, carry, overflow); - thr->APSR.N = res >> 31; - thr->APSR.Z = res == 0; - thr->APSR.C = carry; - thr->APSR.V = overflow; + const u32 shifted = Shift(context.read_gpr(m), shift_t, shift_n, true); + const u32 res = AddWithCarry(context.read_gpr(n), ~shifted, true, carry, overflow); + context.APSR.N = res >> 31; + context.APSR.Z = res == 0; + context.APSR.C = carry; + context.APSR.V = overflow; } } -void ARMv7_instrs::CMP_RSR(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::CMP_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1046,7 +1048,7 @@ void ARMv7_instrs::CMP_RSR(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::EOR_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::EOR_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1055,7 +1057,7 @@ void ARMv7_instrs::EOR_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::EOR_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::EOR_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1064,7 +1066,7 @@ void ARMv7_instrs::EOR_REG(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::EOR_RSR(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::EOR_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1074,18 +1076,18 @@ void ARMv7_instrs::EOR_RSR(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::IT(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::IT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { case T1: { - if ((thr->code.data & 0xf) == 0) + if ((code.data & 0xf) == 0) { throw "IT_T1: Related encodings"; } - thr->ITSTATE.IT = thr->code.data & 0xff; + context.ITSTATE.IT = code.data & 0xff; return; } default: throw __FUNCTION__; @@ -1093,7 +1095,7 @@ void ARMv7_instrs::IT(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::LDM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1102,7 +1104,7 @@ void ARMv7_instrs::LDM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::LDMDA(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDMDA(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1111,7 +1113,7 @@ void ARMv7_instrs::LDMDA(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::LDMDB(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDMDB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1120,7 +1122,7 @@ void ARMv7_instrs::LDMDB(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::LDMIB(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDMIB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1130,9 +1132,9 @@ void ARMv7_instrs::LDMIB(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::LDR_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDR_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - u32 cond = thr->ITSTATE.advance(); + u32 cond = context.ITSTATE.advance(); u32 t = 0; u32 n = 13; u32 imm32 = 0; @@ -1144,22 +1146,22 @@ void ARMv7_instrs::LDR_IMM(ARMv7Thread* thr, const ARMv7_encoding type) { case T1: { - t = (thr->code.data & 0x7); - n = (thr->code.data & 0x38) >> 3; - imm32 = (thr->code.data & 0x7c0) >> 4; + t = (code.data & 0x7); + n = (code.data & 0x38) >> 3; + imm32 = (code.data & 0x7c0) >> 4; break; } case T2: { - t = (thr->code.data & 0x700) >> 8; - imm32 = (thr->code.data & 0xff) << 2; + t = (code.data & 0x700) >> 8; + imm32 = (code.data & 0xff) << 2; break; } case T3: { - t = (thr->code.data & 0xf000) >> 12; - n = (thr->code.data & 0xf0000) >> 16; - imm32 = (thr->code.data & 0xfff); + t = (code.data & 0xf000) >> 12; + n = (code.data & 0xf0000) >> 16; + imm32 = (code.data & 0xfff); if (n == 15) { @@ -1169,12 +1171,12 @@ void ARMv7_instrs::LDR_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } case T4: { - t = (thr->code.data & 0xf000) >> 12; - n = (thr->code.data & 0xf0000) >> 16; - imm32 = (thr->code.data & 0xff); - index = (thr->code.data & 0x400); - add = (thr->code.data & 0x200); - wback = (thr->code.data & 0x100); + t = (code.data & 0xf000) >> 12; + n = (code.data & 0xf0000) >> 16; + imm32 = (code.data & 0xff); + index = (code.data & 0x400); + add = (code.data & 0x200); + wback = (code.data & 0x100); if (n == 15) { @@ -1197,21 +1199,21 @@ void ARMv7_instrs::LDR_IMM(ARMv7Thread* thr, const ARMv7_encoding type) default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { - const u32 offset_addr = add ? thr->read_gpr(n) + imm32 : thr->read_gpr(n) - imm32; - const u32 addr = index ? offset_addr : thr->read_gpr(n); + const u32 offset_addr = add ? context.read_gpr(n) + imm32 : context.read_gpr(n) - imm32; + const u32 addr = index ? offset_addr : context.read_gpr(n); if (wback) { - thr->write_gpr(n, offset_addr); + context.write_gpr(n, offset_addr); } - thr->write_gpr(t, vm::psv::read32(addr)); + context.write_gpr(t, vm::psv::read32(addr)); } } -void ARMv7_instrs::LDR_LIT(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDR_LIT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1220,7 +1222,7 @@ void ARMv7_instrs::LDR_LIT(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::LDR_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDR_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1230,7 +1232,7 @@ void ARMv7_instrs::LDR_REG(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::LDRB_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDRB_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1239,7 +1241,7 @@ void ARMv7_instrs::LDRB_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::LDRB_LIT(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDRB_LIT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1248,7 +1250,7 @@ void ARMv7_instrs::LDRB_LIT(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::LDRB_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDRB_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1258,7 +1260,7 @@ void ARMv7_instrs::LDRB_REG(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::LDRD_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDRD_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1267,7 +1269,7 @@ void ARMv7_instrs::LDRD_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::LDRD_LIT(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDRD_LIT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1276,7 +1278,7 @@ void ARMv7_instrs::LDRD_LIT(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::LDRD_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDRD_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1286,7 +1288,7 @@ void ARMv7_instrs::LDRD_REG(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::LDRH_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDRH_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1295,7 +1297,7 @@ void ARMv7_instrs::LDRH_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::LDRH_LIT(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDRH_LIT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1304,7 +1306,7 @@ void ARMv7_instrs::LDRH_LIT(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::LDRH_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDRH_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1314,7 +1316,7 @@ void ARMv7_instrs::LDRH_REG(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::LDRSB_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDRSB_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1323,7 +1325,7 @@ void ARMv7_instrs::LDRSB_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::LDRSB_LIT(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDRSB_LIT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1332,7 +1334,7 @@ void ARMv7_instrs::LDRSB_LIT(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::LDRSB_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDRSB_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1342,7 +1344,7 @@ void ARMv7_instrs::LDRSB_REG(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::LDRSH_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDRSH_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1351,7 +1353,7 @@ void ARMv7_instrs::LDRSH_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::LDRSH_LIT(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDRSH_LIT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1360,7 +1362,7 @@ void ARMv7_instrs::LDRSH_LIT(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::LDRSH_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDRSH_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1370,10 +1372,47 @@ void ARMv7_instrs::LDRSH_REG(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::LSL_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LDREX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - bool set_flags = !thr->ITSTATE; - u32 cond = thr->ITSTATE.advance(); + switch (type) + { + case A1: throw __FUNCTION__; + default: throw __FUNCTION__; + } +} + +void ARMv7_instrs::LDREXB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) +{ + switch (type) + { + case A1: throw __FUNCTION__; + default: throw __FUNCTION__; + } +} + +void ARMv7_instrs::LDREXD(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) +{ + switch (type) + { + case A1: throw __FUNCTION__; + default: throw __FUNCTION__; + } +} + +void ARMv7_instrs::LDREXH(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) +{ + switch (type) + { + case A1: throw __FUNCTION__; + default: throw __FUNCTION__; + } +} + + +void ARMv7_instrs::LSL_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) +{ + bool set_flags = !context.ITSTATE; + u32 cond = context.ITSTATE.advance(); u32 d = 0; u32 m = 0; u32 shift_n = 0; @@ -1382,9 +1421,9 @@ void ARMv7_instrs::LSL_IMM(ARMv7Thread* thr, const ARMv7_encoding type) { case T1: { - d = (thr->code.data & 0x7); - m = (thr->code.data & 0x38) >> 3; - shift_n = (thr->code.data & 0x7c0) >> 6; + d = (code.data & 0x7); + m = (code.data & 0x38) >> 3; + shift_n = (code.data & 0x7c0) >> 6; if (!shift_n) { @@ -1394,10 +1433,10 @@ void ARMv7_instrs::LSL_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } case T2: { - d = (thr->code.data & 0xf00) >> 8; - m = (thr->code.data & 0xf); - set_flags = (thr->code.data & 0x100000); - shift_n = (thr->code.data & 0x7000) >> 10 | (thr->code.data & 0xc0) >> 6; + d = (code.data & 0xf00) >> 8; + m = (code.data & 0xf); + set_flags = (code.data & 0x100000); + shift_n = (code.data & 0x7000) >> 10 | (code.data & 0xc0) >> 6; if (!shift_n) { @@ -1409,24 +1448,24 @@ void ARMv7_instrs::LSL_IMM(ARMv7Thread* thr, const ARMv7_encoding type) default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { bool carry; - const u32 res = Shift_C(thr->read_gpr(m), SRType_LSL, shift_n, thr->APSR.C, carry); - thr->write_gpr(d, res); + const u32 res = Shift_C(context.read_gpr(m), SRType_LSL, shift_n, context.APSR.C, carry); + context.write_gpr(d, res); if (set_flags) { - thr->APSR.N = res >> 31; - thr->APSR.Z = res == 0; - thr->APSR.C = carry; + context.APSR.N = res >> 31; + context.APSR.Z = res == 0; + context.APSR.C = carry; } } } -void ARMv7_instrs::LSL_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LSL_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - bool set_flags = !thr->ITSTATE; - u32 cond = thr->ITSTATE.advance(); + bool set_flags = !context.ITSTATE; + u32 cond = context.ITSTATE.advance(); u32 d = 0; u32 n = 0; u32 m = 0; @@ -1435,38 +1474,38 @@ void ARMv7_instrs::LSL_REG(ARMv7Thread* thr, const ARMv7_encoding type) { case T1: { - d = n = (thr->code.data & 0x7); - m = (thr->code.data & 0x38) >> 3; + d = n = (code.data & 0x7); + m = (code.data & 0x38) >> 3; break; } case T2: { - d = (thr->code.data & 0xf00) >> 8; - n = (thr->code.data & 0xf0000) >> 16; - m = (thr->code.data & 0xf); - set_flags = (thr->code.data & 0x100000); + d = (code.data & 0xf00) >> 8; + n = (code.data & 0xf0000) >> 16; + m = (code.data & 0xf); + set_flags = (code.data & 0x100000); break; } case A1: throw __FUNCTION__; default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { bool carry; - const u32 res = Shift_C(thr->read_gpr(n), SRType_LSL, (thr->read_gpr(m) & 0xff), thr->APSR.C, carry); - thr->write_gpr(d, res); + const u32 res = Shift_C(context.read_gpr(n), SRType_LSL, (context.read_gpr(m) & 0xff), context.APSR.C, carry); + context.write_gpr(d, res); if (set_flags) { - thr->APSR.N = res >> 31; - thr->APSR.Z = res == 0; - thr->APSR.C = carry; + context.APSR.N = res >> 31; + context.APSR.Z = res == 0; + context.APSR.C = carry; } } } -void ARMv7_instrs::LSR_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LSR_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1475,7 +1514,7 @@ void ARMv7_instrs::LSR_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::LSR_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::LSR_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1485,7 +1524,7 @@ void ARMv7_instrs::LSR_REG(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::MLA(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::MLA(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1494,7 +1533,7 @@ void ARMv7_instrs::MLA(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::MLS(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::MLS(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1504,11 +1543,11 @@ void ARMv7_instrs::MLS(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::MOV_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::MOV_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - bool set_flags = !thr->ITSTATE; - bool carry = thr->APSR.C; - u32 cond = thr->ITSTATE.advance(); + bool set_flags = !context.ITSTATE; + bool carry = context.APSR.C; + u32 cond = context.ITSTATE.advance(); u32 d = 0; u32 imm32 = 0; @@ -1516,42 +1555,42 @@ void ARMv7_instrs::MOV_IMM(ARMv7Thread* thr, const ARMv7_encoding type) { case T1: { - d = (thr->code.data >> 8) & 0x7; - imm32 = sign<8, u32>(thr->code.data & 0xff); + d = (code.data >> 8) & 0x7; + imm32 = sign<8, u32>(code.data & 0xff); break; } case T2: { - set_flags = thr->code.data & 0x100000; - d = (thr->code.data >> 8) & 0xf; - imm32 = ThumbExpandImm_C((thr->code.data & 0x4000000) >> 15 | (thr->code.data & 0x7000) >> 4 | (thr->code.data & 0xff), carry, carry); + set_flags = code.data & 0x100000; + d = (code.data >> 8) & 0xf; + imm32 = ThumbExpandImm_C((code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff), carry, carry); break; } case T3: { set_flags = false; - d = (thr->code.data >> 8) & 0xf; - imm32 = (thr->code.data & 0xf0000) >> 4 | (thr->code.data & 0x4000000) >> 15 | (thr->code.data & 0x7000) >> 4 | (thr->code.data & 0xff); + d = (code.data >> 8) & 0xf; + imm32 = (code.data & 0xf0000) >> 4 | (code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff); break; } default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { - thr->write_gpr(d, imm32); + context.write_gpr(d, imm32); if (set_flags) { - thr->APSR.N = imm32 >> 31; - thr->APSR.Z = imm32 == 0; - thr->APSR.C = carry; + context.APSR.N = imm32 >> 31; + context.APSR.Z = imm32 == 0; + context.APSR.C = carry; } } } -void ARMv7_instrs::MOV_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::MOV_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - u32 cond = thr->ITSTATE.advance(); + u32 cond = context.ITSTATE.advance(); u32 d = 0; u32 m = 0; bool set_flags = false; @@ -1560,44 +1599,44 @@ void ARMv7_instrs::MOV_REG(ARMv7Thread* thr, const ARMv7_encoding type) { case T1: { - d = (thr->code.data & 0x80) >> 4 | (thr->code.data & 0x7); - m = (thr->code.data & 0x78) >> 3; + d = (code.data & 0x80) >> 4 | (code.data & 0x7); + m = (code.data & 0x78) >> 3; break; } case T2: { - d = (thr->code.data & 0x7); - m = (thr->code.data & 0x38) >> 3; + d = (code.data & 0x7); + m = (code.data & 0x38) >> 3; set_flags = true; break; } case T3: { - d = (thr->code.data & 0xf00) >> 8; - m = (thr->code.data & 0xf); - set_flags = (thr->code.data & 0x100000); + d = (code.data & 0xf00) >> 8; + m = (code.data & 0xf); + set_flags = (code.data & 0x100000); break; } case A1: throw __FUNCTION__; default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { - const u32 res = thr->read_gpr(m); - thr->write_gpr(d, res); + const u32 res = context.read_gpr(m); + context.write_gpr(d, res); if (set_flags) { - thr->APSR.N = res >> 31; - thr->APSR.Z = res == 0; - //thr->APSR.C = ? + context.APSR.N = res >> 31; + context.APSR.Z = res == 0; + //context.APSR.C = ? } } } -void ARMv7_instrs::MOVT(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::MOVT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - u32 cond = thr->ITSTATE.advance(); + u32 cond = context.ITSTATE.advance(); u32 d = 0; u32 imm16 = 0; @@ -1605,22 +1644,22 @@ void ARMv7_instrs::MOVT(ARMv7Thread* thr, const ARMv7_encoding type) { case T1: { - d = (thr->code.data & 0xf00) >> 8; - imm16 = (thr->code.data & 0xf0000) >> 4 | (thr->code.data & 0x4000000) >> 14 | (thr->code.data & 0x7000) >> 4 | (thr->code.data & 0xff); + d = (code.data & 0xf00) >> 8; + imm16 = (code.data & 0xf0000) >> 4 | (code.data & 0x4000000) >> 14 | (code.data & 0x7000) >> 4 | (code.data & 0xff); break; } case A1: throw __FUNCTION__; default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { - thr->write_gpr(d, (thr->read_gpr(d) & 0xffff) | (imm16 << 16)); + context.write_gpr(d, (context.read_gpr(d) & 0xffff) | (imm16 << 16)); } } -void ARMv7_instrs::MRS(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::MRS(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1629,7 +1668,7 @@ void ARMv7_instrs::MRS(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::MSR_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::MSR_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1638,7 +1677,7 @@ void ARMv7_instrs::MSR_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::MSR_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::MSR_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1648,7 +1687,7 @@ void ARMv7_instrs::MSR_REG(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::MUL(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::MUL(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1658,7 +1697,7 @@ void ARMv7_instrs::MUL(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::MVN_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::MVN_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1667,7 +1706,7 @@ void ARMv7_instrs::MVN_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::MVN_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::MVN_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1676,7 +1715,7 @@ void ARMv7_instrs::MVN_REG(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::MVN_RSR(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::MVN_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1686,9 +1725,9 @@ void ARMv7_instrs::MVN_RSR(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::NOP(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::NOP(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - u32 cond = thr->ITSTATE.advance(); + u32 cond = context.ITSTATE.advance(); switch (type) { @@ -1702,19 +1741,19 @@ void ARMv7_instrs::NOP(ARMv7Thread* thr, const ARMv7_encoding type) } case A1: { - cond = thr->code.data >> 28; + cond = code.data >> 28; break; } default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { } } -void ARMv7_instrs::ORN_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::ORN_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1723,7 +1762,7 @@ void ARMv7_instrs::ORN_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::ORN_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::ORN_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1733,7 +1772,7 @@ void ARMv7_instrs::ORN_REG(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::ORR_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::ORR_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1742,7 +1781,7 @@ void ARMv7_instrs::ORR_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::ORR_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::ORR_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1751,7 +1790,7 @@ void ARMv7_instrs::ORR_REG(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::ORR_RSR(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::ORR_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1761,7 +1800,7 @@ void ARMv7_instrs::ORR_RSR(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::PKH(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::PKH(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1771,32 +1810,32 @@ void ARMv7_instrs::PKH(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::POP(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::POP(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - u32 cond = thr->ITSTATE.advance(); + u32 cond = context.ITSTATE.advance(); u16 reg_list = 0; switch (type) { case T1: { - reg_list = ((thr->code.data & 0x100) << 7) | (thr->code.data & 0xff); + reg_list = ((code.data & 0x100) << 7) | (code.data & 0xff); break; } case T2: { - reg_list = thr->code.data & 0xdfff; + reg_list = code.data & 0xdfff; break; } case T3: { - reg_list = 1 << (thr->code.data >> 12); + reg_list = 1 << (code.data >> 12); break; } case A1: { - cond = thr->code.data >> 28; - reg_list = thr->code.data & 0xffff; + cond = code.data >> 28; + reg_list = code.data & 0xffff; if (BitCount(reg_list) < 2) { throw "LDM / LDMIA / LDMFD"; @@ -1805,52 +1844,52 @@ void ARMv7_instrs::POP(ARMv7Thread* thr, const ARMv7_encoding type) } case A2: { - cond = thr->code.data >> 28; - reg_list = 1 << ((thr->code.data >> 12) & 0xf); + cond = code.data >> 28; + reg_list = 1 << ((code.data >> 12) & 0xf); break; } default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { for (u16 mask = 1, i = 0; mask; mask <<= 1, i++) { if (reg_list & mask) { - thr->write_gpr(i, vm::psv::read32(thr->SP)); - thr->SP += 4; + context.write_gpr(i, vm::psv::read32(context.SP)); + context.SP += 4; } } } } -void ARMv7_instrs::PUSH(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::PUSH(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - u32 cond = thr->ITSTATE.advance(); + u32 cond = context.ITSTATE.advance(); u16 reg_list = 0; switch (type) { case T1: { - reg_list = ((thr->code.data & 0x100) << 6) | (thr->code.data & 0xff); + reg_list = ((code.data & 0x100) << 6) | (code.data & 0xff); break; } case T2: { - reg_list = thr->code.data & 0x5fff; + reg_list = code.data & 0x5fff; break; } case T3: { - reg_list = 1 << (thr->code.data >> 12); + reg_list = 1 << (code.data >> 12); break; } case A1: { - cond = thr->code.data >> 28; - reg_list = thr->code.data & 0xffff; + cond = code.data >> 28; + reg_list = code.data & 0xffff; if (BitCount(reg_list) < 2) { throw "STMDB / STMFD"; @@ -1859,28 +1898,28 @@ void ARMv7_instrs::PUSH(ARMv7Thread* thr, const ARMv7_encoding type) } case A2: { - cond = thr->code.data >> 28; - reg_list = 1 << ((thr->code.data >> 12) & 0xf); + cond = code.data >> 28; + reg_list = 1 << ((code.data >> 12) & 0xf); break; } default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { for (u16 mask = 1 << 15, i = 15; mask; mask >>= 1, i--) { if (reg_list & mask) { - thr->SP -= 4; - vm::psv::write32(thr->SP, thr->read_gpr(i)); + context.SP -= 4; + vm::psv::write32(context.SP, context.read_gpr(i)); } } } } -void ARMv7_instrs::QADD(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::QADD(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1889,7 +1928,7 @@ void ARMv7_instrs::QADD(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::QADD16(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::QADD16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1898,7 +1937,7 @@ void ARMv7_instrs::QADD16(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::QADD8(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::QADD8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1907,7 +1946,7 @@ void ARMv7_instrs::QADD8(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::QASX(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::QASX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1916,7 +1955,7 @@ void ARMv7_instrs::QASX(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::QDADD(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::QDADD(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1925,7 +1964,7 @@ void ARMv7_instrs::QDADD(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::QDSUB(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::QDSUB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1934,7 +1973,7 @@ void ARMv7_instrs::QDSUB(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::QSAX(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::QSAX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1943,7 +1982,7 @@ void ARMv7_instrs::QSAX(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::QSUB(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::QSUB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1952,7 +1991,7 @@ void ARMv7_instrs::QSUB(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::QSUB16(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::QSUB16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1961,7 +2000,7 @@ void ARMv7_instrs::QSUB16(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::QSUB8(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::QSUB8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1971,7 +2010,7 @@ void ARMv7_instrs::QSUB8(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::RBIT(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::RBIT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1980,7 +2019,7 @@ void ARMv7_instrs::RBIT(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::REV(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::REV(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1989,7 +2028,7 @@ void ARMv7_instrs::REV(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::REV16(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::REV16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -1998,7 +2037,7 @@ void ARMv7_instrs::REV16(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::REVSH(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::REVSH(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2008,7 +2047,7 @@ void ARMv7_instrs::REVSH(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::ROR_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::ROR_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2017,7 +2056,7 @@ void ARMv7_instrs::ROR_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::ROR_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::ROR_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2027,7 +2066,7 @@ void ARMv7_instrs::ROR_REG(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::RRX(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::RRX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2037,7 +2076,7 @@ void ARMv7_instrs::RRX(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::RSB_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::RSB_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2046,7 +2085,7 @@ void ARMv7_instrs::RSB_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::RSB_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::RSB_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2055,7 +2094,7 @@ void ARMv7_instrs::RSB_REG(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::RSB_RSR(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::RSB_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2065,7 +2104,7 @@ void ARMv7_instrs::RSB_RSR(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::RSC_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::RSC_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2074,7 +2113,7 @@ void ARMv7_instrs::RSC_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::RSC_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::RSC_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2083,7 +2122,7 @@ void ARMv7_instrs::RSC_REG(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::RSC_RSR(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::RSC_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2093,7 +2132,7 @@ void ARMv7_instrs::RSC_RSR(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::SADD16(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SADD16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2102,7 +2141,7 @@ void ARMv7_instrs::SADD16(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SADD8(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SADD8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2111,7 +2150,7 @@ void ARMv7_instrs::SADD8(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SASX(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SASX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2121,7 +2160,7 @@ void ARMv7_instrs::SASX(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::SBC_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SBC_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2130,7 +2169,7 @@ void ARMv7_instrs::SBC_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SBC_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SBC_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2139,7 +2178,7 @@ void ARMv7_instrs::SBC_REG(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SBC_RSR(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SBC_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2149,7 +2188,7 @@ void ARMv7_instrs::SBC_RSR(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::SBFX(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SBFX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2159,7 +2198,7 @@ void ARMv7_instrs::SBFX(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::SDIV(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SDIV(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2169,7 +2208,7 @@ void ARMv7_instrs::SDIV(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::SEL(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SEL(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2179,7 +2218,7 @@ void ARMv7_instrs::SEL(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::SHADD16(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SHADD16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2188,7 +2227,7 @@ void ARMv7_instrs::SHADD16(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SHADD8(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SHADD8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2197,7 +2236,7 @@ void ARMv7_instrs::SHADD8(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SHASX(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SHASX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2206,7 +2245,7 @@ void ARMv7_instrs::SHASX(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SHSAX(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SHSAX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2215,7 +2254,7 @@ void ARMv7_instrs::SHSAX(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SHSUB16(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SHSUB16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2224,7 +2263,7 @@ void ARMv7_instrs::SHSUB16(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SHSUB8(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SHSUB8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2234,7 +2273,7 @@ void ARMv7_instrs::SHSUB8(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::SMLA__(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SMLA__(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2243,7 +2282,7 @@ void ARMv7_instrs::SMLA__(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SMLAD(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SMLAD(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2252,7 +2291,7 @@ void ARMv7_instrs::SMLAD(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SMLAL(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SMLAL(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2261,7 +2300,7 @@ void ARMv7_instrs::SMLAL(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SMLAL__(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SMLAL__(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2270,7 +2309,7 @@ void ARMv7_instrs::SMLAL__(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SMLALD(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SMLALD(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2279,7 +2318,7 @@ void ARMv7_instrs::SMLALD(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SMLAW_(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SMLAW_(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2288,7 +2327,7 @@ void ARMv7_instrs::SMLAW_(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SMLSD(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SMLSD(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2297,7 +2336,7 @@ void ARMv7_instrs::SMLSD(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SMLSLD(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SMLSLD(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2306,7 +2345,7 @@ void ARMv7_instrs::SMLSLD(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SMMLA(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SMMLA(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2315,7 +2354,7 @@ void ARMv7_instrs::SMMLA(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SMMLS(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SMMLS(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2324,7 +2363,7 @@ void ARMv7_instrs::SMMLS(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SMMUL(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SMMUL(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2333,7 +2372,7 @@ void ARMv7_instrs::SMMUL(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SMUAD(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SMUAD(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2342,7 +2381,7 @@ void ARMv7_instrs::SMUAD(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SMUL__(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SMUL__(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2351,7 +2390,7 @@ void ARMv7_instrs::SMUL__(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SMULL(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SMULL(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2360,7 +2399,7 @@ void ARMv7_instrs::SMULL(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SMULW_(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SMULW_(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2369,7 +2408,7 @@ void ARMv7_instrs::SMULW_(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SMUSD(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SMUSD(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2379,7 +2418,7 @@ void ARMv7_instrs::SMUSD(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::SSAT(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SSAT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2388,7 +2427,7 @@ void ARMv7_instrs::SSAT(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SSAT16(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SSAT16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2397,7 +2436,7 @@ void ARMv7_instrs::SSAT16(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SSAX(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SSAX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2406,7 +2445,7 @@ void ARMv7_instrs::SSAX(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SSUB16(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SSUB16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2415,7 +2454,7 @@ void ARMv7_instrs::SSUB16(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SSUB8(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SSUB8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2425,7 +2464,7 @@ void ARMv7_instrs::SSUB8(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::STM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::STM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2434,7 +2473,7 @@ void ARMv7_instrs::STM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::STMDA(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::STMDA(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2443,7 +2482,7 @@ void ARMv7_instrs::STMDA(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::STMDB(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::STMDB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2452,7 +2491,7 @@ void ARMv7_instrs::STMDB(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::STMIB(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::STMIB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2462,9 +2501,9 @@ void ARMv7_instrs::STMIB(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::STR_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::STR_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - u32 cond = thr->ITSTATE.advance(); + u32 cond = context.ITSTATE.advance(); u32 t = 16; u32 n = 13; u32 imm32 = 0; @@ -2476,22 +2515,22 @@ void ARMv7_instrs::STR_IMM(ARMv7Thread* thr, const ARMv7_encoding type) { case T1: { - t = (thr->code.data & 0x7); - n = (thr->code.data & 0x38) >> 3; - imm32 = (thr->code.data & 0x7c0) >> 4; + t = (code.data & 0x7); + n = (code.data & 0x38) >> 3; + imm32 = (code.data & 0x7c0) >> 4; break; } case T2: { - t = (thr->code.data & 0x700) >> 8; - imm32 = (thr->code.data & 0xff) << 2; + t = (code.data & 0x700) >> 8; + imm32 = (code.data & 0xff) << 2; break; } case T3: { - t = (thr->code.data & 0xf000) >> 12; - n = (thr->code.data & 0xf0000) >> 16; - imm32 = (thr->code.data & 0xfff); + t = (code.data & 0xf000) >> 12; + n = (code.data & 0xf0000) >> 16; + imm32 = (code.data & 0xfff); if (n == 0xf) { @@ -2501,12 +2540,12 @@ void ARMv7_instrs::STR_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } case T4: { - t = (thr->code.data & 0xf000) >> 12; - n = (thr->code.data & 0xf0000) >> 16; - imm32 = (thr->code.data & 0xff); - index = (thr->code.data & 0x400); - add = (thr->code.data & 0x200); - wback = (thr->code.data & 0x100); + t = (code.data & 0xf000) >> 12; + n = (code.data & 0xf0000) >> 16; + imm32 = (code.data & 0xff); + index = (code.data & 0x400); + add = (code.data & 0x200); + wback = (code.data & 0x100); if (index && add && !wback) { @@ -2526,23 +2565,23 @@ void ARMv7_instrs::STR_IMM(ARMv7Thread* thr, const ARMv7_encoding type) default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { - const u32 offset_addr = add ? thr->read_gpr(n) + imm32 : thr->read_gpr(n) - imm32; - const u32 addr = index ? offset_addr : thr->read_gpr(n); + const u32 offset_addr = add ? context.read_gpr(n) + imm32 : context.read_gpr(n) - imm32; + const u32 addr = index ? offset_addr : context.read_gpr(n); - vm::psv::write32(addr, thr->read_gpr(t)); + vm::psv::write32(addr, context.read_gpr(t)); if (wback) { - thr->write_gpr(n, offset_addr); + context.write_gpr(n, offset_addr); } } } -void ARMv7_instrs::STR_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::STR_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - u32 cond = thr->ITSTATE.advance(); + u32 cond = context.ITSTATE.advance(); u32 t = 0; u32 n = 0; u32 m = 0; @@ -2556,17 +2595,17 @@ void ARMv7_instrs::STR_REG(ARMv7Thread* thr, const ARMv7_encoding type) { case T1: { - t = (thr->code.data & 0x7); - n = (thr->code.data & 0x38) >> 3; - m = (thr->code.data & 0x1c0) >> 6; + t = (code.data & 0x7); + n = (code.data & 0x38) >> 3; + m = (code.data & 0x1c0) >> 6; break; } case T2: { - t = (thr->code.data & 0xf000) >> 12; - n = (thr->code.data & 0xf0000) >> 16; - m = (thr->code.data & 0xf); - shift_n = (thr->code.data & 0x30) >> 4; + t = (code.data & 0xf000) >> 12; + n = (code.data & 0xf0000) >> 16; + m = (code.data & 0xf); + shift_n = (code.data & 0x30) >> 4; if (n == 15) { @@ -2578,23 +2617,23 @@ void ARMv7_instrs::STR_REG(ARMv7Thread* thr, const ARMv7_encoding type) default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { - const u32 offset = Shift(thr->read_gpr(m), shift_t, shift_n, thr->APSR.C); - const u32 offset_addr = add ? thr->read_gpr(n) + offset : thr->read_gpr(n) - offset; - const u32 addr = index ? offset_addr : thr->read_gpr(n); + const u32 offset = Shift(context.read_gpr(m), shift_t, shift_n, context.APSR.C); + const u32 offset_addr = add ? context.read_gpr(n) + offset : context.read_gpr(n) - offset; + const u32 addr = index ? offset_addr : context.read_gpr(n); - vm::psv::write32(addr, thr->read_gpr(t)); + vm::psv::write32(addr, context.read_gpr(t)); if (wback) { - thr->write_gpr(n, offset_addr); + context.write_gpr(n, offset_addr); } } } -void ARMv7_instrs::STRB_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::STRB_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2603,7 +2642,7 @@ void ARMv7_instrs::STRB_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::STRB_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::STRB_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2613,7 +2652,7 @@ void ARMv7_instrs::STRB_REG(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::STRD_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::STRD_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2622,7 +2661,7 @@ void ARMv7_instrs::STRD_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::STRD_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::STRD_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2632,7 +2671,7 @@ void ARMv7_instrs::STRD_REG(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::STRH_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::STRH_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2641,7 +2680,7 @@ void ARMv7_instrs::STRH_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::STRH_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::STRH_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2651,10 +2690,47 @@ void ARMv7_instrs::STRH_REG(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::SUB_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::STREX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - bool set_flags = !thr->ITSTATE; - u32 cond = thr->ITSTATE.advance(); + switch (type) + { + case A1: throw __FUNCTION__; + default: throw __FUNCTION__; + } +} + +void ARMv7_instrs::STREXB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) +{ + switch (type) + { + case A1: throw __FUNCTION__; + default: throw __FUNCTION__; + } +} + +void ARMv7_instrs::STREXD(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) +{ + switch (type) + { + case A1: throw __FUNCTION__; + default: throw __FUNCTION__; + } +} + +void ARMv7_instrs::STREXH(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) +{ + switch (type) + { + case A1: throw __FUNCTION__; + default: throw __FUNCTION__; + } +} + + +void ARMv7_instrs::SUB_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) +{ + bool set_flags = !context.ITSTATE; + u32 cond = context.ITSTATE.advance(); u32 d = 0; u32 n = 0; u32 imm32 = 0; @@ -2663,23 +2739,23 @@ void ARMv7_instrs::SUB_IMM(ARMv7Thread* thr, const ARMv7_encoding type) { case T1: { - d = (thr->code.data & 0x7); - n = (thr->code.data & 0x38) >> 3; - imm32 = (thr->code.data & 0x1c) >> 6; + d = (code.data & 0x7); + n = (code.data & 0x38) >> 3; + imm32 = (code.data & 0x1c) >> 6; break; } case T2: { - d = n = (thr->code.data & 0x700) >> 8; - imm32 = (thr->code.data & 0xff); + d = n = (code.data & 0x700) >> 8; + imm32 = (code.data & 0xff); break; } case T3: { - d = (thr->code.data & 0xf00) >> 8; - n = (thr->code.data & 0xf0000) >> 16; - set_flags = (thr->code.data & 0x100000); - imm32 = ThumbExpandImm(thr, (thr->code.data & 0x4000000) >> 15 | (thr->code.data & 0x7000) >> 4 | (thr->code.data & 0xff)); + d = (code.data & 0xf00) >> 8; + n = (code.data & 0xf0000) >> 16; + set_flags = (code.data & 0x100000); + imm32 = ThumbExpandImm(context, (code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff)); if (d == 15 && set_flags) { @@ -2693,10 +2769,10 @@ void ARMv7_instrs::SUB_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } case T4: { - d = (thr->code.data & 0xf00) >> 8; - n = (thr->code.data & 0xf0000) >> 16; + d = (code.data & 0xf00) >> 8; + n = (code.data & 0xf0000) >> 16; set_flags = false; - imm32 = (thr->code.data & 0x4000000) >> 15 | (thr->code.data & 0x7000) >> 4 | (thr->code.data & 0xff); + imm32 = (code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff); if (d == 15) { @@ -2712,29 +2788,29 @@ void ARMv7_instrs::SUB_IMM(ARMv7Thread* thr, const ARMv7_encoding type) default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { if (set_flags) { bool carry, overflow; - const u32 res = AddWithCarry(thr->read_gpr(n), ~imm32, true, carry, overflow); - thr->write_gpr(d, res); - thr->APSR.N = res >> 31; - thr->APSR.Z = res == 0; - thr->APSR.C = carry; - thr->APSR.V = overflow; + const u32 res = AddWithCarry(context.read_gpr(n), ~imm32, true, carry, overflow); + context.write_gpr(d, res); + context.APSR.N = res >> 31; + context.APSR.Z = res == 0; + context.APSR.C = carry; + context.APSR.V = overflow; } else { - thr->write_gpr(d, thr->read_gpr(n) - imm32); + context.write_gpr(d, context.read_gpr(n) - imm32); } } } -void ARMv7_instrs::SUB_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SUB_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - bool set_flags = !thr->ITSTATE; - u32 cond = thr->ITSTATE.advance(); + bool set_flags = !context.ITSTATE; + u32 cond = context.ITSTATE.advance(); u32 d = 0; u32 n = 0; u32 m = 0; @@ -2745,18 +2821,18 @@ void ARMv7_instrs::SUB_REG(ARMv7Thread* thr, const ARMv7_encoding type) { case T1: { - d = (thr->code.data & 0x7); - n = (thr->code.data & 0x38) >> 3; - m = (thr->code.data & 0x1c0) >> 6; + d = (code.data & 0x7); + n = (code.data & 0x38) >> 3; + m = (code.data & 0x1c0) >> 6; break; } case T2: { - d = (thr->code.data & 0xf00) >> 8; - n = (thr->code.data & 0xf0000) >> 16; - m = (thr->code.data & 0xf); - set_flags = (thr->code.data & 0x100000); - shift_t = DecodeImmShift((thr->code.data & 0x30) >> 4, (thr->code.data & 0x7000) >> 10 | (thr->code.data & 0xc0) >> 6, &shift_n); + d = (code.data & 0xf00) >> 8; + n = (code.data & 0xf0000) >> 16; + m = (code.data & 0xf); + set_flags = (code.data & 0x100000); + shift_t = DecodeImmShift((code.data & 0x30) >> 4, (code.data & 0x7000) >> 10 | (code.data & 0xc0) >> 6, &shift_n); if (d == 15 && set_flags) { @@ -2772,27 +2848,27 @@ void ARMv7_instrs::SUB_REG(ARMv7Thread* thr, const ARMv7_encoding type) default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { - const u32 shifted = Shift(thr->read_gpr(m), shift_t, shift_n, thr->APSR.C); + const u32 shifted = Shift(context.read_gpr(m), shift_t, shift_n, context.APSR.C); if (set_flags) { bool carry, overflow; - const u32 res = AddWithCarry(thr->read_gpr(n), ~shifted, true, carry, overflow); - thr->write_gpr(d, res); - thr->APSR.N = res >> 31; - thr->APSR.Z = res == 0; - thr->APSR.C = carry; - thr->APSR.V = overflow; + const u32 res = AddWithCarry(context.read_gpr(n), ~shifted, true, carry, overflow); + context.write_gpr(d, res); + context.APSR.N = res >> 31; + context.APSR.Z = res == 0; + context.APSR.C = carry; + context.APSR.V = overflow; } else { - thr->write_gpr(d, thr->read_gpr(n) - shifted); + context.write_gpr(d, context.read_gpr(n) - shifted); } } } -void ARMv7_instrs::SUB_RSR(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SUB_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2801,9 +2877,9 @@ void ARMv7_instrs::SUB_RSR(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SUB_SPI(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SUB_SPI(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { - u32 cond = thr->ITSTATE.advance(); + u32 cond = context.ITSTATE.advance(); u32 d = 13; bool set_flags = false; u32 imm32 = 0; @@ -2812,14 +2888,14 @@ void ARMv7_instrs::SUB_SPI(ARMv7Thread* thr, const ARMv7_encoding type) { case T1: { - imm32 = (thr->code.data & 0x7f) << 2; + imm32 = (code.data & 0x7f) << 2; break; } case T2: { - d = (thr->code.data & 0xf00) >> 8; - set_flags = (thr->code.data & 0x100000); - imm32 = ThumbExpandImm(thr, (thr->code.data & 0x4000000) >> 15 | (thr->code.data & 0x7000) >> 4 | (thr->code.data & 0xff)); + d = (code.data & 0xf00) >> 8; + set_flags = (code.data & 0x100000); + imm32 = ThumbExpandImm(context, (code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff)); if (d == 15 && set_flags) { @@ -2829,35 +2905,35 @@ void ARMv7_instrs::SUB_SPI(ARMv7Thread* thr, const ARMv7_encoding type) } case T3: { - d = (thr->code.data & 0xf00) >> 8; + d = (code.data & 0xf00) >> 8; set_flags = false; - imm32 = (thr->code.data & 0x4000000) >> 15 | (thr->code.data & 0x7000) >> 4 | (thr->code.data & 0xff); + imm32 = (code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff); break; } case A1: throw __FUNCTION__; default: throw __FUNCTION__; } - if (ConditionPassed(thr, cond)) + if (ConditionPassed(context, cond)) { if (set_flags) { bool carry, overflow; - const u32 res = AddWithCarry(thr->SP, ~imm32, true, carry, overflow); - thr->write_gpr(d, res); - thr->APSR.N = res >> 31; - thr->APSR.Z = res == 0; - thr->APSR.C = carry; - thr->APSR.V = overflow; + const u32 res = AddWithCarry(context.SP, ~imm32, true, carry, overflow); + context.write_gpr(d, res); + context.APSR.N = res >> 31; + context.APSR.Z = res == 0; + context.APSR.C = carry; + context.APSR.V = overflow; } else { - thr->write_gpr(d, thr->SP - imm32); + context.write_gpr(d, context.SP - imm32); } } } -void ARMv7_instrs::SUB_SPR(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SUB_SPR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2867,7 +2943,7 @@ void ARMv7_instrs::SUB_SPR(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::SVC(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SVC(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2877,7 +2953,7 @@ void ARMv7_instrs::SVC(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::SXTAB(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SXTAB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2886,7 +2962,7 @@ void ARMv7_instrs::SXTAB(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SXTAB16(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SXTAB16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2895,7 +2971,7 @@ void ARMv7_instrs::SXTAB16(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SXTAH(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SXTAH(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2904,7 +2980,7 @@ void ARMv7_instrs::SXTAH(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SXTB(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SXTB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2913,7 +2989,7 @@ void ARMv7_instrs::SXTB(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SXTB16(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SXTB16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2922,7 +2998,7 @@ void ARMv7_instrs::SXTB16(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::SXTH(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::SXTH(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2932,7 +3008,7 @@ void ARMv7_instrs::SXTH(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::TB_(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::TB_(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2942,7 +3018,7 @@ void ARMv7_instrs::TB_(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::TEQ_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::TEQ_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2951,7 +3027,7 @@ void ARMv7_instrs::TEQ_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::TEQ_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::TEQ_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2960,7 +3036,7 @@ void ARMv7_instrs::TEQ_REG(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::TEQ_RSR(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::TEQ_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2970,7 +3046,7 @@ void ARMv7_instrs::TEQ_RSR(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::TST_IMM(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::TST_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2979,7 +3055,7 @@ void ARMv7_instrs::TST_IMM(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::TST_REG(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::TST_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2988,7 +3064,7 @@ void ARMv7_instrs::TST_REG(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::TST_RSR(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::TST_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -2998,7 +3074,7 @@ void ARMv7_instrs::TST_RSR(ARMv7Thread* thr, const ARMv7_encoding type) } -void ARMv7_instrs::UADD16(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UADD16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3007,7 +3083,7 @@ void ARMv7_instrs::UADD16(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UADD8(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UADD8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3016,7 +3092,7 @@ void ARMv7_instrs::UADD8(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UASX(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UASX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3025,7 +3101,7 @@ void ARMv7_instrs::UASX(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UBFX(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UBFX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3034,7 +3110,7 @@ void ARMv7_instrs::UBFX(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UDIV(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UDIV(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3043,7 +3119,7 @@ void ARMv7_instrs::UDIV(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UHADD16(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UHADD16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3052,7 +3128,7 @@ void ARMv7_instrs::UHADD16(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UHADD8(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UHADD8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3061,7 +3137,7 @@ void ARMv7_instrs::UHADD8(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UHASX(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UHASX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3070,7 +3146,7 @@ void ARMv7_instrs::UHASX(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UHSAX(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UHSAX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3079,7 +3155,7 @@ void ARMv7_instrs::UHSAX(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UHSUB16(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UHSUB16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3088,7 +3164,7 @@ void ARMv7_instrs::UHSUB16(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UHSUB8(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UHSUB8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3097,7 +3173,7 @@ void ARMv7_instrs::UHSUB8(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UMAAL(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UMAAL(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3106,7 +3182,7 @@ void ARMv7_instrs::UMAAL(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UMLAL(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UMLAL(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3115,7 +3191,7 @@ void ARMv7_instrs::UMLAL(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UMULL(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UMULL(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3124,7 +3200,7 @@ void ARMv7_instrs::UMULL(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UQADD16(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UQADD16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3133,7 +3209,7 @@ void ARMv7_instrs::UQADD16(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UQADD8(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UQADD8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3142,7 +3218,7 @@ void ARMv7_instrs::UQADD8(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UQASX(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UQASX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3151,7 +3227,7 @@ void ARMv7_instrs::UQASX(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UQSAX(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UQSAX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3160,7 +3236,7 @@ void ARMv7_instrs::UQSAX(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UQSUB16(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UQSUB16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3169,7 +3245,7 @@ void ARMv7_instrs::UQSUB16(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UQSUB8(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UQSUB8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3178,7 +3254,7 @@ void ARMv7_instrs::UQSUB8(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::USAD8(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::USAD8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3187,7 +3263,7 @@ void ARMv7_instrs::USAD8(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::USADA8(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::USADA8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3196,7 +3272,7 @@ void ARMv7_instrs::USADA8(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::USAT(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::USAT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3205,7 +3281,7 @@ void ARMv7_instrs::USAT(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::USAT16(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::USAT16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3214,7 +3290,7 @@ void ARMv7_instrs::USAT16(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::USAX(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::USAX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3223,7 +3299,7 @@ void ARMv7_instrs::USAX(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::USUB16(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::USUB16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3232,7 +3308,7 @@ void ARMv7_instrs::USUB16(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::USUB8(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::USUB8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3241,7 +3317,7 @@ void ARMv7_instrs::USUB8(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UXTAB(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UXTAB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3250,7 +3326,7 @@ void ARMv7_instrs::UXTAB(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UXTAB16(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UXTAB16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3259,7 +3335,7 @@ void ARMv7_instrs::UXTAB16(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UXTAH(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UXTAH(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3268,7 +3344,7 @@ void ARMv7_instrs::UXTAH(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UXTB(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UXTB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3277,7 +3353,7 @@ void ARMv7_instrs::UXTB(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UXTB16(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UXTB16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { @@ -3286,7 +3362,7 @@ void ARMv7_instrs::UXTB16(ARMv7Thread* thr, const ARMv7_encoding type) } } -void ARMv7_instrs::UXTH(ARMv7Thread* thr, const ARMv7_encoding type) +void ARMv7_instrs::UXTH(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { switch (type) { diff --git a/rpcs3/Emu/ARMv7/ARMv7Interpreter.h b/rpcs3/Emu/ARMv7/ARMv7Interpreter.h index 0cd02aecf7..0bf9652ba6 100644 --- a/rpcs3/Emu/ARMv7/ARMv7Interpreter.h +++ b/rpcs3/Emu/ARMv7/ARMv7Interpreter.h @@ -1,9 +1,5 @@ #pragma once -#include "Emu/ARMv7/ARMv7Thread.h" -#include "Emu/System.h" -#include "Utilities/Log.h" - enum ARMv7_encoding { T1, T2, T3, T4, A1, A2 @@ -61,18 +57,18 @@ namespace ARMv7_instrs SRType DecodeRegShift(u8 type); u32 LSL_C(u32 x, s32 shift, bool& carry_out); - u32 LSL(u32 x, s32 shift); + u32 LSL_(u32 x, s32 shift); u32 LSR_C(u32 x, s32 shift, bool& carry_out); - u32 LSR(u32 x, s32 shift); + u32 LSR_(u32 x, s32 shift); s32 ASR_C(s32 x, s32 shift, bool& carry_out); - s32 ASR(s32 x, s32 shift); + s32 ASR_(s32 x, s32 shift); u32 ROR_C(u32 x, s32 shift, bool& carry_out); - u32 ROR(u32 x, s32 shift); + u32 ROR_(u32 x, s32 shift); u32 RRX_C(u32 x, bool carry_in, bool& carry_out); - u32 RRX(u32 x, bool carry_in); + u32 RRX_(u32 x, bool carry_in); template T Shift_C(T value, SRType type, s32 amount, bool carry_in, bool& carry_out); @@ -81,283 +77,293 @@ namespace ARMv7_instrs template T AddWithCarry(T x, T y, bool carry_in, bool& carry_out, bool& overflow); u32 ThumbExpandImm_C(u32 imm12, bool carry_in, bool& carry_out); - u32 ThumbExpandImm(ARMv7Thread* CPU, u32 imm12); + u32 ThumbExpandImm(ARMv7Context& context, u32 imm12); - bool ConditionPassed(ARMv7Thread* CPU, u32 cond); + bool ConditionPassed(ARMv7Context& context, u32 cond); // instructions - void UNK(ARMv7Thread* thr); + void UNK(ARMv7Context& context, const ARMv7Code code); - void NULL_OP(ARMv7Thread* thr, const ARMv7_encoding type); + void NULL_OP(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void HACK(ARMv7Thread* thr, const ARMv7_encoding type); + void HACK(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void ADC_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void ADC_REG(ARMv7Thread* thr, const ARMv7_encoding type); - void ADC_RSR(ARMv7Thread* thr, const ARMv7_encoding type); + void ADC_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void ADC_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void ADC_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void ADD_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void ADD_REG(ARMv7Thread* thr, const ARMv7_encoding type); - void ADD_RSR(ARMv7Thread* thr, const ARMv7_encoding type); - void ADD_SPI(ARMv7Thread* thr, const ARMv7_encoding type); - void ADD_SPR(ARMv7Thread* thr, const ARMv7_encoding type); + void ADD_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void ADD_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void ADD_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void ADD_SPI(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void ADD_SPR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void ADR(ARMv7Thread* thr, const ARMv7_encoding type); + void ADR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void AND_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void AND_REG(ARMv7Thread* thr, const ARMv7_encoding type); - void AND_RSR(ARMv7Thread* thr, const ARMv7_encoding type); + void AND_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void AND_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void AND_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void ASR_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void ASR_REG(ARMv7Thread* thr, const ARMv7_encoding type); + void ASR_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void ASR_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void B(ARMv7Thread* thr, const ARMv7_encoding type); + void B(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void BFC(ARMv7Thread* thr, const ARMv7_encoding type); - void BFI(ARMv7Thread* thr, const ARMv7_encoding type); + void BFC(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void BFI(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void BIC_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void BIC_REG(ARMv7Thread* thr, const ARMv7_encoding type); - void BIC_RSR(ARMv7Thread* thr, const ARMv7_encoding type); + void BIC_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void BIC_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void BIC_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void BKPT(ARMv7Thread* thr, const ARMv7_encoding type); + void BKPT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void BL(ARMv7Thread* thr, const ARMv7_encoding type); - void BLX(ARMv7Thread* thr, const ARMv7_encoding type); - void BX(ARMv7Thread* thr, const ARMv7_encoding type); + void BL(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void BLX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void BX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void CB_Z(ARMv7Thread* thr, const ARMv7_encoding type); + void CB_Z(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void CLZ(ARMv7Thread* thr, const ARMv7_encoding type); + void CLZ(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void CMN_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void CMN_REG(ARMv7Thread* thr, const ARMv7_encoding type); - void CMN_RSR(ARMv7Thread* thr, const ARMv7_encoding type); + void CMN_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void CMN_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void CMN_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void CMP_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void CMP_REG(ARMv7Thread* thr, const ARMv7_encoding type); - void CMP_RSR(ARMv7Thread* thr, const ARMv7_encoding type); + void CMP_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void CMP_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void CMP_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void EOR_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void EOR_REG(ARMv7Thread* thr, const ARMv7_encoding type); - void EOR_RSR(ARMv7Thread* thr, const ARMv7_encoding type); + void EOR_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void EOR_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void EOR_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void IT(ARMv7Thread* thr, const ARMv7_encoding type); + void IT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void LDM(ARMv7Thread* thr, const ARMv7_encoding type); - void LDMDA(ARMv7Thread* thr, const ARMv7_encoding type); - void LDMDB(ARMv7Thread* thr, const ARMv7_encoding type); - void LDMIB(ARMv7Thread* thr, const ARMv7_encoding type); + void LDM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void LDMDA(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void LDMDB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void LDMIB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void LDR_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void LDR_LIT(ARMv7Thread* thr, const ARMv7_encoding type); - void LDR_REG(ARMv7Thread* thr, const ARMv7_encoding type); + void LDR_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void LDR_LIT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void LDR_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void LDRB_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void LDRB_LIT(ARMv7Thread* thr, const ARMv7_encoding type); - void LDRB_REG(ARMv7Thread* thr, const ARMv7_encoding type); + void LDRB_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void LDRB_LIT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void LDRB_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void LDRD_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void LDRD_LIT(ARMv7Thread* thr, const ARMv7_encoding type); - void LDRD_REG(ARMv7Thread* thr, const ARMv7_encoding type); + void LDRD_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void LDRD_LIT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void LDRD_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void LDRH_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void LDRH_LIT(ARMv7Thread* thr, const ARMv7_encoding type); - void LDRH_REG(ARMv7Thread* thr, const ARMv7_encoding type); + void LDRH_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void LDRH_LIT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void LDRH_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void LDRSB_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void LDRSB_LIT(ARMv7Thread* thr, const ARMv7_encoding type); - void LDRSB_REG(ARMv7Thread* thr, const ARMv7_encoding type); + void LDRSB_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void LDRSB_LIT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void LDRSB_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void LDRSH_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void LDRSH_LIT(ARMv7Thread* thr, const ARMv7_encoding type); - void LDRSH_REG(ARMv7Thread* thr, const ARMv7_encoding type); + void LDRSH_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void LDRSH_LIT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void LDRSH_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void LSL_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void LSL_REG(ARMv7Thread* thr, const ARMv7_encoding type); + void LDREX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void LDREXB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void LDREXD(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void LDREXH(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void LSR_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void LSR_REG(ARMv7Thread* thr, const ARMv7_encoding type); + void LSL_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void LSL_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void MLA(ARMv7Thread* thr, const ARMv7_encoding type); - void MLS(ARMv7Thread* thr, const ARMv7_encoding type); + void LSR_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void LSR_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void MOV_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void MOV_REG(ARMv7Thread* thr, const ARMv7_encoding type); - void MOVT(ARMv7Thread* thr, const ARMv7_encoding type); + void MLA(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void MLS(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void MRS(ARMv7Thread* thr, const ARMv7_encoding type); - void MSR_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void MSR_REG(ARMv7Thread* thr, const ARMv7_encoding type); + void MOV_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void MOV_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void MOVT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void MUL(ARMv7Thread* thr, const ARMv7_encoding type); + void MRS(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void MSR_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void MSR_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void MVN_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void MVN_REG(ARMv7Thread* thr, const ARMv7_encoding type); - void MVN_RSR(ARMv7Thread* thr, const ARMv7_encoding type); + void MUL(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void NOP(ARMv7Thread* thr, const ARMv7_encoding type); + void MVN_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void MVN_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void MVN_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void ORN_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void ORN_REG(ARMv7Thread* thr, const ARMv7_encoding type); + void NOP(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void ORR_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void ORR_REG(ARMv7Thread* thr, const ARMv7_encoding type); - void ORR_RSR(ARMv7Thread* thr, const ARMv7_encoding type); + void ORN_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void ORN_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void PKH(ARMv7Thread* thr, const ARMv7_encoding type); + void ORR_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void ORR_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void ORR_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void POP(ARMv7Thread* thr, const ARMv7_encoding type); - void PUSH(ARMv7Thread* thr, const ARMv7_encoding type); + void PKH(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void QADD(ARMv7Thread* thr, const ARMv7_encoding type); - void QADD16(ARMv7Thread* thr, const ARMv7_encoding type); - void QADD8(ARMv7Thread* thr, const ARMv7_encoding type); - void QASX(ARMv7Thread* thr, const ARMv7_encoding type); - void QDADD(ARMv7Thread* thr, const ARMv7_encoding type); - void QDSUB(ARMv7Thread* thr, const ARMv7_encoding type); - void QSAX(ARMv7Thread* thr, const ARMv7_encoding type); - void QSUB(ARMv7Thread* thr, const ARMv7_encoding type); - void QSUB16(ARMv7Thread* thr, const ARMv7_encoding type); - void QSUB8(ARMv7Thread* thr, const ARMv7_encoding type); + void POP(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void PUSH(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void RBIT(ARMv7Thread* thr, const ARMv7_encoding type); - void REV(ARMv7Thread* thr, const ARMv7_encoding type); - void REV16(ARMv7Thread* thr, const ARMv7_encoding type); - void REVSH(ARMv7Thread* thr, const ARMv7_encoding type); + void QADD(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void QADD16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void QADD8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void QASX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void QDADD(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void QDSUB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void QSAX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void QSUB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void QSUB16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void QSUB8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void ROR_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void ROR_REG(ARMv7Thread* thr, const ARMv7_encoding type); + void RBIT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void REV(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void REV16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void REVSH(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void RRX(ARMv7Thread* thr, const ARMv7_encoding type); + void ROR_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void ROR_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void RSB_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void RSB_REG(ARMv7Thread* thr, const ARMv7_encoding type); - void RSB_RSR(ARMv7Thread* thr, const ARMv7_encoding type); + void RRX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void RSC_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void RSC_REG(ARMv7Thread* thr, const ARMv7_encoding type); - void RSC_RSR(ARMv7Thread* thr, const ARMv7_encoding type); + void RSB_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void RSB_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void RSB_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void SADD16(ARMv7Thread* thr, const ARMv7_encoding type); - void SADD8(ARMv7Thread* thr, const ARMv7_encoding type); - void SASX(ARMv7Thread* thr, const ARMv7_encoding type); + void RSC_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void RSC_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void RSC_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void SBC_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void SBC_REG(ARMv7Thread* thr, const ARMv7_encoding type); - void SBC_RSR(ARMv7Thread* thr, const ARMv7_encoding type); + void SADD16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SADD8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SASX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void SBFX(ARMv7Thread* thr, const ARMv7_encoding type); + void SBC_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SBC_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SBC_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void SDIV(ARMv7Thread* thr, const ARMv7_encoding type); + void SBFX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void SEL(ARMv7Thread* thr, const ARMv7_encoding type); + void SDIV(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void SHADD16(ARMv7Thread* thr, const ARMv7_encoding type); - void SHADD8(ARMv7Thread* thr, const ARMv7_encoding type); - void SHASX(ARMv7Thread* thr, const ARMv7_encoding type); - void SHSAX(ARMv7Thread* thr, const ARMv7_encoding type); - void SHSUB16(ARMv7Thread* thr, const ARMv7_encoding type); - void SHSUB8(ARMv7Thread* thr, const ARMv7_encoding type); + void SEL(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void SMLA__(ARMv7Thread* thr, const ARMv7_encoding type); - void SMLAD(ARMv7Thread* thr, const ARMv7_encoding type); - void SMLAL(ARMv7Thread* thr, const ARMv7_encoding type); - void SMLAL__(ARMv7Thread* thr, const ARMv7_encoding type); - void SMLALD(ARMv7Thread* thr, const ARMv7_encoding type); - void SMLAW_(ARMv7Thread* thr, const ARMv7_encoding type); - void SMLSD(ARMv7Thread* thr, const ARMv7_encoding type); - void SMLSLD(ARMv7Thread* thr, const ARMv7_encoding type); - void SMMLA(ARMv7Thread* thr, const ARMv7_encoding type); - void SMMLS(ARMv7Thread* thr, const ARMv7_encoding type); - void SMMUL(ARMv7Thread* thr, const ARMv7_encoding type); - void SMUAD(ARMv7Thread* thr, const ARMv7_encoding type); - void SMUL__(ARMv7Thread* thr, const ARMv7_encoding type); - void SMULL(ARMv7Thread* thr, const ARMv7_encoding type); - void SMULW_(ARMv7Thread* thr, const ARMv7_encoding type); - void SMUSD(ARMv7Thread* thr, const ARMv7_encoding type); + void SHADD16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SHADD8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SHASX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SHSAX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SHSUB16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SHSUB8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void SSAT(ARMv7Thread* thr, const ARMv7_encoding type); - void SSAT16(ARMv7Thread* thr, const ARMv7_encoding type); - void SSAX(ARMv7Thread* thr, const ARMv7_encoding type); - void SSUB16(ARMv7Thread* thr, const ARMv7_encoding type); - void SSUB8(ARMv7Thread* thr, const ARMv7_encoding type); + void SMLA__(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SMLAD(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SMLAL(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SMLAL__(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SMLALD(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SMLAW_(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SMLSD(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SMLSLD(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SMMLA(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SMMLS(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SMMUL(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SMUAD(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SMUL__(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SMULL(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SMULW_(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SMUSD(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void STM(ARMv7Thread* thr, const ARMv7_encoding type); - void STMDA(ARMv7Thread* thr, const ARMv7_encoding type); - void STMDB(ARMv7Thread* thr, const ARMv7_encoding type); - void STMIB(ARMv7Thread* thr, const ARMv7_encoding type); + void SSAT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SSAT16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SSAX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SSUB16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SSUB8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void STR_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void STR_REG(ARMv7Thread* thr, const ARMv7_encoding type); + void STM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void STMDA(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void STMDB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void STMIB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void STRB_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void STRB_REG(ARMv7Thread* thr, const ARMv7_encoding type); + void STR_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void STR_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void STRD_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void STRD_REG(ARMv7Thread* thr, const ARMv7_encoding type); + void STRB_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void STRB_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void STRH_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void STRH_REG(ARMv7Thread* thr, const ARMv7_encoding type); + void STRD_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void STRD_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void SUB_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void SUB_REG(ARMv7Thread* thr, const ARMv7_encoding type); - void SUB_RSR(ARMv7Thread* thr, const ARMv7_encoding type); - void SUB_SPI(ARMv7Thread* thr, const ARMv7_encoding type); - void SUB_SPR(ARMv7Thread* thr, const ARMv7_encoding type); + void STRH_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void STRH_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void SVC(ARMv7Thread* thr, const ARMv7_encoding type); + void STREX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void STREXB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void STREXD(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void STREXH(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void SXTAB(ARMv7Thread* thr, const ARMv7_encoding type); - void SXTAB16(ARMv7Thread* thr, const ARMv7_encoding type); - void SXTAH(ARMv7Thread* thr, const ARMv7_encoding type); - void SXTB(ARMv7Thread* thr, const ARMv7_encoding type); - void SXTB16(ARMv7Thread* thr, const ARMv7_encoding type); - void SXTH(ARMv7Thread* thr, const ARMv7_encoding type); + void SUB_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SUB_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SUB_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SUB_SPI(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SUB_SPR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void TB_(ARMv7Thread* thr, const ARMv7_encoding type); + void SVC(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void TEQ_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void TEQ_REG(ARMv7Thread* thr, const ARMv7_encoding type); - void TEQ_RSR(ARMv7Thread* thr, const ARMv7_encoding type); + void SXTAB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SXTAB16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SXTAH(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SXTB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SXTB16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void SXTH(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void TST_IMM(ARMv7Thread* thr, const ARMv7_encoding type); - void TST_REG(ARMv7Thread* thr, const ARMv7_encoding type); - void TST_RSR(ARMv7Thread* thr, const ARMv7_encoding type); + void TB_(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); - void UADD16(ARMv7Thread* thr, const ARMv7_encoding type); - void UADD8(ARMv7Thread* thr, const ARMv7_encoding type); - void UASX(ARMv7Thread* thr, const ARMv7_encoding type); - void UBFX(ARMv7Thread* thr, const ARMv7_encoding type); - void UDIV(ARMv7Thread* thr, const ARMv7_encoding type); - void UHADD16(ARMv7Thread* thr, const ARMv7_encoding type); - void UHADD8(ARMv7Thread* thr, const ARMv7_encoding type); - void UHASX(ARMv7Thread* thr, const ARMv7_encoding type); - void UHSAX(ARMv7Thread* thr, const ARMv7_encoding type); - void UHSUB16(ARMv7Thread* thr, const ARMv7_encoding type); - void UHSUB8(ARMv7Thread* thr, const ARMv7_encoding type); - void UMAAL(ARMv7Thread* thr, const ARMv7_encoding type); - void UMLAL(ARMv7Thread* thr, const ARMv7_encoding type); - void UMULL(ARMv7Thread* thr, const ARMv7_encoding type); - void UQADD16(ARMv7Thread* thr, const ARMv7_encoding type); - void UQADD8(ARMv7Thread* thr, const ARMv7_encoding type); - void UQASX(ARMv7Thread* thr, const ARMv7_encoding type); - void UQSAX(ARMv7Thread* thr, const ARMv7_encoding type); - void UQSUB16(ARMv7Thread* thr, const ARMv7_encoding type); - void UQSUB8(ARMv7Thread* thr, const ARMv7_encoding type); - void USAD8(ARMv7Thread* thr, const ARMv7_encoding type); - void USADA8(ARMv7Thread* thr, const ARMv7_encoding type); - void USAT(ARMv7Thread* thr, const ARMv7_encoding type); - void USAT16(ARMv7Thread* thr, const ARMv7_encoding type); - void USAX(ARMv7Thread* thr, const ARMv7_encoding type); - void USUB16(ARMv7Thread* thr, const ARMv7_encoding type); - void USUB8(ARMv7Thread* thr, const ARMv7_encoding type); - void UXTAB(ARMv7Thread* thr, const ARMv7_encoding type); - void UXTAB16(ARMv7Thread* thr, const ARMv7_encoding type); - void UXTAH(ARMv7Thread* thr, const ARMv7_encoding type); - void UXTB(ARMv7Thread* thr, const ARMv7_encoding type); - void UXTB16(ARMv7Thread* thr, const ARMv7_encoding type); - void UXTH(ARMv7Thread* thr, const ARMv7_encoding type); + void TEQ_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void TEQ_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void TEQ_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + + void TST_IMM(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void TST_REG(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void TST_RSR(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + + void UADD16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UADD8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UASX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UBFX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UDIV(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UHADD16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UHADD8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UHASX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UHSAX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UHSUB16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UHSUB8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UMAAL(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UMLAL(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UMULL(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UQADD16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UQADD8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UQASX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UQSAX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UQSUB16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UQSUB8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void USAD8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void USADA8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void USAT(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void USAT16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void USAX(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void USUB16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void USUB8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UXTAB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UXTAB16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UXTAH(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UXTB(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UXTB16(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); + void UXTH(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); }; @@ -371,7 +377,7 @@ struct ARMv7_opcode_t u32 length; // 2 or 4 const char* name; ARMv7_encoding type; - void(*func)(ARMv7Thread* thr, const ARMv7_encoding type); + void(*func)(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); }; // single 16-bit value @@ -548,6 +554,15 @@ static const ARMv7_opcode_t ARMv7_opcode_table[] = ARMv7_OP4(0xfff0, 0x0fc0, 0xf930, 0x0000, T2, LDRSH_REG), ARMv7_OP4(0x0e50, 0x0ff0, 0x0010, 0x00f0, A1, LDRSH_REG), + ARMv7_OP4(0xfff0, 0x0f00, 0xe850, 0x0f00, T1, LDREX), + ARMv7_OP4(0x0ff0, 0x0fff, 0x0190, 0x0f9f, A1, LDREX), + ARMv7_OP4(0xfff0, 0x0fff, 0xe8d0, 0x0f4f, T1, LDREXB), + ARMv7_OP4(0x0ff0, 0x0fff, 0x01d0, 0x0f9f, A1, LDREXB), + ARMv7_OP4(0xfff0, 0x00ff, 0xe8d0, 0x007f, T1, LDREXD), + ARMv7_OP4(0x0ff0, 0x0fff, 0x01b0, 0x0f9f, A1, LDREXD), + ARMv7_OP4(0xfff0, 0x0fff, 0xe8d0, 0x0f5f, T1, LDREXH), + ARMv7_OP4(0x0ff0, 0x0fff, 0x01f0, 0x0f9f, A1, LDREXH), + ARMv7_OP2(0xf800, 0x0000, T1, LSL_IMM), ARMv7_OP4(0xffef, 0x8030, 0xea4f, 0x0000, T2, LSL_IMM), ARMv7_OP4(0x0fef, 0x0070, 0x01a0, 0x0000, A1, LSL_IMM), @@ -626,7 +641,26 @@ static const ARMv7_opcode_t ARMv7_opcode_table[] = ARMv7_OP4(0x0fff, 0x0000, 0x092d, 0x0000, A1, PUSH), ARMv7_OP4(0x0fff, 0x0fff, 0x052d, 0x0004, A2, PUSH), - // TODO (Q*...) + ARMv7_OP4(0xfff0, 0xf0f0, 0xfa80, 0xf080, T1, QADD), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0100, 0x0050, A1, QADD), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfa90, 0xf010, T1, QADD16), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0620, 0x0f10, A1, QADD16), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfa80, 0xf010, T1, QADD8), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0620, 0x0f90, A1, QADD8), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfaa0, 0xf010, T1, QASX), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0620, 0x0f30, A1, QASX), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfa80, 0xf090, T1, QDADD), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0140, 0x0050, A1, QDADD), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfa80, 0xf0b0, T1, QDSUB), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0160, 0x0050, A1, QDSUB), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfae0, 0xf010, T1, QSAX), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0620, 0x0f50, A1, QSAX), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfa80, 0xf0a0, T1, QSUB), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0120, 0x0050, A1, QSUB), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfad0, 0xf010, T1, QSUB16), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0620, 0x0f70, A1, QSUB16), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfac0, 0xf010, T1, QSUB8), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0620, 0x0ff0, A1, QSUB8), ARMv7_OP4(0xfff0, 0xf0f0, 0xfa90, 0xf0a0, T1, RBIT), ARMv7_OP4(0x0fff, 0x0ff0, 0x06ff, 0x0f30, A1, RBIT), @@ -660,7 +694,12 @@ static const ARMv7_opcode_t ARMv7_opcode_table[] = ARMv7_OP4(0x0fe0, 0x0010, 0x00e0, 0x0000, A1, RSC_REG), ARMv7_OP4(0x0fe0, 0x0090, 0x00e0, 0x0010, A1, RSC_RSR), - // TODO (SADD16, SADD8, SASX) + ARMv7_OP4(0xfff0, 0xf0f0, 0xfa90, 0xf000, T1, SADD16), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0610, 0x0f10, A1, SADD16), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfa80, 0xf000, T1, SADD8), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0610, 0x0f90, A1, SADD8), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfaa0, 0xf000, T1, SASX), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0610, 0x0f30, A1, SASX), ARMv7_OP4(0xfbe0, 0x8000, 0xf160, 0x0000, T1, SBC_IMM), ARMv7_OP4(0x0fe0, 0x0000, 0x02c0, 0x0000, A1, SBC_IMM), @@ -677,7 +716,62 @@ static const ARMv7_opcode_t ARMv7_opcode_table[] = ARMv7_OP4(0xfff0, 0xf0f0, 0xfaa0, 0xf080, T1, SEL), ARMv7_OP4(0x0ff0, 0x0ff0, 0x0680, 0x0fb0, A1, SEL), - // TODO (SH*, SM*, SS*) + ARMv7_OP4(0xfff0, 0xf0f0, 0xfa90, 0xf020, T1, SHADD16), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0630, 0x0f10, A1, SHADD16), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfa80, 0xf020, T1, SHADD8), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0630, 0x0f90, A1, SHADD8), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfaa0, 0xf020, T1, SHASX), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0630, 0x0f30, A1, SHASX), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfae0, 0xf020, T1, SHSAX), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0630, 0x0f50, A1, SHSAX), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfad0, 0xf020, T1, SHSUB16), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0630, 0x0f70, A1, SHSUB16), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfac0, 0xf020, T1, SHSUB8), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0630, 0x0ff0, A1, SHSUB8), + + ARMv7_OP4(0xfff0, 0x00c0, 0xfb10, 0x0000, T1, SMLA__), + ARMv7_OP4(0x0ff0, 0x0090, 0x0100, 0x0080, A1, SMLA__), + ARMv7_OP4(0xfff0, 0x00e0, 0xfb20, 0x0000, T1, SMLAD), + ARMv7_OP4(0x0ff0, 0x00d0, 0x0700, 0x0010, A1, SMLAD), + ARMv7_OP4(0xfff0, 0x00f0, 0xfbc0, 0x0000, T1, SMLAL), + ARMv7_OP4(0x0fe0, 0x00f0, 0x00e0, 0x0090, A1, SMLAL),//??? + ARMv7_OP4(0xfff0, 0x00c0, 0xfbc0, 0x0080, T1, SMLAL__), + ARMv7_OP4(0x0ff0, 0x0090, 0x0140, 0x0080, A1, SMLAL__), + ARMv7_OP4(0xfff0, 0x00e0, 0xfbc0, 0x00c0, T1, SMLALD), + ARMv7_OP4(0x0ff0, 0x00d0, 0x0740, 0x0010, A1, SMLALD), + ARMv7_OP4(0xfff0, 0x00e0, 0xfb30, 0x0000, T1, SMLAW_), + ARMv7_OP4(0x0ff0, 0x00b0, 0x0120, 0x0080, A1, SMLAW_), + + ARMv7_OP4(0xfff0, 0x00e0, 0xfb40, 0x0000, T1, SMLSD), + ARMv7_OP4(0x0ff0, 0x00d0, 0x0700, 0x0050, A1, SMLSD), + ARMv7_OP4(0xfff0, 0x00e0, 0xfbd0, 0x00c0, T1, SMLSLD), + ARMv7_OP4(0x0ff0, 0x00d0, 0x0740, 0x0050, A1, SMLSLD), + ARMv7_OP4(0xfff0, 0x00e0, 0xfb50, 0x0000, T1, SMMLA), + ARMv7_OP4(0x0ff0, 0x00d0, 0x0750, 0x0010, A1, SMMLA), + ARMv7_OP4(0xfff0, 0x00e0, 0xfb60, 0x0000, T1, SMMLS), + ARMv7_OP4(0x0ff0, 0x00d0, 0x0750, 0x00d0, A1, SMMLS), + ARMv7_OP4(0xfff0, 0xf0e0, 0xfb50, 0xf000, T1, SMMUL), + ARMv7_OP4(0x0ff0, 0xf0d0, 0x0750, 0xf010, A1, SMMUL), + ARMv7_OP4(0xfff0, 0xf0e0, 0xfb20, 0xf000, T1, SMUAD), + ARMv7_OP4(0x0ff0, 0xf0d0, 0x0700, 0xf010, A1, SMUAD), + ARMv7_OP4(0xfff0, 0xf0c0, 0xfb10, 0xf000, T1, SMUL__), + ARMv7_OP4(0x0ff0, 0xf090, 0x0160, 0x0080, A1, SMUL__),//??? + ARMv7_OP4(0xfff0, 0x00f0, 0xfb80, 0x0000, T1, SMULL), + ARMv7_OP4(0x0fe0, 0x00f0, 0x00c0, 0x0090, A1, SMULL), + ARMv7_OP4(0xfff0, 0xf0e0, 0xfb30, 0xf000, T1, SMULW_), + ARMv7_OP4(0x0ff0, 0xf0b0, 0x0120, 0x00a0, A1, SMULW_),//??? + ARMv7_OP4(0xfff0, 0xf0e0, 0xfb40, 0xf000, T1, SMUSD), + ARMv7_OP4(0x0ff0, 0xf0d0, 0x0700, 0xf050, A1, SMUSD), + ARMv7_OP4(0xffd0, 0x8020, 0xf300, 0x0000, T1, SSAT), + ARMv7_OP4(0x0fe0, 0x0030, 0x06a0, 0x0010, A1, SSAT), + ARMv7_OP4(0xfff0, 0xf0e0, 0xf320, 0x0000, T1, SSAT16), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x06a0, 0x0f30, A1, SSAT16), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfae0, 0xf000, T1, SSAX), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0610, 0x0f50, A1, SSAX), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfad0, 0xf000, T1, SSUB16), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0610, 0x0f70, A1, SSUB16), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfac0, 0xf000, T1, SSUB8), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0610, 0x0ff0, A1, SSUB8), ARMv7_OP2(0xf800, 0xc000, T1, STM), ARMv7_OP4(0xffd0, 0xa000, 0xe880, 0x0000, T2, STM), @@ -716,6 +810,15 @@ static const ARMv7_opcode_t ARMv7_opcode_table[] = ARMv7_OP4(0xfff0, 0x0fc0, 0xf820, 0x0000, T2, STRH_REG), ARMv7_OP4(0x0e50, 0x0ff0, 0x0000, 0x00b0, A1, STRH_REG), + ARMv7_OP4(0xfff0, 0x0000, 0xe840, 0x0000, T1, STREX), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0180, 0x0f90, A1, STREX), + ARMv7_OP4(0xfff0, 0x0ff0, 0xe8c0, 0x0f40, T1, STREXB), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x01c0, 0x0f90, A1, STREXB), + ARMv7_OP4(0xfff0, 0x00f0, 0xe8c0, 0x0070, T1, STREXD), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x01a0, 0x0f90, A1, STREXD), + ARMv7_OP4(0xfff0, 0x0ff0, 0xe8c0, 0x0f50, T1, STREXH), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x01e0, 0x0f90, A1, STREXH), + ARMv7_OP2(0xff80, 0xb080, T1, SUB_SPI), ARMv7_OP4(0xfbef, 0x8000, 0xf1ad, 0x0000, T2, SUB_SPI), ARMv7_OP4(0xfbff, 0x8000, 0xf2ad, 0x0000, T3, SUB_SPI), @@ -735,7 +838,23 @@ static const ARMv7_opcode_t ARMv7_opcode_table[] = ARMv7_OP2(0xff00, 0xdf00, T1, SVC), ARMv7_OP4(0x0f00, 0x0000, 0x0f00, 0x0000, A1, SVC), - // TODO (SX*) + ARMv7_OP4(0xfff0, 0xf0c0, 0xfa40, 0xf080, T1, SXTAB), + ARMv7_OP4(0x0ff0, 0x03f0, 0x06a0, 0x0070, A1, SXTAB), + ARMv7_OP4(0xfff0, 0xf0c0, 0xfa20, 0xf080, T1, SXTAB16), + ARMv7_OP4(0x0ff0, 0x03f0, 0x0680, 0x0070, A1, SXTAB16), + ARMv7_OP4(0xfff0, 0xf0c0, 0xfa00, 0xf080, T1, SXTAH), + ARMv7_OP4(0x0ff0, 0x03f0, 0x06b0, 0x0070, A1, SXTAH), + + ARMv7_OP2(0xffc0, 0xb240, T1, SXTB), + ARMv7_OP4(0xffff, 0xf0c0, 0xfa4f, 0xf080, T2, SXTB), + ARMv7_OP4(0x0fff, 0x03f0, 0x06af, 0x0070, A1, SXTB), + + ARMv7_OP4(0xffff, 0xf0c0, 0xfa2f, 0xf080, T1, SXTB16), + ARMv7_OP4(0x0fff, 0x03f0, 0x068f, 0x0070, A1, SXTB16), + + ARMv7_OP2(0xffc0, 0xb200, T1, SXTH), + ARMv7_OP4(0xffff, 0xf0c0, 0xfa0f, 0xf080, T2, SXTH), + ARMv7_OP4(0x0fff, 0x03f0, 0x06bf, 0x0070, A1, SXTH), ARMv7_OP4(0xfff0, 0xffe0, 0xe8d0, 0xf000, T1, TB_), @@ -750,9 +869,80 @@ static const ARMv7_opcode_t ARMv7_opcode_table[] = ARMv7_OP2(0xffc0, 0x4200, T1, TST_REG), ARMv7_OP4(0xfff0, 0x8f00, 0xea10, 0x0f00, T2, TST_REG), ARMv7_OP4(0x0ff0, 0xf010, 0x0110, 0x0000, A1, TST_REG), - ARMv7_OP4(0x0ff0, 0xf090, 0x0110, 0x0010, A1, TST_RSR) + ARMv7_OP4(0x0ff0, 0xf090, 0x0110, 0x0010, A1, TST_RSR), - // TODO (U*, V*) + ARMv7_OP4(0xfff0, 0xf0f0, 0xfa90, 0xf040, T1, UADD16), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0650, 0x0f10, A1, UADD16), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfa80, 0xf040, T1, UADD8), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0650, 0x0f90, A1, UADD8), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfaa0, 0xf040, T1, UASX), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0650, 0x0f30, A1, UASX), + ARMv7_OP4(0xfff0, 0x8020, 0xf3c0, 0x0000, T1, UBFX), + ARMv7_OP4(0x0fe0, 0x0070, 0x07e0, 0x0050, A1, UBFX), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfbb0, 0xf0f0, T1, UDIV), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfa90, 0xf060, T1, UHADD16), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0670, 0x0f10, A1, UHADD16), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfa80, 0xf060, T1, UHADD8), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0670, 0x0f90, A1, UHADD8), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfaa0, 0xf060, T1, UHASX), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0670, 0x0f30, A1, UHASX), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfae0, 0xf060, T1, UHSAX), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0670, 0x0f50, A1, UHSAX), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfad0, 0xf060, T1, UHSUB16), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0670, 0x0f70, A1, UHSUB16), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfac0, 0xf060, T1, UHSUB8), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0670, 0x0ff0, A1, UHSUB8), + ARMv7_OP4(0xfff0, 0x00f0, 0xfbe0, 0x0060, T1, UMAAL), + ARMv7_OP4(0x0ff0, 0x00f0, 0x0040, 0x0090, A1, UMAAL), + ARMv7_OP4(0xfff0, 0x00f0, 0xfbe0, 0x0000, T1, UMLAL), + ARMv7_OP4(0x0fe0, 0x00f0, 0x00a0, 0x0090, A1, UMLAL), + ARMv7_OP4(0xfff0, 0x00f0, 0xfba0, 0x0000, T1, UMULL), + ARMv7_OP4(0x0fe0, 0x00f0, 0x0080, 0x0090, A1, UMULL), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfa90, 0xf050, T1, UQADD16), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0660, 0x0f10, A1, UQADD16), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfa80, 0xf050, T1, UQADD8), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0660, 0x0f90, A1, UQADD8), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfaa0, 0xf050, T1, UQASX), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0660, 0x0f30, A1, UQASX), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfae0, 0xf050, T1, UQSAX), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0660, 0x0f50, A1, UQSAX), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfad0, 0xf050, T1, UQSUB16), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0660, 0x0f70, A1, UQSUB16), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfac0, 0xf050, T1, UQSUB8), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0660, 0x0ff0, A1, UQSUB8), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfb70, 0xf000, T1, USAD8), + ARMv7_OP4(0x0ff0, 0xf0f0, 0x0780, 0xf010, A1, USAD8), + ARMv7_OP4(0xfff0, 0x00f0, 0xfb70, 0x0000, T1, USADA8), + ARMv7_OP4(0x0ff0, 0x00f0, 0x0780, 0x0010, A1, USADA8), + ARMv7_OP4(0xffd0, 0x8020, 0xf380, 0x0000, T1, USAT), + ARMv7_OP4(0x0fe0, 0x0030, 0x06e0, 0x0010, A1, USAT), + ARMv7_OP4(0xfff0, 0xf0e0, 0xf3a0, 0x0000, T1, USAT16), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x06e0, 0x0f30, A1, USAT16), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfae0, 0xf040, T1, USAX), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0650, 0x0f50, A1, USAX), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfad0, 0xf040, T1, USUB16), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0650, 0x0f70, A1, USUB16), + ARMv7_OP4(0xfff0, 0xf0f0, 0xfac0, 0xf040, T1, USUB8), + ARMv7_OP4(0x0ff0, 0x0ff0, 0x0650, 0x0ff0, A1, USUB8), + ARMv7_OP4(0xfff0, 0xf0c0, 0xfa50, 0xf080, T1, UXTAB), + ARMv7_OP4(0x0ff0, 0x03f0, 0x06e0, 0x0070, A1, UXTAB), + ARMv7_OP4(0xfff0, 0xf0c0, 0xfa30, 0xf080, T1, UXTAB16), + ARMv7_OP4(0x0ff0, 0x03f0, 0x06c0, 0x0070, A1, UXTAB16), + ARMv7_OP4(0xfff0, 0xf0c0, 0xfa10, 0xf080, T1, UXTAH), + ARMv7_OP4(0x0ff0, 0x03f0, 0x06f0, 0x0070, A1, UXTAH), + + ARMv7_OP2(0xffc0, 0xb2c0, T1, UXTB), + ARMv7_OP4(0xffff, 0xf0c0, 0xfa5f, 0xf080, T2, UXTB), + ARMv7_OP4(0x0fff, 0x03f0, 0x06ef, 0x0070, A1, UXTB), + + ARMv7_OP4(0xffff, 0xf0c0, 0xfa3f, 0xf080, T1, UXTB16), + ARMv7_OP4(0x0fff, 0x03f0, 0x06cf, 0x0070, A1, UXTB16), + + ARMv7_OP2(0xffc0, 0xb280, T1, UXTH), + ARMv7_OP4(0xffff, 0xf0c0, 0xfa1f, 0xf080, T2, UXTH), + ARMv7_OP4(0x0fff, 0x03f0, 0x06ff, 0x0070, A1, UXTH), + + // TODO (V*) }; #undef ARMv7_OP2 diff --git a/rpcs3/Emu/ARMv7/ARMv7Opcodes.h b/rpcs3/Emu/ARMv7/ARMv7Opcodes.h index 2d079aa6f9..2a73550111 100644 --- a/rpcs3/Emu/ARMv7/ARMv7Opcodes.h +++ b/rpcs3/Emu/ARMv7/ARMv7Opcodes.h @@ -2,8 +2,8 @@ #include "Emu/ARMv7/ARMv7Thread.h" #include "Emu/ARMv7/ARMv7Interpreter.h" -#include "Emu/System.h" -#include "Utilities/Log.h" +//#include "Emu/System.h" +//#include "Utilities/Log.h" static const char* g_arm_reg_name[16] = { @@ -17,12 +17,13 @@ using namespace ARMv7_instrs; struct ARMv7_Instruction { - void(*func)(ARMv7Thread* thr, const ARMv7_encoding type); + void(*func)(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); u8 size; ARMv7_encoding type; const char* name; }; +#if 0 #define ARMv7_OP_2(func, type) { func, 2, type, #func "_" #type } #define ARMv7_OP_4(func, type) { func, 4, type, #func "_" #type } @@ -30,7 +31,7 @@ struct ARMv7_Instruction // 0x1... -static void group_0x1(ARMv7Thread* thr, const ARMv7_encoding type); +static void group_0x1(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); static const ARMv7_Instruction g_table_0x1_main[] = { @@ -56,7 +57,7 @@ static const ARMv7_Instruction g_table_0x1[] = { group_0x1 } }; -static void group_0x1(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0x1(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code0 & 0x0e00) >> 8; @@ -69,7 +70,7 @@ static void group_0x1(ARMv7Thread* thr, const ARMv7_encoding type) } // 0x2... -static void group_0x2(ARMv7Thread* thr, const ARMv7_encoding type); +static void group_0x2(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); static const ARMv7_Instruction g_table_0x2_main[] = { @@ -89,7 +90,7 @@ static const ARMv7_Instruction g_table_0x2[] = { group_0x2 } }; -static void group_0x2(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0x2(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = (thr->code.code0 & 0x0800) >> 8; thr->m_last_instr_name = g_table_0x2_main[index].name; @@ -99,7 +100,7 @@ static void group_0x2(ARMv7Thread* thr, const ARMv7_encoding type) } // 0x3... -static void group_0x3(ARMv7Thread* thr, const ARMv7_encoding type); +static void group_0x3(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); static const ARMv7_Instruction g_table_0x3_main[] = { @@ -119,7 +120,7 @@ static const ARMv7_Instruction g_table_0x3[] = { group_0x3 } }; -static void group_0x3(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0x3(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = (thr->code.code0 & 0x0800) >> 8; thr->m_last_instr_name = g_table_0x3_main[index].name; @@ -129,13 +130,13 @@ static void group_0x3(ARMv7Thread* thr, const ARMv7_encoding type) } // 0x4... -static void group_0x4(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0x40(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0x41(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0x42(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0x43(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0x44(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0x47(ARMv7Thread* thr, const ARMv7_encoding type); +static void group_0x4(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0x40(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0x41(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0x42(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0x43(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0x44(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0x47(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); static const ARMv7_Instruction g_table_0x4[] = { @@ -160,7 +161,7 @@ static const ARMv7_Instruction g_table_0x40[] = ARMv7_OP_2(LSR_REG, T1) // C 0xffc0 }; -static void group_0x40(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0x40(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = (thr->code.code0 & 0x00c0) >> 4; thr->m_last_instr_name = g_table_0x40[index].name; @@ -186,7 +187,7 @@ static const ARMv7_Instruction g_table_0x41[] = ARMv7_OP_2(ROR_REG, T1) // C 0xffc0 }; -static void group_0x41(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0x41(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = (thr->code.code0 & 0x00c0) >> 4; thr->m_last_instr_name = g_table_0x41[index].name; @@ -211,7 +212,7 @@ static const ARMv7_Instruction g_table_0x42[] = ARMv7_OP_2(CMN_REG, T1) // C 0xffc0 }; -static void group_0x42(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0x42(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = (thr->code.code0 & 0x00c0) >> 4; thr->m_last_instr_name = g_table_0x42[index].name; @@ -237,7 +238,7 @@ static const ARMv7_Instruction g_table_0x43[] = ARMv7_OP_2(MVN_REG, T1) // C 0xffc0 }; -static void group_0x43(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0x43(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = (thr->code.code0 & 0x00c0) >> 4; thr->m_last_instr_name = g_table_0x43[index].name; @@ -258,7 +259,7 @@ static const ARMv7_Instruction g_table_0x44[] = ARMv7_OP_2(ADD_SPR, T2) // 8 0xff87 }; -static void group_0x44(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0x44(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code0 & 0x0080) >> 4; @@ -284,7 +285,7 @@ static const ARMv7_Instruction g_table_0x47[] = ARMv7_OP_2(BLX, T1) // 8 0xff80 }; -static void group_0x47(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0x47(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = (thr->code.code0 & 0x0080) >> 4; thr->m_last_instr_name = g_table_0x47[index].name; @@ -306,7 +307,7 @@ static const ARMv7_Instruction g_table_0x4_main[] = ARMv7_OP_2(LDR_LIT, T1) // 8 0xf800 }; -static void group_0x4(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0x4(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code0 & 0x0f00) >> 8; @@ -319,7 +320,7 @@ static void group_0x4(ARMv7Thread* thr, const ARMv7_encoding type) } // 0x5... -static void group_0x5(ARMv7Thread* thr, const ARMv7_encoding type); +static void group_0x5(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); static const ARMv7_Instruction g_table_0x5_main[] = { @@ -345,7 +346,7 @@ static const ARMv7_Instruction g_table_0x5[] = { group_0x5 } }; -static void group_0x5(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0x5(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = (thr->code.code0 & 0x0e00) >> 8; thr->m_last_instr_name = g_table_0x5_main[index].name; @@ -355,7 +356,7 @@ static void group_0x5(ARMv7Thread* thr, const ARMv7_encoding type) } // 0x6... -static void group_0x6(ARMv7Thread* thr, const ARMv7_encoding type); +static void group_0x6(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); static const ARMv7_Instruction g_table_0x6_main[] = { @@ -375,7 +376,7 @@ static const ARMv7_Instruction g_table_0x6[] = { group_0x6 } }; -static void group_0x6(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0x6(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = (thr->code.code0 & 0x0800) >> 8; thr->m_last_instr_name = g_table_0x6_main[index].name; @@ -385,7 +386,7 @@ static void group_0x6(ARMv7Thread* thr, const ARMv7_encoding type) } // 0x7... -static void group_0x7(ARMv7Thread* thr, const ARMv7_encoding type); +static void group_0x7(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); static const ARMv7_Instruction g_table_0x7_main[] = { @@ -405,7 +406,7 @@ static const ARMv7_Instruction g_table_0x7[] = { group_0x7 } }; -static void group_0x7(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0x7(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = (thr->code.code0 & 0x0800) >> 8; thr->m_last_instr_name = g_table_0x7_main[index].name; @@ -415,7 +416,7 @@ static void group_0x7(ARMv7Thread* thr, const ARMv7_encoding type) } // 0x8... -static void group_0x8(ARMv7Thread* thr, const ARMv7_encoding type); +static void group_0x8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); static const ARMv7_Instruction g_table_0x8_main[] = { @@ -427,7 +428,7 @@ static const ARMv7_Instruction g_table_0x8[] = { group_0x8 } }; -static void group_0x8(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0x8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = (thr->code.code0 & 0x0800) >> 8; thr->m_last_instr_name = g_table_0x8_main[index].name; @@ -437,7 +438,7 @@ static void group_0x8(ARMv7Thread* thr, const ARMv7_encoding type) } // 0x9... -static void group_0x9(ARMv7Thread* thr, const ARMv7_encoding type); +static void group_0x9(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); static const ARMv7_Instruction g_table_0x9_main[] = { @@ -457,7 +458,7 @@ static const ARMv7_Instruction g_table_0x9[] = { group_0x9 } }; -static void group_0x9(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0x9(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = (thr->code.code0 & 0x0800) >> 8; thr->m_last_instr_name = g_table_0x9_main[index].name; @@ -467,7 +468,7 @@ static void group_0x9(ARMv7Thread* thr, const ARMv7_encoding type) } // 0xa... -static void group_0xa(ARMv7Thread* thr, const ARMv7_encoding type); +static void group_0xa(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); static const ARMv7_Instruction g_table_0xa_main[] = { @@ -487,7 +488,7 @@ static const ARMv7_Instruction g_table_0xa[] = { group_0xa } }; -static void group_0xa(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xa(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code0 & 0x0800) >> 8; thr->m_last_instr_name = g_table_0xa_main[index].name; @@ -497,9 +498,9 @@ static void group_0xa(ARMv7Thread* thr, const ARMv7_encoding type) } // 0xb... -static void group_0xb(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xb0(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xba(ARMv7Thread* thr, const ARMv7_encoding type); +static void group_0xb(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xb0(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xba(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); static const ARMv7_Instruction g_table_0xb0[] = { @@ -514,7 +515,7 @@ static const ARMv7_Instruction g_table_0xb0[] = ARMv7_OP_2(SUB_SPI, T1) // 8 0xff80 }; -static void group_0xb0(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xb0(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = (thr->code.code0 & 0x0080) >> 4; thr->m_last_instr_name = g_table_0xb0[index].name; @@ -540,7 +541,7 @@ static const ARMv7_Instruction g_table_0xba[] = ARMv7_OP_2(REVSH, T1) // C 0xffc0 }; -static void group_0xba(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xba(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = (thr->code.code0 & 0x00c0) >> 4; // mask 0xffc0 thr->m_last_instr_name = g_table_0xba[index].name; @@ -575,7 +576,7 @@ static const ARMv7_Instruction g_table_0xb[] = { group_0xb } }; -static void group_0xb(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xb(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code0 & 0x0e00) >> 8; @@ -591,7 +592,7 @@ static void group_0xb(ARMv7Thread* thr, const ARMv7_encoding type) } // 0xc... -static void group_0xc(ARMv7Thread* thr, const ARMv7_encoding type); +static void group_0xc(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); static const ARMv7_Instruction g_table_0xc_main[] = { @@ -611,7 +612,7 @@ static const ARMv7_Instruction g_table_0xc[] = { group_0xc } }; -static void group_0xc(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xc(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = (thr->code.code0 & 0x0800) >> 8; thr->m_last_instr_name = g_table_0xc_main[index].name; @@ -621,7 +622,7 @@ static void group_0xc(ARMv7Thread* thr, const ARMv7_encoding type) } // 0xd... -static void group_0xd(ARMv7Thread* thr, const ARMv7_encoding type); +static void group_0xd(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); static const ARMv7_Instruction g_table_0xd_main[] = { @@ -648,7 +649,7 @@ static const ARMv7_Instruction g_table_0xd[] = { group_0xd } }; -static void group_0xd(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xd(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { //u32 index = (thr->code.code0 & 0x0f00) >> 8; //if ((thr->code.code0 & 0xf000) == 0xd000) index = 0; @@ -661,19 +662,19 @@ static void group_0xd(ARMv7Thread* thr, const ARMv7_encoding type) } // 0xe... -static void group_0xe(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xe85(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xe8(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xe9(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xea(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xea4(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xea4f(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xea4f0000(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xea4f0030(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xea6(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xeb(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xeb0(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xeba(ARMv7Thread* thr, const ARMv7_encoding type); +static void group_0xe(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xe85(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xe8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xe9(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xea(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xea4(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xea4f(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xea4f0000(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xea4f0030(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xea6(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xeb(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xeb0(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xeba(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); static const ARMv7_Instruction g_table_0xe85[] = @@ -696,7 +697,7 @@ static const ARMv7_Instruction g_table_0xe85[] = ARMv7_OP_4(LDRD_LIT, T1) // F 0xfe7f, 0x0000 }; -static void group_0xe85(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xe85(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { //u32 index = thr->code.code0 & 0x000f; //if ((thr->code.code0 & 0xfe50) == 0xe850) index = 0x0; @@ -726,7 +727,7 @@ static const ARMv7_Instruction g_table_0xe8[] = ARMv7_OP_4(TB_, T1) // D 0xfff0, 0xffe0 }; -static void group_0xe8(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xe8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code0 & 0x00f0) >> 4; @@ -747,7 +748,7 @@ static const ARMv7_Instruction g_table_0xe9[] = ARMv7_OP_4(PUSH, T2) // 2 0xffff, 0x0000 }; -static void group_0xe9(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xe9(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code0 & 0x00d0) >> 4; @@ -779,7 +780,7 @@ static const ARMv7_Instruction g_table_0xea4[] = { group_0xea4f } // F }; -static void group_0xea4(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xea4(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = 0x0; if ((thr->code.code0 & 0xffef) == 0xea4f) index = 0xf; // check me @@ -798,7 +799,7 @@ static const ARMv7_Instruction g_table_0xea4f[] = { group_0xea4f0030 } // 3 }; -static void group_0xea4f(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xea4f(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = (thr->code.code1 & 0x0030) >> 4; thr->m_last_instr_name = g_table_0xea4f[index].name; @@ -813,7 +814,7 @@ static const ARMv7_Instruction g_table_0xea4f0000[] = ARMv7_OP_4(LSL_IMM, T2) // 1 0xffef, 0x8030 }; -static void group_0xea4f0000(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xea4f0000(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = thr->code.code1 & 0x8030 ? 0x0 : 0x1; thr->m_last_instr_name = g_table_0xea4f0000[index].name; @@ -828,7 +829,7 @@ static const ARMv7_Instruction g_table_0xea4f0030[] = ARMv7_OP_4(ROR_IMM, T1) // 2 0xffef, 0x8030 }; -static void group_0xea4f0030(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xea4f0030(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = thr->code.code1 & 0x8030 ? 0x0 : 0x1; thr->m_last_instr_name = g_table_0xea4f0030[index].name; @@ -857,7 +858,7 @@ static const ARMv7_Instruction g_table_0xea6[] = ARMv7_OP_4(MVN_REG, T2) // F 0xffef, 0x8000 }; -static void group_0xea6(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xea6(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = thr->code.code0 & 0x000f; @@ -886,7 +887,7 @@ static const ARMv7_Instruction g_table_0xea[] = ARMv7_OP_4(PKH, T1) // C 0xfff0, 0x8010 }; -static void group_0xea(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xea(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code0 & 0x00e0) >> 4; @@ -918,7 +919,7 @@ static const ARMv7_Instruction g_table_0xeb0[] = ARMv7_OP_4(ADD_SPR, T3) // D 0xffef, 0x8000 }; -static void group_0xeb0(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xeb0(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = thr->code.code0 & 0x000f; @@ -948,7 +949,7 @@ static const ARMv7_Instruction g_table_0xeba[] = ARMv7_OP_4(SUB_SPR, T1) // D 0xffef, 0x8000 }; -static void group_0xeba(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xeba(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = thr->code.code0 & 0x000f; @@ -977,7 +978,7 @@ static const ARMv7_Instruction g_table_0xeb[] = ARMv7_OP_4(RSB_REG, T1) // C 0xffe0, 0x8000 }; -static void group_0xeb(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xeb(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code0 & 0x00e0) >> 4; @@ -1015,7 +1016,7 @@ static const ARMv7_Instruction g_table_0xe[] = { group_0xe } }; -static void group_0xe(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xe(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code0 & 0x0f00) >> 8; @@ -1028,36 +1029,36 @@ static void group_0xe(ARMv7Thread* thr, const ARMv7_encoding type) } // 0xf... -static void group_0xf(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf000(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf04(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf06(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf0(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf1(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf1a(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf10(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf20(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf2a(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf2(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf36(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf3(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf810(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf800(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf81(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf820(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf840(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf84(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf850(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf85(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf8(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf910(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf91(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf930(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf93(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xf9(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xfa00(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xfa90(ARMv7Thread* thr, const ARMv7_encoding type); -static void group_0xfa(ARMv7Thread* thr, const ARMv7_encoding type); +static void group_0xf(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf000(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf04(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf06(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf0(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf1(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf1a(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf10(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf20(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf2a(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf2(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf36(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf3(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf810(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf800(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf81(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf820(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf840(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf84(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf850(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf85(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf910(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf91(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf930(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf93(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xf9(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xfa00(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xfa90(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); +static void group_0xfa(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type); static const ARMv7_Instruction g_table_0xf000[] = { @@ -1077,7 +1078,7 @@ static const ARMv7_Instruction g_table_0xf000[] = ARMv7_OP_4(BL, T1) // D 0xf800, 0xd000 }; -static void group_0xf000(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf000(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code1 & 0xd000) >> 12; @@ -1110,7 +1111,7 @@ static const ARMv7_Instruction g_table_0xf04[] = ARMv7_OP_4(MOV_IMM, T2) // F 0xfbef, 0x8000 }; -static void group_0xf04(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf04(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = thr->code.code0 & 0x000f; @@ -1142,7 +1143,7 @@ static const ARMv7_Instruction g_table_0xf06[] = ARMv7_OP_4(MVN_IMM, T1) // F 0xfbef, 0x8000 }; -static void group_0xf06(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf06(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = thr->code.code0 & 0x000f; @@ -1194,7 +1195,7 @@ static const ARMv7_Instruction g_table_0xf0[] = }; -static void group_0xf0(ARMv7Thread* thr, const ARMv7_encoding type) // TODO: optimize this group +static void group_0xf0(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) // TODO: optimize this group { u32 index = 0; if ((thr->m_arg & 0xfbe08000) == 0xf0000000) index = 0x0; @@ -1242,7 +1243,7 @@ static const ARMv7_Instruction g_table_0xf10[] = ARMv7_OP_4(ADD_SPI, T3) // D 0xfbef, 0x8000 }; -static void group_0xf10(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf10(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = thr->code.code0 & 0x000f; @@ -1272,7 +1273,7 @@ static const ARMv7_Instruction g_table_0xf1a[] = ARMv7_OP_4(SUB_SPI, T2) // D 0xfbef, 0x8000 }; -static void group_0xf1a(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf1a(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = thr->code.code0 & 0x000f; @@ -1301,7 +1302,7 @@ static const ARMv7_Instruction g_table_0xf1[] = ARMv7_OP_4(RSB_IMM, T2) // C 0xfbe0, 0x8000 }; -static void group_0xf1(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf1(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code0 & 0x00e0) >> 4; @@ -1334,7 +1335,7 @@ static const ARMv7_Instruction g_table_0xf20[] = ARMv7_OP_4(ADR, T3) // F 0xfbff, 0x8000 }; -static void group_0xf20(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf20(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = thr->code.code0 & 0x000f; @@ -1366,7 +1367,7 @@ static const ARMv7_Instruction g_table_0xf2a[] = ARMv7_OP_4(ADR, T2) // F 0xfbff, 0x8000 }; -static void group_0xf2a(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf2a(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = thr->code.code0 & 0x000f; @@ -1395,7 +1396,7 @@ static const ARMv7_Instruction g_table_0xf2[] = ARMv7_OP_4(MOVT, T1) // C 0xfbf0, 0x8000 }; -static void group_0xf2(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf2(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = (thr->code.code0 & 0x00f0) >> 4; // mask 0xfbf0 thr->m_last_instr_name = g_table_0xf2[index].name; @@ -1424,7 +1425,7 @@ static const ARMv7_Instruction g_table_0xf36[] = ARMv7_OP_4(BFC, T1) // F 0xffff, 0x8020 }; -static void group_0xf36(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf36(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = thr->code.code0 & 0x000f; @@ -1455,7 +1456,7 @@ static const ARMv7_Instruction g_table_0xf3[] = ARMv7_OP_4(MRS, T1), // E 0xffff, 0xf0ff }; -static void group_0xf3(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf3(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = (thr->code.code0 & 0x00f0) >> 4; thr->m_last_instr_name = g_table_0xf3[index].name; @@ -1477,7 +1478,7 @@ static const ARMv7_Instruction g_table_0xf800[] = ARMv7_OP_4(STRB_IMM, T3) // 8 0xfff0, 0x0800 }; -static void group_0xf800(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf800(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code1 & 0x0f00) >> 8; @@ -1502,7 +1503,7 @@ static const ARMv7_Instruction g_table_0xf810[] = ARMv7_OP_4(LDRB_IMM, T3) // 8 0xfff0, 0x0800 }; -static void group_0xf810(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf810(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code1 & 0x0f00) >> 8; @@ -1534,7 +1535,7 @@ static const ARMv7_Instruction g_table_0xf81[] = ARMv7_OP_4(LDRB_LIT, T1) // F 0xff7f, 0x0000 }; -static void group_0xf81(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf81(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = thr->code.code0 & 0x000f; @@ -1559,7 +1560,7 @@ static const ARMv7_Instruction g_table_0xf820[] = ARMv7_OP_4(STRH_IMM, T3) // 8 0xfff0, 0x0800 }; -static void group_0xf820(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf820(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code1 & 0x0f00) >> 8; @@ -1584,7 +1585,7 @@ static const ARMv7_Instruction g_table_0xf840[] = ARMv7_OP_4(STR_IMM, T4) // 8 0xfff0, 0x0800 }; -static void group_0xf840(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf840(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code1 & 0x0f00) >> 8; @@ -1614,7 +1615,7 @@ static const ARMv7_Instruction g_table_0xf84[] = ARMv7_OP_4(PUSH, T3) // D 0xffff, 0x0fff }; -static void group_0xf84(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf84(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = thr->code.code0 & 0x000f; @@ -1639,7 +1640,7 @@ static const ARMv7_Instruction g_table_0xf850[] = ARMv7_OP_4(LDR_IMM, T4) // 8 0xfff0, 0x0800 }; -static void group_0xf850(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf850(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code1 & 0x0f00) >> 8; @@ -1671,7 +1672,7 @@ static const ARMv7_Instruction g_table_0xf85[] = ARMv7_OP_4(LDR_LIT, T2) // F 0xff7f, 0x0000 }; -static void group_0xf85(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf85(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = thr->code.code0 & 0x000f; @@ -1701,7 +1702,7 @@ static const ARMv7_Instruction g_table_0xf8[] = ARMv7_OP_4(LDR_IMM, T3) // D 0xfff0, 0x0000 }; -static void group_0xf8(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf8(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = (thr->code.code0 & 0x00f0) >> 4; thr->m_last_instr_name = g_table_0xf8[index].name; @@ -1723,7 +1724,7 @@ static const ARMv7_Instruction g_table_0xf910[] = ARMv7_OP_4(LDRSB_IMM, T2) // 8 0xfff0, 0x0800 }; -static void group_0xf910(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf910(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code1 & 0x0f00) >> 8; @@ -1755,7 +1756,7 @@ static const ARMv7_Instruction g_table_0xf91[] = ARMv7_OP_4(LDRSB_LIT, T1) // F 0xff7f, 0x0000 }; -static void group_0xf91(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf91(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = thr->code.code0 & 0x000f; @@ -1780,7 +1781,7 @@ static const ARMv7_Instruction g_table_0xf930[] = ARMv7_OP_4(LDRSH_IMM, T2) // 8 0xfff0, 0x0800 }; -static void group_0xf930(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf930(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code1 & 0x0f00) >> 8; @@ -1812,7 +1813,7 @@ static const ARMv7_Instruction g_table_0xf93[] = ARMv7_OP_4(LDRSH_LIT, T1) // F 0xff7f, 0x0000 }; -static void group_0xf93(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf93(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = thr->code.code0 & 0x000f; @@ -1840,7 +1841,7 @@ static const ARMv7_Instruction g_table_0xf9[] = ARMv7_OP_4(LDRSH_IMM, T1), // B 0xfff0, 0x0000 }; -static void group_0xf9(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf9(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code0 & 0x00f0) >> 4; @@ -1873,7 +1874,7 @@ static const ARMv7_Instruction g_table_0xfa00[] = ARMv7_OP_4(LSL_REG, T2) // F 0xffe0, 0xf0f0 }; -static void group_0xfa00(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xfa00(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = (thr->code.code1 & 0xf0f0) == 0xf000 ? 0xf : 0x0; thr->m_last_instr_name = g_table_0xfa00[index].name; @@ -1898,7 +1899,7 @@ static const ARMv7_Instruction g_table_0xfa90[] = ARMv7_OP_4(REVSH, T2) // B 0xfff0, 0xf0f0 }; -static void group_0xfa90(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xfa90(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { const u32 index = (thr->code.code1 & 0x00f0) >> 4; thr->m_last_instr_name = g_table_0xfa90[index].name; @@ -1923,7 +1924,7 @@ static const ARMv7_Instruction g_table_0xfa[] = ARMv7_OP_4(CLZ, T1) // B 0xfff0, 0xf0f0 }; -static void group_0xfa(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xfa(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code0 & 0x00e0) >> 4; @@ -1958,7 +1959,7 @@ static const ARMv7_Instruction g_table_0xf_main[] = }; -static void group_0xf(ARMv7Thread* thr, const ARMv7_encoding type) +static void group_0xf(ARMv7Context& context, const ARMv7Code code, const ARMv7_encoding type) { u32 index = (thr->code.code0 & 0x0b00) >> 8; @@ -2023,3 +2024,4 @@ static void execute_main_group(ARMv7Thread* thr) #undef ARMv7_OP_2 #undef ARMv7_OP_4 #undef ARMv7_NULL_OP +#endif diff --git a/rpcs3/Emu/ARMv7/ARMv7Thread.cpp b/rpcs3/Emu/ARMv7/ARMv7Thread.cpp index c8a9e7c4b5..c9e04f786b 100644 --- a/rpcs3/Emu/ARMv7/ARMv7Thread.cpp +++ b/rpcs3/Emu/ARMv7/ARMv7Thread.cpp @@ -10,22 +10,38 @@ #include "ARMv7DisAsm.h" #include "ARMv7Interpreter.h" +void ARMv7Context::write_pc(u32 value) +{ + thread.SetBranch(value); +} + +u32 ARMv7Context::read_pc() +{ + return thread.PC; +} + +u32 ARMv7Context::get_stack_arg(u32 pos) +{ + return vm::psv::read32(SP + sizeof(u32) * (pos - 5)); +} + ARMv7Thread::ARMv7Thread() : CPUThread(CPU_THREAD_ARMv7) - , m_arg(0) - , m_last_instr_size(0) - , m_last_instr_name("UNK") + , context(*this) + //, m_arg(0) + //, m_last_instr_size(0) + //, m_last_instr_name("UNK") { } void ARMv7Thread::InitRegs() { - memset(GPR, 0, sizeof(GPR[0]) * 15); - APSR.APSR = 0; - IPSR.IPSR = 0; - ISET = Thumb; - ITSTATE.IT = 0; - SP = m_stack_addr + m_stack_size; + memset(context.GPR, 0, sizeof(context.GPR[0]) * 15); + context.APSR.APSR = 0; + context.IPSR.IPSR = 0; + context.ISET = Thumb; + context.ITSTATE.IT = 0; + context.SP = m_stack_addr + m_stack_size; } void ARMv7Thread::InitStack() @@ -37,26 +53,21 @@ void ARMv7Thread::InitStack() } } -u32 ARMv7Thread::GetStackArg(u32 pos) -{ - return vm::psv::read32(SP + sizeof(u32) * (pos - 5)); -} - std::string ARMv7Thread::RegsToString() { std::string result = "Registers:\n=========\n"; for(int i=0; i<15; ++i) { - result += fmt::Format("%s\t= 0x%08x\n", g_arm_reg_name[i], GPR[i]); + result += fmt::Format("%s\t= 0x%08x\n", g_arm_reg_name[i], context.GPR[i]); } result += fmt::Format("APSR\t= 0x%08x [N: %d, Z: %d, C: %d, V: %d, Q: %d]\n", - APSR.APSR, - fmt::by_value(APSR.N), - fmt::by_value(APSR.Z), - fmt::by_value(APSR.C), - fmt::by_value(APSR.V), - fmt::by_value(APSR.Q)); + context.APSR.APSR, + fmt::by_value(context.APSR.N), + fmt::by_value(context.APSR.Z), + fmt::by_value(context.APSR.C), + fmt::by_value(context.APSR.V), + fmt::by_value(context.APSR.Q)); return result; } @@ -110,21 +121,21 @@ void ARMv7Thread::FastCall(u32 addr) { auto old_status = m_status; auto old_PC = PC; - auto old_stack = SP; - auto old_LR = LR; + auto old_stack = context.SP; + auto old_LR = context.LR; auto old_thread = GetCurrentNamedThread(); m_status = Running; PC = addr; - LR = Emu.GetCPUThreadStop(); + context.LR = Emu.GetCPUThreadStop(); SetCurrentNamedThread(this); CPUThread::Task(); m_status = old_status; PC = old_PC; - SP = old_stack; - LR = old_LR; + context.SP = old_stack; + context.LR = old_LR; SetCurrentNamedThread(old_thread); } diff --git a/rpcs3/Emu/ARMv7/ARMv7Thread.h b/rpcs3/Emu/ARMv7/ARMv7Thread.h index 22e655188d..2dd26772e7 100644 --- a/rpcs3/Emu/ARMv7/ARMv7Thread.h +++ b/rpcs3/Emu/ARMv7/ARMv7Thread.h @@ -1,147 +1,24 @@ #pragma once #include "Emu/CPU/CPUThread.h" #include "Emu/Memory/Memory.h" - -enum ARMv7InstructionSet -{ - ARM, - Thumb, - Jazelle, - ThumbEE -}; +#include "ARMv7Context.h" class ARMv7Thread : public CPUThread { public: - u32 m_arg; - u8 m_last_instr_size; - const char* m_last_instr_name; + ARMv7Context context; + //u32 m_arg; + //u8 m_last_instr_size; + //const char* m_last_instr_name; ARMv7Thread(); - union - { - u32 GPR[15]; - - struct - { - u32 pad[13]; - - union - { - u32 SP; - - struct { u16 SP_main, SP_process; }; - }; - - u32 LR; - }; - }; - - union - { - struct - { - u32 N : 1; //Negative condition code flag - u32 Z : 1; //Zero condition code flag - u32 C : 1; //Carry condition code flag - u32 V : 1; //Overflow condition code flag - u32 Q : 1; //Set to 1 if an SSAT or USAT instruction changes (saturates) the input value for the signed or unsigned range of the result - u32 : 27; - }; - - u32 APSR; - - } APSR; - - union - { - struct - { - u32 : 24; - u32 exception : 8; - }; - - u32 IPSR; - - } IPSR; - - union - { - struct - { - u32 code1 : 16; - u32 code0 : 16; - }; - - u32 data; - - } code; - - ARMv7InstructionSet ISET; - - union - { - struct - { - u8 cond : 3; - u8 state : 5; - }; - - u8 IT; - - u32 advance() - { - const u32 res = (state & 0xf) ? (cond << 1 | state >> 4) : 0xe /* true */; - - state <<= 1; - if ((state & 0xf) == 0) // if no d - { - IT = 0; // clear ITSTATE - } - - return res; - } - - operator bool() const - { - return (state & 0xf) != 0; - } - - } ITSTATE; - - void write_gpr(u32 n, u32 value) - { - assert(n < 16); - - if(n < 15) - { - GPR[n] = value; - } - else - { - SetBranch(value & ~1); - } - } - - u32 read_gpr(u32 n) - { - assert(n < 16); - - if(n < 15) - { - return GPR[n]; - } - - return PC; - } - - void update_code(const u32 address) - { - code.code0 = vm::psv::read16(address & ~1); - code.code1 = vm::psv::read16(address + 2 & ~1); - m_arg = address & 0x1 ? code.code1 << 16 | code.code0 : code.data; - } + //void update_code(const u32 address) + //{ + // code.code0 = vm::psv::read16(address & ~1); + // code.code1 = vm::psv::read16(address + 2 & ~1); + // m_arg = address & 0x1 ? code.code1 << 16 | code.code0 : code.data; + //} public: virtual void InitRegs(); @@ -209,131 +86,3 @@ public: return *this; } }; - -template::value> -struct cast_armv7_gpr -{ - static_assert(is_enum, "Invalid type for cast_armv7_gpr"); - - typedef typename std::underlying_type::type underlying_type; - - __forceinline static u32 to_gpr(const T& value) - { - return cast_armv7_gpr::to_gpr(static_cast(value)); - } - - __forceinline static T from_gpr(const u32 reg) - { - return static_cast(cast_armv7_gpr::from_gpr(reg)); - } -}; - -template<> -struct cast_armv7_gpr -{ - __forceinline static u32 to_gpr(const u8& value) - { - return value; - } - - __forceinline static u8 from_gpr(const u32 reg) - { - return static_cast(reg); - } -}; - -template<> -struct cast_armv7_gpr -{ - __forceinline static u32 to_gpr(const u16& value) - { - return value; - } - - __forceinline static u16 from_gpr(const u32 reg) - { - return static_cast(reg); - } -}; - -template<> -struct cast_armv7_gpr -{ - __forceinline static u32 to_gpr(const u32& value) - { - return value; - } - - __forceinline static u32 from_gpr(const u32 reg) - { - return reg; - } -}; - -template<> -struct cast_armv7_gpr -{ - __forceinline static u32 to_gpr(const s8& value) - { - return value; - } - - __forceinline static s8 from_gpr(const u32 reg) - { - return static_cast(reg); - } -}; - -template<> -struct cast_armv7_gpr -{ - __forceinline static u32 to_gpr(const s16& value) - { - return value; - } - - __forceinline static s16 from_gpr(const u32 reg) - { - return static_cast(reg); - } -}; - -template<> -struct cast_armv7_gpr -{ - __forceinline static u32 to_gpr(const s32& value) - { - return value; - } - - __forceinline static s32 from_gpr(const u32 reg) - { - return static_cast(reg); - } -}; - -template<> -struct cast_armv7_gpr -{ - __forceinline static u32 to_gpr(const bool& value) - { - return value; - } - - __forceinline static bool from_gpr(const u32 reg) - { - return reinterpret_cast(reg); - } -}; - -template -__forceinline u32 cast_to_armv7_gpr(const T& value) -{ - return cast_armv7_gpr::to_gpr(value); -} - -template -__forceinline T cast_from_armv7_gpr(const u32 reg) -{ - return cast_armv7_gpr::from_gpr(reg); -} diff --git a/rpcs3/Emu/ARMv7/Modules/sceLibKernel.cpp b/rpcs3/Emu/ARMv7/Modules/sceLibKernel.cpp index 7ae9f6a2a6..b07f39f522 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceLibKernel.cpp +++ b/rpcs3/Emu/ARMv7/Modules/sceLibKernel.cpp @@ -1,9 +1,10 @@ #include "stdafx.h" #include "Emu/System.h" #include "Emu/Memory/Memory.h" +#include "Emu/ARMv7/PSVFuncList.h" + #include "Emu/CPU/CPUThreadManager.h" #include "Emu/ARMv7/ARMv7Thread.h" -#include "Emu/ARMv7/PSVFuncList.h" extern psv_log_base sceLibKernel; @@ -129,23 +130,23 @@ s32 sceKernelStartThread(s32 threadId, u32 argSize, vm::psv::ptr pAr ARMv7Thread& thread = static_cast(*t); // push arg block onto the stack - const u32 pos = (thread.SP -= argSize); + const u32 pos = (thread.context.SP -= argSize); memcpy(vm::get_ptr(pos), pArgBlock.get_ptr(), argSize); // set SceKernelThreadEntry function arguments - thread.write_gpr(0, argSize); - thread.write_gpr(1, pos); + thread.context.write_gpr(0, argSize); + thread.context.write_gpr(1, pos); thread.Exec(); return SCE_OK; } -s32 sceKernelExitThread(ARMv7Thread& CPU, s32 exitStatus) +s32 sceKernelExitThread(ARMv7Context& context, s32 exitStatus) { sceLibKernel.Error("sceKernelExitThread(exitStatus=0x%x)", exitStatus); // exit status is stored in r0 - CPU.Stop(); + context.thread.Stop(); return SCE_OK; } diff --git a/rpcs3/Emu/ARMv7/PSVFuncList.cpp b/rpcs3/Emu/ARMv7/PSVFuncList.cpp index 84262b3b0f..a40457aef3 100644 --- a/rpcs3/Emu/ARMv7/PSVFuncList.cpp +++ b/rpcs3/Emu/ARMv7/PSVFuncList.cpp @@ -2,6 +2,7 @@ #include #include "Utilities/Log.h" #include "Emu/System.h" +#include "ARMv7Thread.h" #include "PSVFuncList.h" std::vector g_psv_func_list; @@ -14,13 +15,20 @@ void add_psv_func(psv_func& data) psv_func unimplemented; unimplemented.nid = 0; unimplemented.name = "Special function (unimplemented stub)"; - unimplemented.func.reset(new psv_func_detail::func_binder([](ARMv7Thread& CPU){ CPU.m_last_syscall = vm::psv::read32(CPU.PC + 4); throw "Unimplemented function executed"; })); + unimplemented.func.reset(new psv_func_detail::func_binder([](ARMv7Context& context) + { + context.thread.m_last_syscall = vm::psv::read32(context.thread.PC + 4); + throw "Unimplemented function executed"; + })); g_psv_func_list.push_back(unimplemented); psv_func hle_return; hle_return.nid = 1; hle_return.name = "Special function (return from HLE)"; - hle_return.func.reset(new psv_func_detail::func_binder([](ARMv7Thread& CPU){ CPU.FastStop(); })); + hle_return.func.reset(new psv_func_detail::func_binder([](ARMv7Context& context) + { + context.thread.FastStop(); + })); g_psv_func_list.push_back(hle_return); } @@ -49,16 +57,16 @@ u32 get_psv_func_index(psv_func* func) return (u32)res; } -void execute_psv_func_by_index(ARMv7Thread& CPU, u32 index) +void execute_psv_func_by_index(ARMv7Context& context, u32 index) { assert(index < g_psv_func_list.size()); - auto old_last_syscall = CPU.m_last_syscall; - CPU.m_last_syscall = g_psv_func_list[index].nid; + auto old_last_syscall = context.thread.m_last_syscall; + context.thread.m_last_syscall = g_psv_func_list[index].nid; - (*g_psv_func_list[index].func)(CPU); + (*g_psv_func_list[index].func)(context); - CPU.m_last_syscall = old_last_syscall; + context.thread.m_last_syscall = old_last_syscall; } extern psv_log_base sceLibc; diff --git a/rpcs3/Emu/ARMv7/PSVFuncList.h b/rpcs3/Emu/ARMv7/PSVFuncList.h index 9fe75a647a..c6959a1bd5 100644 --- a/rpcs3/Emu/ARMv7/PSVFuncList.h +++ b/rpcs3/Emu/ARMv7/PSVFuncList.h @@ -1,5 +1,5 @@ #pragma once -#include "ARMv7Thread.h" +#include "ARMv7Context.h" #include "Emu/SysCalls/LogBase.h" class psv_log_base : public LogBase @@ -401,7 +401,7 @@ enum psv_error_codes class psv_func_caller { public: - virtual void operator()(ARMv7Thread& CPU) = 0; + virtual void operator()(ARMv7Context& CPU) = 0; virtual ~psv_func_caller(){}; }; @@ -423,9 +423,9 @@ namespace psv_func_detail { static_assert(sizeof(T) <= 4, "Invalid function argument type for ARG_GENERAL"); - static __forceinline T func(ARMv7Thread& CPU) + static __forceinline T func(ARMv7Context& context) { - return cast_from_armv7_gpr(CPU.GPR[g_count - 1]); + return cast_from_armv7_gpr(context.GPR[g_count - 1]); } }; @@ -435,7 +435,7 @@ namespace psv_func_detail static_assert(f_count <= 0, "TODO: Unsupported argument type (float)"); static_assert(sizeof(T) <= 8, "Invalid function argument type for ARG_FLOAT"); - static __forceinline T func(ARMv7Thread& CPU) + static __forceinline T func(ARMv7Context& context) { } }; @@ -446,7 +446,7 @@ namespace psv_func_detail static_assert(v_count <= 0, "TODO: Unsupported argument type (vector)"); static_assert(std::is_same::value, "Invalid function argument type for ARG_VECTOR"); - static __forceinline T func(ARMv7Thread& CPU) + static __forceinline T func(ARMv7Context& context) { } }; @@ -458,10 +458,10 @@ namespace psv_func_detail static_assert(v_count <= 0, "TODO: Unsupported stack argument type (vector)"); static_assert(sizeof(T) <= 4, "Invalid function argument type for ARG_STACK"); - static __forceinline T func(ARMv7Thread& CPU) + static __forceinline T func(ARMv7Context& context) { // TODO: check - const u32 res = CPU.GetStackArg(g_count); + const u32 res = context.get_stack_arg(g_count); return cast_from_armv7_gpr(res); } }; @@ -474,9 +474,9 @@ namespace psv_func_detail static_assert(type == ARG_GENERAL, "Wrong use of bind_result template"); static_assert(sizeof(T) <= 4, "Invalid function result type for ARG_GENERAL"); - static __forceinline void func(ARMv7Thread& CPU, const T& result) + static __forceinline void func(ARMv7Context& context, const T& result) { - CPU.GPR[0] = cast_to_armv7_gpr(result); + context.GPR[0] = cast_to_armv7_gpr(result); } }; @@ -485,7 +485,7 @@ namespace psv_func_detail //{ // static_assert(sizeof(T) <= 8, "Invalid function result type for ARG_FLOAT"); - // static __forceinline void func(ARMv7Thread& CPU, const T& result) + // static __forceinline void func(ARMv7Context& context, const T& result) // { // } //}; @@ -495,7 +495,7 @@ namespace psv_func_detail //{ // static_assert(std::is_same::value, "Invalid function result type for ARG_VECTOR"); - // static __forceinline void func(ARMv7Thread& CPU, const T& result) + // static __forceinline void func(ARMv7Context& context, const T& result) // { // } //}; @@ -526,14 +526,14 @@ namespace psv_func_detail } template - __forceinline std::tuple<> iterate(ARMv7Thread& CPU) + __forceinline std::tuple<> iterate(ARMv7Context& context) { // terminator return std::tuple<>(); } template - __forceinline std::tuple iterate(ARMv7Thread& CPU) + __forceinline std::tuple iterate(ARMv7Context& context) { static_assert(!std::is_pointer::value, "Invalid function argument type (pointer)"); static_assert(!std::is_reference::value, "Invalid function argument type (reference)"); @@ -547,7 +547,7 @@ namespace psv_func_detail const int f = f_count + (is_float ? 1 : 0); const int v = v_count + (is_vector ? 1 : 0); - return std::tuple_cat(std::tuple(bind_arg::func(CPU)), iterate(CPU)); + return std::tuple_cat(std::tuple(bind_arg::func(context)), iterate(context)); } template @@ -576,16 +576,16 @@ namespace psv_func_detail { } - virtual void operator()(ARMv7Thread& CPU) + virtual void operator()(ARMv7Context& context) { - call(m_call, iterate<0, 0, 0, T...>(CPU)); + call(m_call, iterate<0, 0, 0, T...>(context)); } }; template - class func_binder : public psv_func_caller + class func_binder : public psv_func_caller { - typedef void(*func_t)(ARMv7Thread&, T...); + typedef void(*func_t)(ARMv7Context&, T...); const func_t m_call; public: @@ -595,9 +595,9 @@ namespace psv_func_detail { } - virtual void operator()(ARMv7Thread& CPU) + virtual void operator()(ARMv7Context& context) { - call(m_call, std::tuple_cat(std::tuple(CPU), iterate<0, 0, 0, T...>(CPU))); + call(m_call, std::tuple_cat(std::tuple(context), iterate<0, 0, 0, T...>(context))); } }; @@ -614,16 +614,16 @@ namespace psv_func_detail { } - virtual void operator()(ARMv7Thread& CPU) + virtual void operator()(ARMv7Context& context) { - bind_result::value>::func(CPU, call(m_call, iterate<0, 0, 0, T...>(CPU))); + bind_result::value>::func(context, call(m_call, iterate<0, 0, 0, T...>(context))); } }; template - class func_binder : public psv_func_caller + class func_binder : public psv_func_caller { - typedef RT(*func_t)(ARMv7Thread&, T...); + typedef RT(*func_t)(ARMv7Context&, T...); const func_t m_call; public: @@ -633,9 +633,9 @@ namespace psv_func_detail { } - virtual void operator()(ARMv7Thread& CPU) + virtual void operator()(ARMv7Context& context) { - bind_result::value>::func(CPU, call(m_call, std::tuple_cat(std::tuple(CPU), iterate<0, 0, 0, T...>(CPU)))); + bind_result::value>::func(context, call(m_call, std::tuple_cat(std::tuple(context), iterate<0, 0, 0, T...>(context)))); } }; } @@ -665,5 +665,5 @@ void reg_psv_func(u32 nid, psv_log_base* module, const char* name, RT(*func)(T.. psv_func* get_psv_func_by_nid(u32 nid); u32 get_psv_func_index(psv_func* func); -void execute_psv_func_by_index(ARMv7Thread& CPU, u32 index); +void execute_psv_func_by_index(ARMv7Context& context, u32 index); void list_known_psv_modules(); diff --git a/rpcs3/Emu/Memory/vm.h b/rpcs3/Emu/Memory/vm.h index 9068888ead..38735da8ba 100644 --- a/rpcs3/Emu/Memory/vm.h +++ b/rpcs3/Emu/Memory/vm.h @@ -70,7 +70,7 @@ namespace vm const u32 res = static_cast(addr); if (res != addr) { - throw fmt::Format("%s(): invalid address 0x%llx", func, addr); + throw fmt::format("%s(): invalid address 0x%llx", func, addr); } return res; diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index a925170fbe..001fcfc477 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -266,6 +266,7 @@ + diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters index 1ef837c8fd..681270e3d6 100644 --- a/rpcs3/emucore.vcxproj.filters +++ b/rpcs3/emucore.vcxproj.filters @@ -1282,5 +1282,8 @@ Emu\SysCalls\Modules + + Emu\CPU\ARMv7 + \ No newline at end of file