Implement Thumb ADR instruction
This commit is contained in:
parent
24aa24b1bc
commit
28a201da16
4 changed files with 18 additions and 4 deletions
|
@ -56,7 +56,7 @@ private:
|
|||
};
|
||||
|
||||
template <typename V>
|
||||
const std::array<Thumb16Matcher<V>, 43> g_thumb16_instruction_table = {
|
||||
const std::array<Thumb16Matcher<V>, 44> g_thumb16_instruction_table = {
|
||||
|
||||
#define INST(fn, name, bitstring) detail::detail<Thumb16Matcher, u16, 16>::GetMatcher<decltype(fn), fn>(name, bitstring)
|
||||
|
||||
|
@ -113,7 +113,7 @@ const std::array<Thumb16Matcher<V>, 43> g_thumb16_instruction_table = {
|
|||
//INST(&V::thumb16_LDR_sp, "LDR (SP)", "10011dddvvvvvvvv"),
|
||||
|
||||
// Generate relative address instruction
|
||||
//INST(&V::thumb16_ADR, "ADR", "10100dddvvvvvvvv"),
|
||||
INST(&V::thumb16_ADR, "ADR", "10100dddvvvvvvvv"),
|
||||
//INST(&V::thumb16_ADD_sp, "ADD (relative to SP)", "10101dddvvvvvvvv"),
|
||||
|
||||
// Miscellaneous 16-bit instructions
|
||||
|
|
|
@ -244,6 +244,11 @@ public:
|
|||
return Common::StringFromFormat("ldr %s, [%s, #%u]", RegStr(t), RegStr(n), imm32);
|
||||
}
|
||||
|
||||
std::string thumb16_ADR(Reg d, Imm8 imm8) {
|
||||
u32 imm32 = imm8 << 2;
|
||||
return Common::StringFromFormat("adr %s, +#%u", RegStr(d), imm32);
|
||||
}
|
||||
|
||||
std::string thumb16_SXTH(Reg m, Reg d) {
|
||||
return Common::StringFromFormat("sxth %s, %s", RegStr(d), RegStr(m));
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "frontend/decoder/arm.h"
|
||||
#include "frontend/ir/ir.h"
|
||||
#include "frontend/ir/ir_emitter.h"
|
||||
#include "translate.h"
|
||||
#include "frontend/translate/translate.h"
|
||||
|
||||
namespace Dynarmic {
|
||||
namespace Arm {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "frontend/arm_types.h"
|
||||
#include "frontend/decoder/thumb16.h"
|
||||
#include "frontend/ir/ir_emitter.h"
|
||||
#include "translate.h"
|
||||
#include "frontend/translate/translate.h"
|
||||
|
||||
namespace Dynarmic {
|
||||
namespace Arm {
|
||||
|
@ -440,6 +440,15 @@ struct ThumbTranslatorVisitor final {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool thumb16_ADR(Reg d, Imm8 imm8) {
|
||||
u32 imm32 = imm8 << 2;
|
||||
// ADR <Rd>, <label>
|
||||
// Rd cannot encode R15.
|
||||
auto result = ir.Imm32(ir.AlignPC(4) + imm32);
|
||||
ir.SetRegister(d, result);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool thumb16_SXTH(Reg m, Reg d) {
|
||||
// SXTH <Rd>, <Rm>
|
||||
// Rd cannot encode R15.
|
||||
|
|
Loading…
Reference in a new issue