mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-03-09 21:12:57 +00:00
A32/translate_thumb: Split off implementation into thumb16 and thumb32
This commit is contained in:
43
src/frontend/A32/translate/impl/thumb32.cpp
Normal file
43
src/frontend/A32/translate/impl/thumb32.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
/* This file is part of the dynarmic project.
|
||||
* Copyright (c) 2016 MerryMage
|
||||
* This software may be used and distributed according to the terms of the GNU
|
||||
* General Public License version 2 or any later version.
|
||||
*/
|
||||
|
||||
#include "translate_thumb.h"
|
||||
|
||||
namespace Dynarmic::A32 {
|
||||
|
||||
// BL <label>
|
||||
bool ThumbTranslatorVisitor::thumb32_BL_imm(Imm<11> hi, Imm<11> lo) {
|
||||
ir.PushRSB(ir.current_location.AdvancePC(4));
|
||||
ir.SetRegister(Reg::LR, ir.Imm32((ir.current_location.PC() + 4) | 1));
|
||||
|
||||
const s32 imm32 = static_cast<s32>((concatenate(hi, lo).SignExtend<u32>() << 1) + 4);
|
||||
const auto new_location = ir.current_location.AdvancePC(imm32);
|
||||
ir.SetTerm(IR::Term::LinkBlock{new_location});
|
||||
return false;
|
||||
}
|
||||
|
||||
// BLX <label>
|
||||
bool ThumbTranslatorVisitor::thumb32_BLX_imm(Imm<11> hi, Imm<11> lo) {
|
||||
if (lo.Bit<0>()) {
|
||||
return UnpredictableInstruction();
|
||||
}
|
||||
|
||||
ir.PushRSB(ir.current_location.AdvancePC(4));
|
||||
ir.SetRegister(Reg::LR, ir.Imm32((ir.current_location.PC() + 4) | 1));
|
||||
|
||||
const s32 imm32 = static_cast<s32>(concatenate(hi, lo).SignExtend<u32>() << 1);
|
||||
const auto new_location = ir.current_location
|
||||
.SetPC(ir.AlignPC(4) + imm32)
|
||||
.SetTFlag(false);
|
||||
ir.SetTerm(IR::Term::LinkBlock{new_location});
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ThumbTranslatorVisitor::thumb32_UDF() {
|
||||
return thumb16_UDF();
|
||||
}
|
||||
|
||||
} // namespace Dynarmic::A32
|
||||
Reference in New Issue
Block a user