thumb32: Implement PLD variants

This commit is contained in:
Lioncash 2021-03-06 09:30:46 -05:00
parent ee99fa69e9
commit b2802aaf17
4 changed files with 50 additions and 4 deletions

View file

@ -160,6 +160,9 @@ if ("A32" IN_LIST DYNARMIC_FRONTENDS)
frontend/A32/translate/impl/thumb32_data_processing_register.cpp
frontend/A32/translate/impl/thumb32_data_processing_modified_immediate.cpp
frontend/A32/translate/impl/thumb32_data_processing_plain_binary_immediate.cpp
frontend/A32/translate/impl/thumb32_load_byte.cpp
frontend/A32/translate/impl/thumb32_load_halfword.cpp
frontend/A32/translate/impl/thumb32_load_word.cpp
frontend/A32/translate/impl/thumb32_long_multiply.cpp
frontend/A32/translate/impl/thumb32_misc.cpp
frontend/A32/translate/impl/thumb32_multiply.cpp

View file

@ -145,10 +145,10 @@ INST(thumb32_STRH, "STRH (reg)", "111110000010nnnntttt00
INST(thumb32_STR_reg, "STR (reg)", "111110000100nnnntttt000000iimmmm")
// Load Byte and Memory Hints
//INST(thumb32_PLD_lit, "PLD (lit)", "11111000-00111111111------------")
//INST(thumb32_PLD_reg, "PLD (reg)", "111110000001----1111000000------")
//INST(thumb32_PLD_imm8, "PLD (imm8)", "1111100000-1----11111100--------")
//INST(thumb32_PLD_imm12, "PLD (imm12)", "111110001001----1111------------")
INST(thumb32_PLD_lit, "PLD (lit)", "11111000U00111111111iiiiiiiiiiii")
INST(thumb32_PLD_reg, "PLD (reg)", "1111100000W1nnnn1111000000iimmmm")
INST(thumb32_PLD_imm8, "PLD (imm8)", "1111100000W1nnnn11111100iiiiiiii")
INST(thumb32_PLD_imm12, "PLD (imm12)", "1111100010W1nnnn1111iiiiiiiiiiii")
//INST(thumb32_PLI_lit, "PLI (lit)", "11111001-00111111111------------")
//INST(thumb32_PLI_reg, "PLI (reg)", "111110010001----1111000000------")
//INST(thumb32_PLI_imm8, "PLI (imm8)", "111110010001----11111100--------")

View file

@ -3,9 +3,46 @@
* SPDX-License-Identifier: 0BSD
*/
#include <dynarmic/A32/config.h>
#include "frontend/A32/translate/impl/translate_thumb.h"
namespace Dynarmic::A32 {
static bool PLDHandler(ThumbTranslatorVisitor& v, bool W) {
if (!v.options.hook_hint_instructions) {
return true;
}
const auto exception = W ? Exception::PreloadDataWithIntentToWrite
: Exception::PreloadData;
return v.RaiseException(exception);
}
bool ThumbTranslatorVisitor::thumb32_PLD_lit([[maybe_unused]] bool U,
[[maybe_unused]] Imm<12> imm12) {
return PLDHandler(*this, false);
}
bool ThumbTranslatorVisitor::thumb32_PLD_imm8(bool W,
[[maybe_unused]] Reg n,
[[maybe_unused]] Imm<8> imm8) {
return PLDHandler(*this, W);
}
bool ThumbTranslatorVisitor::thumb32_PLD_imm12(bool W,
[[maybe_unused]] Reg n,
[[maybe_unused]] Imm<12> imm12) {
return PLDHandler(*this, W);
}
bool ThumbTranslatorVisitor::thumb32_PLD_reg(bool W,
[[maybe_unused]] Reg n,
[[maybe_unused]] Imm<2> imm2,
Reg m) {
if (m == Reg::PC) {
return UnpredictableInstruction();
}
return PLDHandler(*this, W);
}
} // namespace Dynarmic::A32

View file

@ -205,6 +205,12 @@ struct ThumbTranslatorVisitor final {
bool thumb32_STRH(Reg n, Reg t, Imm<2> imm2, Reg m);
bool thumb32_STR_reg(Reg n, Reg t, Imm<2> imm2, Reg m);
// thumb32 load byte and memory hints
bool thumb32_PLD_lit(bool U, Imm<12> imm12);
bool thumb32_PLD_imm8(bool W, Reg n, Imm<8> imm8);
bool thumb32_PLD_imm12(bool W, Reg n, Imm<12> imm12);
bool thumb32_PLD_reg(bool W, Reg n, Imm<2> imm2, Reg m);
// thumb32 data processing (register) instructions
bool thumb32_ASR_reg(Reg m, Reg d, Reg s);
bool thumb32_LSL_reg(Reg m, Reg d, Reg s);