Arm: BLX is UNPREDICTABLE when Rm is PC

This commit is contained in:
MerryMage 2016-08-07 20:50:33 +01:00
parent 1af5bef32c
commit 4dcd1d1859
2 changed files with 4 additions and 1 deletions

View file

@ -44,6 +44,8 @@ bool ArmTranslatorVisitor::arm_BLX_imm(bool H, Imm24 imm24) {
}
bool ArmTranslatorVisitor::arm_BLX_reg(Cond cond, Reg m) {
if (m == Reg::PC)
return UnpredictableInstruction();
// BLX <Rm>
if (ConditionPassed(cond)) {
ir.SetRegister(Reg::LR, ir.Imm32(ir.current_location.PC() + 4));

View file

@ -563,7 +563,8 @@ TEST_CASE("Fuzz ARM data processing instructions", "[JitX64]") {
TEST_CASE("Fuzz ARM branch instructions", "[JitX64]") {
const std::array<InstructionGenerator, 6> instructions = {{
InstructionGenerator("1111101hvvvvvvvvvvvvvvvvvvvvvvvv"),
InstructionGenerator("cccc000100101111111111110011mmmm"),
InstructionGenerator("cccc000100101111111111110011mmmm",
[](u32 instr) { return Bits<0, 3>(instr) != 0b1111; }), // R15 is UNPREDICTABLE
InstructionGenerator("cccc1010vvvvvvvvvvvvvvvvvvvvvvvv"),
InstructionGenerator("cccc1011vvvvvvvvvvvvvvvvvvvvvvvv"),
InstructionGenerator("cccc000100101111111111110001mmmm"),